@@ -4639,6 +4639,9 @@ private function processClosureNode(
46394639 throw new ShouldNotHappenException ();
46404640 }
46414641
4642+ $ returnType = $ closureType ->getReturnType ();
4643+ $ isAlwaysTerminating = ($ returnType instanceof NeverType && $ returnType ->isExplicit ());
4644+
46424645 $ nodeCallback (new InClosureNode ($ closureType , $ expr ), $ closureScope );
46434646
46444647 $ executionEnds = [];
@@ -4690,7 +4693,7 @@ private function processClosureNode(
46904693 array_merge ($ statementResult ->getImpurePoints (), $ closureImpurePoints ),
46914694 ), $ closureScope );
46924695
4693- return new ProcessClosureResult ($ scope , $ statementResult ->getThrowPoints (), $ statementResult ->getImpurePoints (), $ invalidateExpressions , $ statementResult -> isAlwaysTerminating () );
4696+ return new ProcessClosureResult ($ scope , $ statementResult ->getThrowPoints (), $ statementResult ->getImpurePoints (), $ invalidateExpressions , $ isAlwaysTerminating );
46944697 }
46954698
46964699 $ count = 0 ;
@@ -4736,7 +4739,7 @@ private function processClosureNode(
47364739 array_merge ($ statementResult ->getImpurePoints (), $ closureImpurePoints ),
47374740 ), $ closureScope );
47384741
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 );
47404743 }
47414744
47424745 /**
0 commit comments