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
LHS always true - not necessarily #1746
Comments
Yeah, it's a bug because of the |
Easy enough. I'll leave this issue open for you to handle. Thanks! 💯 |
Another regression:
on protected function propertyInUse(array $tokens, $closeTagIndex, $variable) {
$property = substr($variable, 1);
$i = $closeTagIndex + 1;
while (isset($tokens[$i])) {
...
if ($tokens[$i]['code'] !== T_STRING || $tokens[$i]['content'] !== $property) { // 509
$i++;
continue;
} thats invalid reporting here. workaround as assignment works: $token = $tokens[$i];
if ($token['code'] !== T_STRING || $token['content'] !== $property) { but this is super annoying to be done everywhere to silence this wrong reporting. |
Looking at the original example https://phpstan.org/r/2026695c-98ae-49f9-9e3f-f88c1051c6f0 I think PHPStan might be actually correct. Because the foreach is terminated (broken out of) when |
Closes phpstan/phpstan#5893 Closes phpstan/phpstan#6070 Closes phpstan/phpstan#5869 Closes phpstan/phpstan#6212 Closes phpstan/phpstan#6262 Closes phpstan/phpstan#6266 Closes phpstan/phpstan#6023 Closes phpstan/phpstan#6108 Closes phpstan/phpstan#6020 Closes phpstan/phpstan#1746 Closes phpstan/phpstan#1516 Closes phpstan/phpstan#6174 Closes phpstan/phpstan#6112 Closes phpstan/phpstan#5749 Closes phpstan/phpstan#5969 Closes phpstan/phpstan#5295 Closes phpstan/phpstan#5675 Closes phpstan/phpstan#5369 Closes phpstan/phpstan#6699 Closes phpstan/phpstan#6505
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. |
In this code snippet, I am iteratively redetermining whether a bool variable is still true (sort of like an
array_reduce
, but more complex).PHPStan is reporting
Left side of && is always true.
Am I doing something wrong?
The text was updated successfully, but these errors were encountered: