@@ -1915,7 +1915,7 @@ static function (Node $node, Scope $scope) use ($nodeCallback): void {
19151915 $ nodeCallback ($ node , $ scope );
19161916 },
19171917 ExpressionContext::createDeep (),
1918- static fn (MutatingScope $ scope ): ExpressionResult => new ExpressionResult ($ scope , false , [], []),
1918+ static fn (MutatingScope $ scope ): ExpressionResult => new ExpressionResult ($ scope , false , false , [], []),
19191919 false ,
19201920 )->getScope ();
19211921 } elseif ($ var instanceof PropertyFetch) {
@@ -2475,7 +2475,7 @@ function (MutatingScope $scope) use ($stmt, $expr, $nodeCallback, $context): Exp
24752475 $ scope = $ scope ->exitExpressionAssign ($ expr ->expr );
24762476 }
24772477
2478- return new ExpressionResult ($ scope , $ hasYield , $ throwPoints , $ impurePoints , isAlwaysTerminating: $ isAlwaysTerminating );
2478+ return new ExpressionResult ($ scope , $ hasYield , $ isAlwaysTerminating , $ throwPoints , $ impurePoints );
24792479 },
24802480 true ,
24812481 );
@@ -2513,9 +2513,9 @@ function (MutatingScope $scope) use ($stmt, $expr, $nodeCallback, $context): Exp
25132513 return new ExpressionResult (
25142514 $ result ->getScope ()->mergeWith ($ originalScope ),
25152515 $ result ->hasYield (),
2516+ $ result ->isAlwaysTerminating (),
25162517 $ result ->getThrowPoints (),
25172518 $ result ->getImpurePoints (),
2518- isAlwaysTerminating: $ result ->isAlwaysTerminating (),
25192519 );
25202520 }
25212521
@@ -2933,6 +2933,7 @@ static function (): void {
29332933 return new ExpressionResult (
29342934 $ scope ,
29352935 $ exprResult ->hasYield (),
2936+ false ,
29362937 $ exprResult ->getThrowPoints (),
29372938 $ exprResult ->getImpurePoints (),
29382939 static fn (): MutatingScope => $ scope ->filterByTruthyValue ($ expr ),
@@ -3135,6 +3136,7 @@ static function (): void {
31353136 return new ExpressionResult (
31363137 $ scope ,
31373138 $ exprResult ->hasYield (),
3139+ false ,
31383140 $ exprResult ->getThrowPoints (),
31393141 $ exprResult ->getImpurePoints (),
31403142 static fn (): MutatingScope => $ scope ->filterByTruthyValue ($ expr ),
@@ -3172,6 +3174,7 @@ static function (): void {
31723174 return new ExpressionResult (
31733175 $ processClosureResult ->getScope (),
31743176 false ,
3177+ false ,
31753178 [],
31763179 [],
31773180 );
@@ -3180,6 +3183,7 @@ static function (): void {
31803183 return new ExpressionResult (
31813184 $ result ->getScope (),
31823185 $ result ->hasYield (),
3186+ false ,
31833187 [],
31843188 [],
31853189 );
@@ -3276,6 +3280,7 @@ static function (): void {
32763280 return new ExpressionResult (
32773281 $ leftMergedWithRightScope ,
32783282 $ leftResult ->hasYield () || $ rightResult ->hasYield (),
3283+ false ,
32793284 array_merge ($ leftResult ->getThrowPoints (), $ rightResult ->getThrowPoints ()),
32803285 array_merge ($ leftResult ->getImpurePoints (), $ rightResult ->getImpurePoints ()),
32813286 static fn (): MutatingScope => $ rightResult ->getScope ()->filterByTruthyValue ($ expr ),
@@ -3296,6 +3301,7 @@ static function (): void {
32963301 return new ExpressionResult (
32973302 $ leftMergedWithRightScope ,
32983303 $ leftResult ->hasYield () || $ rightResult ->hasYield (),
3304+ false ,
32993305 array_merge ($ leftResult ->getThrowPoints (), $ rightResult ->getThrowPoints ()),
33003306 array_merge ($ leftResult ->getImpurePoints (), $ rightResult ->getImpurePoints ()),
33013307 static fn (): MutatingScope => $ leftMergedWithRightScope ->filterByTruthyValue ($ expr ),
@@ -3494,7 +3500,7 @@ static function (): void {
34943500 }
34953501 } elseif ($ expr instanceof List_) {
34963502 // only in assign and foreach, processed elsewhere
3497- return new ExpressionResult ($ scope , false , [], []);
3503+ return new ExpressionResult ($ scope , false , false , [], []);
34983504 } elseif ($ expr instanceof New_) {
34993505 $ parametersAcceptor = null ;
35003506 $ constructorReflection = null ;
@@ -3646,7 +3652,7 @@ static function (Node $node, Scope $scope) use ($nodeCallback): void {
36463652 $ nodeCallback ($ node , $ scope );
36473653 },
36483654 $ context ,
3649- static fn (MutatingScope $ scope ): ExpressionResult => new ExpressionResult ($ scope , false , [], []),
3655+ static fn (MutatingScope $ scope ): ExpressionResult => new ExpressionResult ($ scope , false , false , [], []),
36503656 false ,
36513657 )->getScope ();
36523658 } elseif ($ expr instanceof Ternary) {
@@ -3691,6 +3697,7 @@ static function (Node $node, Scope $scope) use ($nodeCallback): void {
36913697 return new ExpressionResult (
36923698 $ finalScope ,
36933699 $ ternaryCondResult ->hasYield (),
3700+ false ,
36943701 $ throwPoints ,
36953702 $ impurePoints ,
36963703 static fn (): MutatingScope => $ finalScope ->filterByTruthyValue ($ expr ),
@@ -4020,11 +4027,11 @@ static function (Node $node, Scope $scope) use ($nodeCallback): void {
40204027 return new ExpressionResult (
40214028 $ scope ,
40224029 $ hasYield ,
4030+ $ isAlwaysTerminating ,
40234031 $ throwPoints ,
40244032 $ impurePoints ,
40254033 static fn (): MutatingScope => $ scope ->filterByTruthyValue ($ expr ),
40264034 static fn (): MutatingScope => $ scope ->filterByFalseyValue ($ expr ),
4027- $ isAlwaysTerminating ,
40284035 );
40294036 }
40304037
@@ -4741,7 +4748,7 @@ private function processArrowFunctionNode(
47414748 $ nodeCallback (new InArrowFunctionNode ($ arrowFunctionType , $ expr ), $ arrowFunctionScope );
47424749 $ exprResult = $ this ->processExprNode ($ stmt , $ expr ->expr , $ arrowFunctionScope , $ nodeCallback , ExpressionContext::createTopLevel ());
47434750
4744- return new ExpressionResult ($ scope , false , $ exprResult ->getThrowPoints (), $ exprResult ->getImpurePoints ());
4751+ return new ExpressionResult ($ scope , false , false , $ exprResult ->getThrowPoints (), $ exprResult ->getImpurePoints ());
47454752 }
47464753
47474754 /**
@@ -5263,7 +5270,7 @@ static function (Node $node, Scope $scope) use ($nodeCallback): void {
52635270 $ nodeCallback ($ node , $ scope );
52645271 },
52655272 $ context ,
5266- static fn (MutatingScope $ scope ): ExpressionResult => new ExpressionResult ($ scope , false , [], []),
5273+ static fn (MutatingScope $ scope ): ExpressionResult => new ExpressionResult ($ scope , false , false , [], []),
52675274 true ,
52685275 );
52695276 $ scope = $ result ->getScope ();
@@ -5296,7 +5303,7 @@ static function (Node $node, Scope $scope) use ($nodeCallback): void {
52965303 }
52975304 }
52985305
5299- return new ExpressionResult ($ scope , $ hasYield , $ throwPoints , $ impurePoints , isAlwaysTerminating: $ isAlwaysTerminating );
5306+ return new ExpressionResult ($ scope , $ hasYield , $ isAlwaysTerminating , $ throwPoints , $ impurePoints );
53005307 }
53015308
53025309 /**
@@ -5855,7 +5862,7 @@ static function (): void {
58555862 new GetOffsetValueTypeExpr ($ assignedExpr , $ dimExpr ),
58565863 $ nodeCallback ,
58575864 $ context ,
5858- static fn (MutatingScope $ scope ): ExpressionResult => new ExpressionResult ($ scope , false , [], []),
5865+ static fn (MutatingScope $ scope ): ExpressionResult => new ExpressionResult ($ scope , false , false , [], []),
58595866 $ enterExpressionAssign ,
58605867 );
58615868 $ scope = $ result ->getScope ();
@@ -5941,7 +5948,7 @@ static function (): void {
59415948 }
59425949 }
59435950
5944- return new ExpressionResult ($ scope , $ hasYield , $ throwPoints , $ impurePoints , isAlwaysTerminating: $ isAlwaysTerminating );
5951+ return new ExpressionResult ($ scope , $ hasYield , $ isAlwaysTerminating , $ throwPoints , $ impurePoints );
59455952 }
59465953
59475954 /**
@@ -6277,7 +6284,7 @@ private function enterForeach(MutatingScope $scope, MutatingScope $originalScope
62776284 static function (): void {
62786285 },
62796286 ExpressionContext::createDeep (),
6280- static fn (MutatingScope $ scope ): ExpressionResult => new ExpressionResult ($ scope , false , [], []),
6287+ static fn (MutatingScope $ scope ): ExpressionResult => new ExpressionResult ($ scope , false , false , [], []),
62816288 true ,
62826289 )->getScope ();
62836290 $ vars = $ this ->getAssignedVariables ($ stmt ->valueVar );
@@ -6295,7 +6302,7 @@ static function (): void {
62956302 static function (): void {
62966303 },
62976304 ExpressionContext::createDeep (),
6298- static fn (MutatingScope $ scope ): ExpressionResult => new ExpressionResult ($ scope , false , [], []),
6305+ static fn (MutatingScope $ scope ): ExpressionResult => new ExpressionResult ($ scope , false , false , [], []),
62996306 true ,
63006307 )->getScope ();
63016308 $ vars = array_merge ($ vars , $ this ->getAssignedVariables ($ stmt ->keyVar ));
0 commit comments