-
-
Notifications
You must be signed in to change notification settings - Fork 864
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: If condition is always false. #2420
Comments
Maybe related: <?php
$foo = true;
if (mt_rand(0, 1) === 1) {
$foo = false;
if (mt_rand(0, 1) === 1) {
$foo = true;
}
}
if ($foo) {
} PhpStan reports |
@julienfalque After the latest commit in dev-master, PHPStan now reports different result with your code snippet: @@ @@
-13: If condition is always true.
+No errors |
@julienfalque Your issue got fixed by phpstan/phpstan-src@d4edc59 but was unrelated to the OP issue. |
Thank you @ondrejmirtes. |
@ondrejmirtes this bug is listed in the phpstan 1.0 release notes as beeing fixed. it seems thats a typo/mistake? |
@staabm Not really, it fixed #2420 (comment). (This is why I insist on separate issues for unrelated problems, but I didn't do that a lot 1,5 year ago). |
@iluuu1994 After the latest commit in dev-master, PHPStan now reports different result with your code snippet: @@ @@
-14: If condition is always 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. |
https://phpstan.org/r/eae81481-04ee-44d2-8ee8-e573625aa034
This only happens when the
CONFIG
is multidimensional. This here works:https://phpstan.org/r/0d649821-d7b9-446b-99a5-acd0e3a66002
The text was updated successfully, but these errors were encountered: