-
-
Notifications
You must be signed in to change notification settings - Fork 863
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
False positive when 10 conditions are joined by '||' in if. #3366
Comments
Happened in my code base too. |
@tekezo After the latest commit in dev-master, PHPStan now reports different result with your code snippet: @@ @@
-14: Strict comparison using === between *NEVER* and '0' will always evaluate to false.
+No errors |
@xPaw After the latest commit in dev-master, PHPStan now reports different result with your code snippet: @@ @@
-14: Strict comparison using === between *NEVER* and 'j' will always evaluate to false.
-15: Strict comparison using === between *NEVER* and 'k' will always evaluate to false.
-16: Strict comparison using === between *NEVER* and 'l' will always evaluate to false.
-17: Strict comparison using === between *NEVER* and 'm' will always evaluate to false.
-18: Strict comparison using === between *NEVER* and 'o' will always evaluate to false.
-19: Strict comparison using === between *NEVER* and 'p' will always evaluate to false.
+No errors |
Thanks! |
This isn't fully fixed, you can still break it by introducing an empty string into the mix: https://phpstan.org/r/d98133e1-9091-4c05-9126-4951aeef8a63 |
@ondrejmirtes After the latest commit in dev-master, PHPStan now reports different result with your code snippet: @@ @@
-15: Strict comparison using === between *NEVER* and '0' will always evaluate to false.
+No errors |
I managed to solve this.
Look forward to the next release (0.12.95) :) |
Ref phpstan/phpstan#4793 Ref phpstan/phpstan#5062 Ref phpstan/phpstan#5447 Ref phpstan/phpstan#5454 Ref phpstan/phpstan#3366 Ref phpstan/phpstan#5072 Ref phpstan/phpstan#3530 Ref phpstan/phpstan#5530 Ref phpstan/phpstan#1861 Ref phpstan/phpstan#4843 Ref phpstan/phpstan#4602 Ref phpstan/phpstan#4499 Ref phpstan/phpstan#2142
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
The following error is reported if 10 conditions are joined by '||' in if.
Code snippet that reproduces the problem
https://phpstan.org/r/4d8f632c-d4fc-4cc6-b9e2-ae81db46b548
There are no problem until 9 conditions.
https://phpstan.org/r/0f595079-d3a0-4fd1-aa2a-af28d9068fda
The text was updated successfully, but these errors were encountered: