@@ -2934,7 +2934,7 @@ static function (): void {
29342934 return new ExpressionResult (
29352935 $ scope ,
29362936 $ exprResult ->hasYield (),
2937- false ,
2937+ $ exprResult -> isAlwaysTerminating () ,
29382938 $ exprResult ->getThrowPoints (),
29392939 $ exprResult ->getImpurePoints (),
29402940 static fn (): MutatingScope => $ scope ->filterByTruthyValue ($ expr ),
@@ -3115,6 +3115,7 @@ static function (): void {
31153115 $ hasYield = $ hasYield || $ result ->hasYield ();
31163116 $ throwPoints = array_merge ($ throwPoints , $ result ->getThrowPoints ());
31173117 $ impurePoints = array_merge ($ impurePoints , $ result ->getImpurePoints ());
3118+ $ isAlwaysTerminating = $ result ->isAlwaysTerminating ();
31183119 $ scope = $ result ->getScope ();
31193120 if ($ this ->phpVersion ->supportsPropertyHooks ()) {
31203121 $ throwPoints [] = ThrowPoint::createImplicit ($ scope , $ expr );
@@ -3139,7 +3140,7 @@ static function (): void {
31393140 return new ExpressionResult (
31403141 $ scope ,
31413142 $ exprResult ->hasYield (),
3142- false ,
3143+ $ exprResult -> isAlwaysTerminating () ,
31433144 $ exprResult ->getThrowPoints (),
31443145 $ exprResult ->getImpurePoints (),
31453146 static fn (): MutatingScope => $ scope ->filterByTruthyValue ($ expr ),
@@ -3163,13 +3164,15 @@ static function (): void {
31633164 $ hasYield = $ result ->hasYield ();
31643165 $ throwPoints = $ result ->getThrowPoints ();
31653166 $ impurePoints = $ result ->getImpurePoints ();
3167+ $ isAlwaysTerminating = $ result ->isAlwaysTerminating ();
31663168 $ scope = $ result ->getScope ();
31673169 }
31683170 if ($ expr ->name instanceof Expr) {
31693171 $ result = $ this ->processExprNode ($ stmt , $ expr ->name , $ scope , $ nodeCallback , $ context ->enterDeep ());
31703172 $ hasYield = $ hasYield || $ result ->hasYield ();
31713173 $ throwPoints = array_merge ($ throwPoints , $ result ->getThrowPoints ());
31723174 $ impurePoints = array_merge ($ impurePoints , $ result ->getImpurePoints ());
3175+ $ isAlwaysTerminating = $ isAlwaysTerminating || $ result ->isAlwaysTerminating ();
31733176 $ scope = $ result ->getScope ();
31743177 }
31753178 } elseif ($ expr instanceof Expr \Closure) {
@@ -3240,13 +3243,15 @@ static function (): void {
32403243 $ hasYield = $ result ->hasYield ();
32413244 $ throwPoints = $ result ->getThrowPoints ();
32423245 $ impurePoints = $ result ->getImpurePoints ();
3246+ $ isAlwaysTerminating = $ result ->isAlwaysTerminating ();
32433247 $ scope = $ result ->getScope ();
32443248 }
32453249
32463250 $ result = $ this ->processExprNode ($ stmt , $ expr ->var , $ scope , $ nodeCallback , $ context ->enterDeep ());
32473251 $ hasYield = $ hasYield || $ result ->hasYield ();
32483252 $ throwPoints = array_merge ($ throwPoints , $ result ->getThrowPoints ());
32493253 $ impurePoints = array_merge ($ impurePoints , $ result ->getImpurePoints ());
3254+ $ isAlwaysTerminating = $ isAlwaysTerminating || $ result ->isAlwaysTerminating ();
32503255 $ scope = $ result ->getScope ();
32513256 } elseif ($ expr instanceof Array_) {
32523257 $ itemNodes = [];
@@ -3457,6 +3462,7 @@ static function (): void {
34573462 $ hasYield = $ result ->hasYield ();
34583463 $ throwPoints = $ result ->getThrowPoints ();
34593464 $ impurePoints = $ result ->getImpurePoints ();
3465+ $ isAlwaysTerminating = $ result ->isAlwaysTerminating ();
34603466 } else {
34613467 $ hasYield = false ;
34623468 $ throwPoints = [];
@@ -3470,6 +3476,7 @@ static function (): void {
34703476 $ hasYield = $ hasYield || $ result ->hasYield ();
34713477 $ throwPoints = array_merge ($ throwPoints , $ result ->getThrowPoints ());
34723478 $ impurePoints = array_merge ($ impurePoints , $ result ->getImpurePoints ());
3479+ $ isAlwaysTerminating = $ isAlwaysTerminating || $ result ->isAlwaysTerminating ();
34733480 } else {
34743481 $ nodeCallback ($ expr ->name , $ scope );
34753482 }
@@ -3520,6 +3527,7 @@ static function (): void {
35203527 $ hasYield = $ hasYield || $ result ->hasYield ();
35213528 $ throwPoints = array_merge ($ throwPoints , $ result ->getThrowPoints ());
35223529 $ impurePoints = array_merge ($ impurePoints , $ result ->getImpurePoints ());
3530+ $ isAlwaysTerminating = $ isAlwaysTerminating || $ result ->isAlwaysTerminating ();
35233531 }
35243532 } elseif ($ expr instanceof List_) {
35253533 // only in assign and foreach, processed elsewhere
@@ -3549,6 +3557,7 @@ static function (): void {
35493557 $ hasYield = $ result ->hasYield ();
35503558 $ throwPoints = $ result ->getThrowPoints ();
35513559 $ impurePoints = $ result ->getImpurePoints ();
3560+ $ isAlwaysTerminating = $ result ->isAlwaysTerminating ();
35523561 foreach ($ additionalThrowPoints as $ throwPoint ) {
35533562 $ throwPoints [] = $ throwPoint ;
35543563 }
@@ -3644,6 +3653,7 @@ static function (): void {
36443653 $ hasYield = $ hasYield || $ result ->hasYield ();
36453654 $ throwPoints = array_merge ($ throwPoints , $ result ->getThrowPoints ());
36463655 $ impurePoints = array_merge ($ impurePoints , $ result ->getImpurePoints ());
3656+ $ isAlwaysTerminating = $ isAlwaysTerminating || $ result ->isAlwaysTerminating ();
36473657 } elseif (
36483658 $ expr instanceof Expr \PreInc
36493659 || $ expr instanceof Expr \PostInc
0 commit comments