Skip to content

Remember value of arguments passed to {min,max}() #3928

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

Open
wants to merge 1 commit into
base: 2.1.x
Choose a base branch
from

Conversation

cs278
Copy link
Contributor

@cs278 cs278 commented Apr 9, 2025

Fixes phpstan/phpstan#12731

Hopefully this is a suitable fix as I started playing around with other ways of trying to achieve this when I found AlwaysRememberedExpr which makes this really simple!

@staabm
Copy link
Contributor

staabm commented Apr 10, 2025

searching the phpstan-src codebase with $scope->getType(new makes me feel we could have the same problem in a few more places.

would make sense to look into them, in case ondrej is happy with the fix (I have no idea whether/when AlwaysRememberedExpr should be used)

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.

Use of result of impure function in max(...) prevents type narrowing
2 participants