File tree Expand file tree Collapse file tree 2 files changed +4
-2
lines changed
Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -1414,8 +1414,10 @@ private function processStmtNode(
14141414
14151415 if ($ alwaysIterates ) {
14161416 $ isAlwaysTerminating = count ($ finalScopeResult ->getExitPointsByType (Break_::class)) === 0 ;
1417+ } elseif ($ isIterableAtLeastOnce ->yes ()) {
1418+ $ isAlwaysTerminating = $ finalScopeResult ->isAlwaysTerminating ();
14171419 } else {
1418- $ isAlwaysTerminating = false ; // $finalScopeResult->isAlwaysTerminating() && $isAlwaysIterable
1420+ $ isAlwaysTerminating = false ;
14191421 }
14201422
14211423 return new StatementResult (
Original file line number Diff line number Diff line change @@ -243,7 +243,7 @@ public function dataIsAlwaysTerminating(): array
243243 ],
244244 [
245245 'for ($i = 0; $i < 10; $i++) { return; } ' ,
246- false , // will be true with range types
246+ true ,
247247 ],
248248 [
249249 'for ($i = 0; $i < 0; $i++) { return; } ' ,
You can’t perform that action at this time.
0 commit comments