phpstan-src icon indicating copy to clipboard operation
phpstan-src copied to clipboard

Do not report do-while-false pseudo-loops that are interrupted by a break statement

Open claudepache opened this issue 2 months ago • 1 comments

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.

claudepache avatar Nov 12 '25 21:11 claudepache

(The second commit did not change semantics, only simplified redundant conditions.)

claudepache avatar Nov 14 '25 13:11 claudepache