-
Notifications
You must be signed in to change notification settings - Fork 478
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Report uses of deprecated constants #2953
Conversation
You've opened the pull request against the latest branch 1.11.x. If your code is relevant on 1.10.x and you want it to be released sooner, please rebase your pull request and change its target to 1.10.x. |
build errors should be adressed with phpstan/phpstan-deprecation-rules#112 I was not yet able to test it properly, as I did not yet found a way to use this phpstan-src patch in the deprecation-rules repo |
This pull request has been marked as ready for review. |
tests/PHPStan/Reflection/Constant/RuntimeConstantReflectionTest.php
Outdated
Show resolved
Hide resolved
yield [ | ||
new Name('\FILTER_SANITIZE_STRING'), | ||
TrinaryLogic::createYes(), | ||
'8.1', // deprecation message used in e.g. https://github.com/JetBrains/phpstorm-stubs/blob/9608c953230b08f07b703ecfe459cc58d5421437/filter/filter.php#L478 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be great to get rid of it, right. If the message === X.Y or X.Y.Z, we can remove it using regex
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
filtered it out using regex.
looking into the CI errors https://github.com/phpstan/phpstan-src/actions/runs/8152892522/job/22283354469?pr=2953 I got the idea, we could also turn the deprecation-message into Use of constant %s is deprecated since PHP %s.
instead of removing it completly. wdyt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we could also turn the deprecation-message into Use of constant %s is deprecated since PHP %s. instead of removing it completly. wdyt?
We don't do this for any other feature, I don't think it's worth it. Passing different phpVersion
or simply analysing it on phpstan.org/try makes it obvious what's going on.
Thank you. |
implement reflection for constants, to support use of
@deprecated
on const definitions