Skip to content

Commit

Permalink
Add moar tests
Browse files Browse the repository at this point in the history
  • Loading branch information
herndlm committed Oct 15, 2024
1 parent fbe4786 commit f0bd0f9
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions tests/PHPStan/Analyser/StatementResultTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,26 @@ public function dataIsAlwaysTerminating(): array
'while (true) { break; }',
false,
],
[
'while (true) { exit; }',
true,
],
[
'while (true) { while (true) { break; } }',
true, // should be false
],
[
'while (true) { while (true) { break 2; } }',
false, // should be true
],
[
'while (true) { while ($x) { break; } }',
true, // should be false
],
[
'while (true) { while ($x) { break 2; } }',
false, // should be true
],
[
'for (;;) { }',
true,
Expand All @@ -185,6 +205,26 @@ public function dataIsAlwaysTerminating(): array
'for (;;) { break; }',
false,
],
[
'for (;;) { exit; }',
true,
],
[
'for (;;) { for (;;) { break; } }',
true, // should be false
],
[
'for (;;) { for (;;) { break 2; } }',
false, // should be true
],
[
'for (;;) { for ($i = 0; $i< 5; $i++) { break; } }',
true, // should be false
],
[
'for (;;) { for ($i = 0; $i< 5; $i++) { break 2; } }',
false, // should be true
],
[
'do { } while (doFoo());',
false,
Expand Down

0 comments on commit f0bd0f9

Please sign in to comment.