Skip to content
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

Merged
merged 6 commits into from Mar 5, 2024
Merged

Conversation

staabm
Copy link
Contributor

@staabm staabm commented Mar 3, 2024

implement reflection for constants, to support use of @deprecated on const definitions

@staabm staabm changed the base branch from 1.11.x to 1.10.x March 3, 2024 07:54
@phpstan-bot
Copy link
Collaborator

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.

@staabm
Copy link
Contributor Author

staabm commented Mar 3, 2024

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

@staabm staabm marked this pull request as ready for review March 3, 2024 09:26
@phpstan-bot
Copy link
Collaborator

This pull request has been marked as ready for review.

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
Copy link
Member

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

Copy link
Contributor Author

@staabm staabm Mar 5, 2024

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?

Copy link
Member

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.

@ondrejmirtes ondrejmirtes merged commit e85f63d into phpstan:1.10.x Mar 5, 2024
437 of 440 checks passed
@ondrejmirtes
Copy link
Member

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants