-
-
Notifications
You must be signed in to change notification settings - Fork 946
Closed
Description
Bug report
While refactoring a LALR parser written in PHP I encountered an "Unreachable statement - code always terminates" false positive. I've reduced it down to a rather minimal test case.
I suspect this is caused by PHPStan perhaps not correctly interpreting the multi-layer break.
Code snippet that reproduces the problem
<?php
declare(strict_types=1);
$Str = '"';
while (true) {
switch ($Str) {
case '"':
break 2;
}
}
echo "Unreachable?\n";https://phpstan.org/r/464d0fc6-944f-4629-b3cd-7b7800c7e1df
PHPStan believes that the echo on line 14 is unreachable.
Expected output
Executing this code shows that that line is actually reachable.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels