Skip to content
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

Cached return value does not check for changed property call parameters #4970

Closed
Khartir opened this issue May 6, 2021 · 2 comments
Closed
Labels
Milestone

Comments

@Khartir
Copy link

Khartir commented May 6, 2021

Bug report

As seen in the example, when a function is called with a class property as its parameter phpstan does not recognize when the property is changed between two calls and assumes the result stays the same.

If the function is called with a local variable instead, phpstan recognizes the change.

Code snippet that reproduces the problem

https://phpstan.org/r/204e22f1-fe33-4571-b2e5-571684fc6683

Expected output

No Errors

@ondrejmirtes ondrejmirtes added this to the Easy fixes milestone May 7, 2021
@phpstan-bot
Copy link
Contributor

@Khartir After the latest commit in dev-master, PHPStan now reports different result with your code snippet:

@@ @@
-28: If condition is always true.
-32: Ternary operator condition is always true.
+No errors

@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants