Skip to content

Conversation

@claudepache
Copy link
Contributor

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
Copy link
Contributor Author

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

@ondrejmirtes
Copy link
Member

I rebased the PR. It needs some fixes:


Parse error: tests/PHPStan/Rules/Comparison/data/do-while-loop.php:148
    146| 	}
    147| 
  > 148| 	public function doFoo12(array $a)
    149| 	{
    150| 		do {
Cannot redeclare DoWhileLoopConstantCondition\Foo::doFoo12()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants