re: How to deprecate a type in php VIEW POST


Interesting post ! Sadly I don't think it is possible to trigger a deprecation in a straightforward way in the case you present. Furthermore I'm not sure this chunk of code will work in all cases:


if (!class_exists(ShinyNewFoo::class, false)) {
        'LegacyFoo is deprecated!',

If ShinyNewFoo is used in your user's code before LegacyFoo, I'm not sure that the deprecation will be triggered.


You're correct, that's why I labelled this a best effort, it's really not ideal, but I'm afraid it's all we have.

code of conduct - report abuse