Skip to content

Fix forgetting static property access after impure call #3950

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 15 commits into from
Apr 20, 2025

Conversation

staabm
Copy link
Contributor

@staabm staabm commented Apr 19, 2025

@staabm staabm marked this pull request as ready for review April 19, 2025 09:45
@phpstan-bot
Copy link
Collaborator

This pull request has been marked as ready for review.

Comment on lines +2601 to +2602
$parametersAcceptor instanceof ClosureType && count($parametersAcceptor->getImpurePoints()) > 0
&& $scope->isInClass()
Copy link
Contributor Author

@staabm staabm Apr 20, 2025

Choose a reason for hiding this comment

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

last open question: do we want to invalidate 'this' in this case for regular function calls with side-effects?
we only handle Closure at this point right now

see #3950 (comment)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Scratch that. A function is pretty unlikely to affect $this or self

@ondrejmirtes ondrejmirtes merged commit 7489a09 into phpstan:2.1.x Apr 20, 2025
416 of 417 checks passed
@ondrejmirtes
Copy link
Member

Thank you!

@staabm staabm deleted the forget-static branch April 20, 2025 13:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment