@@ -4639,6 +4639,9 @@ private function processClosureNode(
4639
4639
throw new ShouldNotHappenException ();
4640
4640
}
4641
4641
4642
+ $ returnType = $ closureType ->getReturnType ();
4643
+ $ isAlwaysTerminating = ($ returnType instanceof NeverType && $ returnType ->isExplicit ());
4644
+
4642
4645
$ nodeCallback (new InClosureNode ($ closureType , $ expr ), $ closureScope );
4643
4646
4644
4647
$ executionEnds = [];
@@ -4690,7 +4693,7 @@ private function processClosureNode(
4690
4693
array_merge ($ statementResult ->getImpurePoints (), $ closureImpurePoints ),
4691
4694
), $ closureScope );
4692
4695
4693
- return new ProcessClosureResult ($ scope , $ statementResult ->getThrowPoints (), $ statementResult ->getImpurePoints (), $ invalidateExpressions , $ statementResult -> isAlwaysTerminating () );
4696
+ return new ProcessClosureResult ($ scope , $ statementResult ->getThrowPoints (), $ statementResult ->getImpurePoints (), $ invalidateExpressions , $ isAlwaysTerminating );
4694
4697
}
4695
4698
4696
4699
$ count = 0 ;
@@ -4736,7 +4739,7 @@ private function processClosureNode(
4736
4739
array_merge ($ statementResult ->getImpurePoints (), $ closureImpurePoints ),
4737
4740
), $ closureScope );
4738
4741
4739
- return new ProcessClosureResult ($ scope ->processClosureScope ($ closureResultScope , null , $ byRefUses ), $ statementResult ->getThrowPoints (), $ statementResult ->getImpurePoints (), $ invalidateExpressions , $ statementResult -> isAlwaysTerminating () );
4742
+ return new ProcessClosureResult ($ scope ->processClosureScope ($ closureResultScope , null , $ byRefUses ), $ statementResult ->getThrowPoints (), $ statementResult ->getImpurePoints (), $ invalidateExpressions , $ isAlwaysTerminating );
4740
4743
}
4741
4744
4742
4745
/**
0 commit comments