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
Bogus property type narrowing when calling impure function #6407
Comments
Forgive the confusing default match arm, this is a distilled sample of code from PM... the point is that it shouldn't be reported as an error. |
This error is also sometimes accompanied by this on the last match arm for some reason:
I've yet to identify what makes this show up; all I do know is that removing the |
@dktapps After the latest push in 1.11.x, PHPStan now reports different result with your code snippet: @@ @@
-PHP 8.0 – 8.1 (1 error)
+PHP 8.0 – 8.1 (2 errors)
==========
+51: Match arm comparison between 1|2|3|4 and 0 is always false.
56: Match arm is unreachable because previous comparison is always true.
PHP 7.1 – 7.4 (11 errors) Full reportPHP 8.0 – 8.1 (2 errors)
PHP 7.1 – 7.4 (11 errors)
|
This new result seems more broken than before |
Fixed: phpstan/phpstan-src#2787 |
Nothing showing from the issue bot? |
Issue bot does not comment on closed issues. |
Right, I checked the latest result and it seems to be all green. Thanks! |
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. |
Bug report
This is an edge case I discovered while testing for a different bug in 1.4.1.
Code snippet that reproduces the problem
https://phpstan.org/r/09325d79-56ea-417e-825d-0314ebd22a19
Expected output
No error should be reported: not all values have been covered in the
match
, since the impure function call could result in a value change.The text was updated successfully, but these errors were encountered: