Replies: 1 comment 4 replies
-
So the problem is that Related:
I think we should introduce something like |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
This is a tricky one, and I'm not sure the best way to handle it. In Drupal we had a lot of random test assert helps carried over from our Simpltest pre-PHPUnit days. One of which was
assertOptionSelected
, which lived in a trait. It was marked as@deprecated
and some projects have made their own updated version of the method to avoid rewriting a bunch of tests.I understand why PHPStan still flags this as a deprecated call: PHPStan has no idea if this override has no side effects (ie: won't be executed in the future or whatever.)
It does so here:
\PHPStan\Reflection\Php\PhpMethodReflection::isDeprecated
The
$this->reflection
is not deprecated due to overridden PHPDoc without@inheritdoc
tag, but$this->isDeprecated
is already true.My thought was:
If the called method is deprecated, check if it exists in the current class. If it has been overridden and does not invoke its parent, consider as a replacement for the deprecated parent method. (This seems very messy.)
I didn't open an issue for https://github.com/phpstan/phpstan-deprecation-rules as it doesn't seem like a bug or something that could have a straight forward fix. I'm going to guess the best fix is to have code add
// @phpstan-ignore-next-line
until Drupal 10.0.0 is released and the deprecated code is officially killed off.Beta Was this translation helpful? Give feedback.
All reactions