@@ -2932,7 +2932,7 @@ static function (): void {
2932
2932
return new ExpressionResult (
2933
2933
$ scope ,
2934
2934
$ exprResult ->hasYield (),
2935
- false ,
2935
+ $ exprResult -> isAlwaysTerminating () ,
2936
2936
$ exprResult ->getThrowPoints (),
2937
2937
$ exprResult ->getImpurePoints (),
2938
2938
static fn (): MutatingScope => $ scope ->filterByTruthyValue ($ expr ),
@@ -3113,6 +3113,7 @@ static function (): void {
3113
3113
$ hasYield = $ hasYield || $ result ->hasYield ();
3114
3114
$ throwPoints = array_merge ($ throwPoints , $ result ->getThrowPoints ());
3115
3115
$ impurePoints = array_merge ($ impurePoints , $ result ->getImpurePoints ());
3116
+ $ isAlwaysTerminating = $ result ->isAlwaysTerminating ();
3116
3117
$ scope = $ result ->getScope ();
3117
3118
if ($ this ->phpVersion ->supportsPropertyHooks ()) {
3118
3119
$ throwPoints [] = ThrowPoint::createImplicit ($ scope , $ expr );
@@ -3137,7 +3138,7 @@ static function (): void {
3137
3138
return new ExpressionResult (
3138
3139
$ scope ,
3139
3140
$ exprResult ->hasYield (),
3140
- false ,
3141
+ $ exprResult -> isAlwaysTerminating () ,
3141
3142
$ exprResult ->getThrowPoints (),
3142
3143
$ exprResult ->getImpurePoints (),
3143
3144
static fn (): MutatingScope => $ scope ->filterByTruthyValue ($ expr ),
@@ -3161,13 +3162,15 @@ static function (): void {
3161
3162
$ hasYield = $ result ->hasYield ();
3162
3163
$ throwPoints = $ result ->getThrowPoints ();
3163
3164
$ impurePoints = $ result ->getImpurePoints ();
3165
+ $ isAlwaysTerminating = $ result ->isAlwaysTerminating ();
3164
3166
$ scope = $ result ->getScope ();
3165
3167
}
3166
3168
if ($ expr ->name instanceof Expr) {
3167
3169
$ result = $ this ->processExprNode ($ stmt , $ expr ->name , $ scope , $ nodeCallback , $ context ->enterDeep ());
3168
3170
$ hasYield = $ hasYield || $ result ->hasYield ();
3169
3171
$ throwPoints = array_merge ($ throwPoints , $ result ->getThrowPoints ());
3170
3172
$ impurePoints = array_merge ($ impurePoints , $ result ->getImpurePoints ());
3173
+ $ isAlwaysTerminating = $ isAlwaysTerminating || $ result ->isAlwaysTerminating ();
3171
3174
$ scope = $ result ->getScope ();
3172
3175
}
3173
3176
} elseif ($ expr instanceof Expr \Closure) {
@@ -3238,13 +3241,15 @@ static function (): void {
3238
3241
$ hasYield = $ result ->hasYield ();
3239
3242
$ throwPoints = $ result ->getThrowPoints ();
3240
3243
$ impurePoints = $ result ->getImpurePoints ();
3244
+ $ isAlwaysTerminating = $ result ->isAlwaysTerminating ();
3241
3245
$ scope = $ result ->getScope ();
3242
3246
}
3243
3247
3244
3248
$ result = $ this ->processExprNode ($ stmt , $ expr ->var , $ scope , $ nodeCallback , $ context ->enterDeep ());
3245
3249
$ hasYield = $ hasYield || $ result ->hasYield ();
3246
3250
$ throwPoints = array_merge ($ throwPoints , $ result ->getThrowPoints ());
3247
3251
$ impurePoints = array_merge ($ impurePoints , $ result ->getImpurePoints ());
3252
+ $ isAlwaysTerminating = $ isAlwaysTerminating || $ result ->isAlwaysTerminating ();
3248
3253
$ scope = $ result ->getScope ();
3249
3254
} elseif ($ expr instanceof Array_) {
3250
3255
$ itemNodes = [];
@@ -3455,6 +3460,7 @@ static function (): void {
3455
3460
$ hasYield = $ result ->hasYield ();
3456
3461
$ throwPoints = $ result ->getThrowPoints ();
3457
3462
$ impurePoints = $ result ->getImpurePoints ();
3463
+ $ isAlwaysTerminating = $ result ->isAlwaysTerminating ();
3458
3464
} else {
3459
3465
$ hasYield = false ;
3460
3466
$ throwPoints = [];
@@ -3468,6 +3474,7 @@ static function (): void {
3468
3474
$ hasYield = $ hasYield || $ result ->hasYield ();
3469
3475
$ throwPoints = array_merge ($ throwPoints , $ result ->getThrowPoints ());
3470
3476
$ impurePoints = array_merge ($ impurePoints , $ result ->getImpurePoints ());
3477
+ $ isAlwaysTerminating = $ isAlwaysTerminating || $ result ->isAlwaysTerminating ();
3471
3478
} else {
3472
3479
$ nodeCallback ($ expr ->name , $ scope );
3473
3480
}
@@ -3518,6 +3525,7 @@ static function (): void {
3518
3525
$ hasYield = $ hasYield || $ result ->hasYield ();
3519
3526
$ throwPoints = array_merge ($ throwPoints , $ result ->getThrowPoints ());
3520
3527
$ impurePoints = array_merge ($ impurePoints , $ result ->getImpurePoints ());
3528
+ $ isAlwaysTerminating = $ isAlwaysTerminating || $ result ->isAlwaysTerminating ();
3521
3529
}
3522
3530
} elseif ($ expr instanceof List_) {
3523
3531
// only in assign and foreach, processed elsewhere
@@ -3547,6 +3555,7 @@ static function (): void {
3547
3555
$ hasYield = $ result ->hasYield ();
3548
3556
$ throwPoints = $ result ->getThrowPoints ();
3549
3557
$ impurePoints = $ result ->getImpurePoints ();
3558
+ $ isAlwaysTerminating = $ result ->isAlwaysTerminating ();
3550
3559
foreach ($ additionalThrowPoints as $ throwPoint ) {
3551
3560
$ throwPoints [] = $ throwPoint ;
3552
3561
}
@@ -3642,6 +3651,7 @@ static function (): void {
3642
3651
$ hasYield = $ hasYield || $ result ->hasYield ();
3643
3652
$ throwPoints = array_merge ($ throwPoints , $ result ->getThrowPoints ());
3644
3653
$ impurePoints = array_merge ($ impurePoints , $ result ->getImpurePoints ());
3654
+ $ isAlwaysTerminating = $ isAlwaysTerminating || $ result ->isAlwaysTerminating ();
3645
3655
} elseif (
3646
3656
$ expr instanceof Expr \PreInc
3647
3657
|| $ expr instanceof Expr \PostInc
0 commit comments