Skip to content

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)

@ondrejmirtes ondrejmirtes merged commit cc57957 into phpstan:2.1.x May 5, 2025
417 of 418 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.

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

3 participants