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.
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.
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.
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
@deprecatedon const definitions