@@ -2932,7 +2932,7 @@ static function (): void {
29322932 return new ExpressionResult (
29332933 $ scope ,
29342934 $ exprResult ->hasYield (),
2935- false ,
2935+ $ exprResult -> isAlwaysTerminating () ,
29362936 $ exprResult ->getThrowPoints (),
29372937 $ exprResult ->getImpurePoints (),
29382938 static fn (): MutatingScope => $ scope ->filterByTruthyValue ($ expr ),
@@ -3113,6 +3113,7 @@ static function (): void {
31133113 $ hasYield = $ hasYield || $ result ->hasYield ();
31143114 $ throwPoints = array_merge ($ throwPoints , $ result ->getThrowPoints ());
31153115 $ impurePoints = array_merge ($ impurePoints , $ result ->getImpurePoints ());
3116+ $ isAlwaysTerminating = $ result ->isAlwaysTerminating ();
31163117 $ scope = $ result ->getScope ();
31173118 if ($ this ->phpVersion ->supportsPropertyHooks ()) {
31183119 $ throwPoints [] = ThrowPoint::createImplicit ($ scope , $ expr );
@@ -3137,7 +3138,7 @@ static function (): void {
31373138 return new ExpressionResult (
31383139 $ scope ,
31393140 $ exprResult ->hasYield (),
3140- false ,
3141+ $ exprResult -> isAlwaysTerminating () ,
31413142 $ exprResult ->getThrowPoints (),
31423143 $ exprResult ->getImpurePoints (),
31433144 static fn (): MutatingScope => $ scope ->filterByTruthyValue ($ expr ),
@@ -3161,13 +3162,15 @@ static function (): void {
31613162 $ hasYield = $ result ->hasYield ();
31623163 $ throwPoints = $ result ->getThrowPoints ();
31633164 $ impurePoints = $ result ->getImpurePoints ();
3165+ $ isAlwaysTerminating = $ result ->isAlwaysTerminating ();
31643166 $ scope = $ result ->getScope ();
31653167 }
31663168 if ($ expr ->name instanceof Expr) {
31673169 $ result = $ this ->processExprNode ($ stmt , $ expr ->name , $ scope , $ nodeCallback , $ context ->enterDeep ());
31683170 $ hasYield = $ hasYield || $ result ->hasYield ();
31693171 $ throwPoints = array_merge ($ throwPoints , $ result ->getThrowPoints ());
31703172 $ impurePoints = array_merge ($ impurePoints , $ result ->getImpurePoints ());
3173+ $ isAlwaysTerminating = $ isAlwaysTerminating || $ result ->isAlwaysTerminating ();
31713174 $ scope = $ result ->getScope ();
31723175 }
31733176 } elseif ($ expr instanceof Expr \Closure) {
@@ -3238,13 +3241,15 @@ static function (): void {
32383241 $ hasYield = $ result ->hasYield ();
32393242 $ throwPoints = $ result ->getThrowPoints ();
32403243 $ impurePoints = $ result ->getImpurePoints ();
3244+ $ isAlwaysTerminating = $ result ->isAlwaysTerminating ();
32413245 $ scope = $ result ->getScope ();
32423246 }
32433247
32443248 $ result = $ this ->processExprNode ($ stmt , $ expr ->var , $ scope , $ nodeCallback , $ context ->enterDeep ());
32453249 $ hasYield = $ hasYield || $ result ->hasYield ();
32463250 $ throwPoints = array_merge ($ throwPoints , $ result ->getThrowPoints ());
32473251 $ impurePoints = array_merge ($ impurePoints , $ result ->getImpurePoints ());
3252+ $ isAlwaysTerminating = $ isAlwaysTerminating || $ result ->isAlwaysTerminating ();
32483253 $ scope = $ result ->getScope ();
32493254 } elseif ($ expr instanceof Array_) {
32503255 $ itemNodes = [];
@@ -3455,6 +3460,7 @@ static function (): void {
34553460 $ hasYield = $ result ->hasYield ();
34563461 $ throwPoints = $ result ->getThrowPoints ();
34573462 $ impurePoints = $ result ->getImpurePoints ();
3463+ $ isAlwaysTerminating = $ result ->isAlwaysTerminating ();
34583464 } else {
34593465 $ hasYield = false ;
34603466 $ throwPoints = [];
@@ -3468,6 +3474,7 @@ static function (): void {
34683474 $ hasYield = $ hasYield || $ result ->hasYield ();
34693475 $ throwPoints = array_merge ($ throwPoints , $ result ->getThrowPoints ());
34703476 $ impurePoints = array_merge ($ impurePoints , $ result ->getImpurePoints ());
3477+ $ isAlwaysTerminating = $ isAlwaysTerminating || $ result ->isAlwaysTerminating ();
34713478 } else {
34723479 $ nodeCallback ($ expr ->name , $ scope );
34733480 }
@@ -3518,6 +3525,7 @@ static function (): void {
35183525 $ hasYield = $ hasYield || $ result ->hasYield ();
35193526 $ throwPoints = array_merge ($ throwPoints , $ result ->getThrowPoints ());
35203527 $ impurePoints = array_merge ($ impurePoints , $ result ->getImpurePoints ());
3528+ $ isAlwaysTerminating = $ isAlwaysTerminating || $ result ->isAlwaysTerminating ();
35213529 }
35223530 } elseif ($ expr instanceof List_) {
35233531 // only in assign and foreach, processed elsewhere
@@ -3547,6 +3555,7 @@ static function (): void {
35473555 $ hasYield = $ result ->hasYield ();
35483556 $ throwPoints = $ result ->getThrowPoints ();
35493557 $ impurePoints = $ result ->getImpurePoints ();
3558+ $ isAlwaysTerminating = $ result ->isAlwaysTerminating ();
35503559 foreach ($ additionalThrowPoints as $ throwPoint ) {
35513560 $ throwPoints [] = $ throwPoint ;
35523561 }
@@ -3642,6 +3651,7 @@ static function (): void {
36423651 $ hasYield = $ hasYield || $ result ->hasYield ();
36433652 $ throwPoints = array_merge ($ throwPoints , $ result ->getThrowPoints ());
36443653 $ impurePoints = array_merge ($ impurePoints , $ result ->getImpurePoints ());
3654+ $ isAlwaysTerminating = $ isAlwaysTerminating || $ result ->isAlwaysTerminating ();
36453655 } elseif (
36463656 $ expr instanceof Expr \PreInc
36473657 || $ expr instanceof Expr \PostInc
0 commit comments