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
array_key_exists false positive #6181
Comments
Hi, I had a quick look and saw that the constants are the "problem". BUT I think it's working as expected, as you're relying on static which is unsafe. Try either making the class final or use |
That seems to be the case. Static constant reference being resolved as mixed and then being evaluated twice the same way results as false positive. |
@Mika- the remaining error is coming from Anyways, do you agree that this is not a bug then? I think it behaves as expected. |
You should use |
Aah I think I got it, was thinking too much about types only. The constants are different of course and should not influence each other.. |
@Mika- After the latest push in 1.8.x, PHPStan now reports different result with your code snippet: @@ @@
-17: Strict comparison using === between false and true will always evaluate to false.
+No errors |
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
array_key_exists
result seems to get cached when calling multiple times and treatPhpDocTypesAsCertain is false.Code snippet that reproduces the problem
https://phpstan.org/r/b188b057-febf-4611-8d1b-2dec775d1892
Expected output
No errors
The text was updated successfully, but these errors were encountered: