Skip to content

Commit 6daf17c

Browse files
committed
fix build
1 parent b718211 commit 6daf17c

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/Analyser/NodeScopeResolver.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3383,7 +3383,7 @@ static function (): void {
33833383
$result = $this->processExprNode($stmt, $expr->expr, $scope, $nodeCallback, $context->enterDeep());
33843384
$throwPoints = $result->getThrowPoints();
33853385
$impurePoints = $result->getImpurePoints();
3386-
$isAlwaysTerminating = true;
3386+
$isAlwaysTerminating = $result->isAlwaysTerminating();
33873387
$hasYield = $result->hasYield();
33883388

33893389
$exprType = $scope->getType($expr->expr);
@@ -3751,7 +3751,7 @@ static function (Node $node, Scope $scope) use ($nodeCallback): void {
37513751
$scope = $keyResult->getScope();
37523752
$throwPoints = $keyResult->getThrowPoints();
37533753
$impurePoints = array_merge($impurePoints, $keyResult->getImpurePoints());
3754-
$isAlwaysTerminating = $isAlwaysTerminating || $keyResult->isAlwaysTerminating();
3754+
$isAlwaysTerminating = $keyResult->isAlwaysTerminating();
37553755
}
37563756
if ($expr->value !== null) {
37573757
$valueResult = $this->processExprNode($stmt, $expr->value, $scope, $nodeCallback, $context->enterDeep());
@@ -4029,7 +4029,7 @@ static function (Node $node, Scope $scope) use ($nodeCallback): void {
40294029
$hasYield = $classResult->hasYield();
40304030
$throwPoints = $classResult->getThrowPoints();
40314031
$impurePoints = $classResult->getImpurePoints();
4032-
$isAlwaysTerminating = $isAlwaysTerminating || $classResult->isAlwaysTerminating();
4032+
$isAlwaysTerminating = $classResult->isAlwaysTerminating();
40334033
}
40344034
if ($expr->getName() instanceof Expr) {
40354035
$nameResult = $this->processExprNode($stmt, $expr->getName(), $scope, $nodeCallback, ExpressionContext::createDeep());
@@ -4050,7 +4050,7 @@ static function (Node $node, Scope $scope) use ($nodeCallback): void {
40504050
$hasYield = $classResult->hasYield();
40514051
$throwPoints = $classResult->getThrowPoints();
40524052
$impurePoints = $classResult->getImpurePoints();
4053-
$isAlwaysTerminating = $isAlwaysTerminating || $classResult->isAlwaysTerminating();
4053+
$isAlwaysTerminating = $classResult->isAlwaysTerminating();
40544054
}
40554055
} elseif ($expr instanceof Node\Scalar) {
40564056
$hasYield = false;

tests/PHPStan/Analyser/ExpressionResultTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ public static function dataIsAlwaysTerminating(): array
3434
'$x ? "def" : "abc";',
3535
false,
3636
],
37+
[
38+
'(string) $x;',
39+
false,
40+
],
3741
[
3842
'sprintf("hello %s", exit());',
3943
true,

0 commit comments

Comments
 (0)