Skip to content

Commit eea18f2

Browse files
committed
fix expectations
1 parent 54e283b commit eea18f2

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

src/Analyser/NodeScopeResolver.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3296,7 +3296,7 @@ static function (): void {
32963296
return new ExpressionResult(
32973297
$leftMergedWithRightScope,
32983298
$leftResult->hasYield() || $rightResult->hasYield(),
3299-
$leftResult->isAlwaysTerminating() || $rightResult->isAlwaysTerminating(),
3299+
$leftResult->isAlwaysTerminating(),
33003300
array_merge($leftResult->getThrowPoints(), $rightResult->getThrowPoints()),
33013301
array_merge($leftResult->getImpurePoints(), $rightResult->getImpurePoints()),
33023302
static fn (): MutatingScope => $rightResult->getScope()->filterByTruthyValue($expr),
@@ -3704,15 +3704,13 @@ static function (Node $node, Scope $scope) use ($nodeCallback): void {
37043704
$ifResult = $this->processExprNode($stmt, $expr->if, $ifTrueScope, $nodeCallback, $context);
37053705
$throwPoints = array_merge($throwPoints, $ifResult->getThrowPoints());
37063706
$impurePoints = array_merge($impurePoints, $ifResult->getImpurePoints());
3707-
$isAlwaysTerminating = $isAlwaysTerminating || $ifResult->isAlwaysTerminating();
37083707
$ifTrueScope = $ifResult->getScope();
37093708
$ifTrueType = $ifTrueScope->getType($expr->if);
37103709
}
37113710

37123711
$elseResult = $this->processExprNode($stmt, $expr->else, $ifFalseScope, $nodeCallback, $context);
37133712
$throwPoints = array_merge($throwPoints, $elseResult->getThrowPoints());
37143713
$impurePoints = array_merge($impurePoints, $elseResult->getImpurePoints());
3715-
$isAlwaysTerminating = $isAlwaysTerminating || $elseResult->isAlwaysTerminating();
37163714
$ifFalseScope = $elseResult->getScope();
37173715

37183716
$condType = $scope->getType($expr->cond);
@@ -4806,7 +4804,7 @@ private function processArrowFunctionNode(
48064804
$nodeCallback(new InArrowFunctionNode($arrowFunctionType, $expr), $arrowFunctionScope);
48074805
$exprResult = $this->processExprNode($stmt, $expr->expr, $arrowFunctionScope, $nodeCallback, ExpressionContext::createTopLevel());
48084806

4809-
return new ExpressionResult($scope, false, $exprResult->isAlwaysTerminating(), $exprResult->getThrowPoints(), $exprResult->getImpurePoints());
4807+
return new ExpressionResult($scope, false, false, $exprResult->getThrowPoints(), $exprResult->getImpurePoints());
48104808
}
48114809

48124810
/**

tests/PHPStan/Analyser/ExpressionResultTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,23 +72,23 @@ public static function dataIsAlwaysTerminating(): array
7272
],
7373
[
7474
'$x ? "abc" : exit();',
75-
true,
75+
false,
7676
],
7777
[
7878
'$x ? exit() : "abc";',
79-
true,
79+
false,
8080
],
8181
[
8282
'fn() => yield (exit());',
83-
true,
83+
false,
8484
],
8585
[
8686
'@exit();',
8787
true,
8888
],
8989
[
9090
'$x && exit();',
91-
true,
91+
false,
9292
],
9393
[
9494
'exit() && $x;',

0 commit comments

Comments
 (0)