Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix build
  • Loading branch information
staabm committed Jul 21, 2025
commit f18867b445dc2311e7b034af4326c808afd5e24f
8 changes: 4 additions & 4 deletions src/Analyser/NodeScopeResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -3383,7 +3383,7 @@ static function (): void {
$result = $this->processExprNode($stmt, $expr->expr, $scope, $nodeCallback, $context->enterDeep());
$throwPoints = $result->getThrowPoints();
$impurePoints = $result->getImpurePoints();
$isAlwaysTerminating = true;
$isAlwaysTerminating = $result->isAlwaysTerminating();
$hasYield = $result->hasYield();

$exprType = $scope->getType($expr->expr);
Expand Down Expand Up @@ -3751,7 +3751,7 @@ static function (Node $node, Scope $scope) use ($nodeCallback): void {
$scope = $keyResult->getScope();
$throwPoints = $keyResult->getThrowPoints();
$impurePoints = array_merge($impurePoints, $keyResult->getImpurePoints());
$isAlwaysTerminating = $isAlwaysTerminating || $keyResult->isAlwaysTerminating();
$isAlwaysTerminating = $keyResult->isAlwaysTerminating();
}
if ($expr->value !== null) {
$valueResult = $this->processExprNode($stmt, $expr->value, $scope, $nodeCallback, $context->enterDeep());
Expand Down Expand Up @@ -4029,7 +4029,7 @@ static function (Node $node, Scope $scope) use ($nodeCallback): void {
$hasYield = $classResult->hasYield();
$throwPoints = $classResult->getThrowPoints();
$impurePoints = $classResult->getImpurePoints();
$isAlwaysTerminating = $isAlwaysTerminating || $classResult->isAlwaysTerminating();
$isAlwaysTerminating = $classResult->isAlwaysTerminating();
}
if ($expr->getName() instanceof Expr) {
$nameResult = $this->processExprNode($stmt, $expr->getName(), $scope, $nodeCallback, ExpressionContext::createDeep());
Expand All @@ -4050,7 +4050,7 @@ static function (Node $node, Scope $scope) use ($nodeCallback): void {
$hasYield = $classResult->hasYield();
$throwPoints = $classResult->getThrowPoints();
$impurePoints = $classResult->getImpurePoints();
$isAlwaysTerminating = $isAlwaysTerminating || $classResult->isAlwaysTerminating();
$isAlwaysTerminating = $classResult->isAlwaysTerminating();
}
} elseif ($expr instanceof Node\Scalar) {
$hasYield = false;
Expand Down
4 changes: 4 additions & 0 deletions tests/PHPStan/Analyser/ExpressionResultTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ public static function dataIsAlwaysTerminating(): array
'$x ? "def" : "abc";',
false,
],
[
'(string) $x;',
false,
],
[
'sprintf("hello %s", exit());',
true,
Expand Down