You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When comparing two expressions using an incremented value of the same variable as an offset, PHPStan does not see that the offset will change within the comparison and throws an error.
Code snippet that reproduces the problem
The code snippet in my project with this error is as follows:
do {
// snip
} while ($tokens->readOne(++$offset) instanceof CommaToken && $tokens->readOne(++$offset) instanceof IdentityToken);
However, I can also reproduce this on the playground.
In both examples, since $offset is different in both cases it is possible for both sides of the && to be independent. PHPStan is acting as if it believes that both of the values here are the same.
Did PHPStan help you today? Did it make you happy in any way?
You guys rock!
The text was updated successfully, but these errors were encountered:
Bug report
When comparing two expressions using an incremented value of the same variable as an offset, PHPStan does not see that the offset will change within the comparison and throws an error.
Code snippet that reproduces the problem
The code snippet in my project with this error is as follows:
However, I can also reproduce this on the playground.
https://phpstan.org/r/6b705626-659e-4753-94a5-756e167526e7
The error given is always a variation of:
Expected output
In both examples, since
$offset
is different in both cases it is possible for both sides of the&&
to be independent. PHPStan is acting as if it believes that both of the values here are the same.Did PHPStan help you today? Did it make you happy in any way?
You guys rock!
The text was updated successfully, but these errors were encountered: