phpstan-src
phpstan-src copied to clipboard
Do not report do-while-false pseudo-loops that are interrupted by a break statement
This enables support of the do-break-while-false pattern:
do {
if ($foo) {
if ($bar) {
$a = 'baz';
break;
}
}
$a = foobar($baz);
} while (false); // no doWhile.alwaysFalse error
The error is still reported when the pseudo-loop is not broken with break.
(The second commit did not change semantics, only simplified redundant conditions.)