You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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.
The text was updated successfully, but these errors were encountered:
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
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 theif/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?
I don't know how other frameworks are handling this kind of bridge, I need to look.
The text was updated successfully, but these errors were encountered: