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
Resolve PHPStan issue with deprecated parameter order in PHP 8.1 #2963
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. |
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.
I'm worried this is a lot more complex topic. For example: Why is this reported only on PHP 8.3+? https://3v4l.org/e6n6Q
Also - your message says "Deprecated in 8.0" but in code your condition says >= 80100
.
Thank you for the review. I was aware that this code was generating deprecated warnings from PHP 8.1. https://3v4l.org/0VAUk |
@ondrejmirtes For this update, I am considering issuing warnings for nullable types deprecated since PHP 8.1 and for union types and mixed types deprecated since PHP 8.3. I would like the message format to only replace the version number. |
@sayuprc Yes, that would be okay 👍 |
Awesome, thank you! |
I just noticed this doesn't make any tests fail - is that right? 6512a84 |
@ondrejmirtes |
@sayuprc Please send a fix with a test as a new PR. Thank you. |
@ondrejmirtes |
Since PHP 8.1, a nullable, optional parameter with a default value of null followed by a required parameter will generate a warning.
The current PHPStan did not recognize such code as deprecated.
This PR updates PHPStan to properly handle such cases.
Please review.
Thank you.
resolve phpstan/phpstan#6668