We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
PHPStan reports errors for nested while loops.
PHPStan 1.9.2 (and older) does not produce this error, but PHPStan 1.9.3 to 1.9.6 does.
https://phpstan.org/r/e7e6df1c-ba29-4fd0-82e7-788f2a202177
<?php declare(strict_types = 1); $x = 0; while ($x < 4) { // Comparison operation "<" between 0 and 4 is always true. $y = 0; while ($y < 6) { $y += 1; } $x += 1; } echo 'done'; // Unreachable statement - code above always terminates.
This code produces no errors:
<?php declare(strict_types = 1); $x = 0; while ($x < 4) { $x += 1; } echo 'done';
PHPStan should report no errors, but reports two:
Comparison operation "<" between 0 and 4 is always true. Unreachable statement - code above always terminates.
The text was updated successfully, but these errors were encountered:
Fixed: phpstan/phpstan-src@091fcaf
Sorry, something went wrong.
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.
No branches or pull requests
Bug report
PHPStan reports errors for nested while loops.
PHPStan 1.9.2 (and older) does not produce this error, but PHPStan 1.9.3 to 1.9.6 does.
Code snippet that reproduces the problem
https://phpstan.org/r/e7e6df1c-ba29-4fd0-82e7-788f2a202177
This code produces no errors:
Expected output
PHPStan should report no errors, but reports two:
Comparison operation "<" between 0 and 4 is always true.
Unreachable statement - code above always terminates.
The text was updated successfully, but these errors were encountered: