-
-
Notifications
You must be signed in to change notification settings - Fork 946
Closed
Description
Bug report
Versions used:
- PHP 7.4
- PHPStan - PHP Static Analysis Tool 0.12.54
- Installed with Composer 2.0.6
Some code is incorrectly flagged as dead code:
------ -------------------------------------------------------
Line runtest2.php
------ -------------------------------------------------------
14 Unreachable statement - code above always terminates.
------ -------------------------------------------------------
Notes:
- This may be related to array_pop/array_shift false positive #2851.
- "PHPStan - PHP Static Analysis Tool 0.12.32" does not report this error.
Code snippet that reproduces the problem
<?php
array_shift($argv);
while ($argv) {
$arg = array_shift($argv);
if ($arg === 'foo') {
continue;
}
die();
}
echo "finished\n";
https://phpstan.org/r/8b26356d-c711-47b7-97b7-a79f050b8000
Expected output
I'd expect not to get a warning at all.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels