File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -1494,6 +1494,25 @@ private function processStmtNode(
14941494 $ bodyScope = $ condResult ->getTruthyScope ();
14951495 }
14961496
1497+ if (!$ context ->isTopLevel () && $ isIterableAtLeastOnce ->no ()) {
1498+ if (!isset ($ condResult )) {
1499+ throw new ShouldNotHappenException ();
1500+ }
1501+ if ($ this ->polluteScopeWithLoopInitialAssignments ) {
1502+ $ finalScope = $ condResult ->getFalseyScope ()->mergeWith ($ initScope );
1503+ } else {
1504+ $ finalScope = $ condResult ->getFalseyScope ()->mergeWith ($ scope );
1505+ }
1506+ return new StatementResult (
1507+ $ finalScope ,
1508+ $ hasYield ,
1509+ false ,
1510+ [],
1511+ $ throwPoints ,
1512+ $ impurePoints ,
1513+ );
1514+ }
1515+
14971516 if ($ context ->isTopLevel ()) {
14981517 $ count = 0 ;
14991518 do {
You can’t perform that action at this time.
0 commit comments