Skip to content

Fix "Named arguments are supported only on PHP 8.0 and later." false positive #4032

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

Merged
merged 6 commits into from
May 28, 2025

Conversation

staabm
Copy link
Contributor

@staabm staabm commented May 28, 2025

@staabm
Copy link
Contributor Author

staabm commented May 28, 2025

I think the underlying problem is, that we remember PHP_VERSION_ID when narrowing and therefore fallback to a wrong scope-state.

see the scope-dump before/after the IF in this snippet:
https://phpstan.org/r/3462410d-1695-429c-ab2a-b552d340bb76


my current fix is wrong though

@staabm staabm marked this pull request as ready for review May 28, 2025 08:51
@phpstan-bot
Copy link
Collaborator

This pull request has been marked as ready for review.

@@ -34,6 +34,8 @@
final class ConstantResolver
{

public const PHP_MIN_ANALYZABLE_VERSION_ID = 50207;
Copy link
Contributor Author

@staabm staabm May 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this constant might need a better name. couldn't come up with something better.

@staabm
Copy link
Contributor Author

staabm commented May 28, 2025

the remaining failing tests are the same ones as in another just rebased PR of mine, therefore I think the errors are not related to this PR

@ondrejmirtes ondrejmirtes merged commit c3f27ec into phpstan:2.1.x May 28, 2025
407 of 413 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
Development

Successfully merging this pull request may close these issues.

3 participants