-
Notifications
You must be signed in to change notification settings - Fork 20
Closed as not planned
@mglaman
Description
A common pattern is to use if/else statements for backward compatibility with deprecated methods to provide support between versions before the deprecation was introduced and to provide a fix for after.
One example can be found here: mglaman/phpstan-drupal#461
if (method_exists($this->moduleHandler, 'invokeAllWIth')) { // use the new invokeAllWIth method } else { // use legacy getImplementations method }
The easiest fix is to add // @phpstan-ignore-next-line whenever using backward compatible code. But I was trying to see if it'd be possible to use a node visitor to detect the if/else to set an attribute flag. Which it does seem possible (whether it is right or wrong.)
Would this package accept a check of checking for an attribute to imply a deprecated scope?
$node->getAttribute('inDeprecatedScope', false)
I don't know how other frameworks are handling this kind of bridge, I need to look.
Metadata
Metadata
Assignees
Labels
No labels