Thanks to visit codestin.com
Credit goes to github.com

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 arrow-fn and suppress
  • Loading branch information
staabm committed Jul 21, 2025
commit 4e009046aaaca8eb7bdf8bea1b615268c828f54e
6 changes: 3 additions & 3 deletions src/Analyser/NodeScopeResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -3187,7 +3187,7 @@ static function (): void {
return new ExpressionResult(
$result->getScope(),
$result->hasYield(),
false,
$result->isAlwaysTerminating(),
[],
[],
);
Expand All @@ -3196,7 +3196,7 @@ static function (): void {
$hasYield = $result->hasYield();
$throwPoints = $result->getThrowPoints();
$impurePoints = $result->getImpurePoints();
$isAlwaysTerminating = false;
$isAlwaysTerminating = $result->isAlwaysTerminating();
$scope = $result->getScope();
} elseif ($expr instanceof Exit_) {
$hasYield = false;
Expand Down Expand Up @@ -4794,7 +4794,7 @@ private function processArrowFunctionNode(
$nodeCallback(new InArrowFunctionNode($arrowFunctionType, $expr), $arrowFunctionScope);
$exprResult = $this->processExprNode($stmt, $expr->expr, $arrowFunctionScope, $nodeCallback, ExpressionContext::createTopLevel());

return new ExpressionResult($scope, false, false, $exprResult->getThrowPoints(), $exprResult->getImpurePoints());
return new ExpressionResult($scope, false, $exprResult->isAlwaysTerminating(), $exprResult->getThrowPoints(), $exprResult->getImpurePoints());
}

/**
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 @@ -74,6 +74,10 @@ public static function dataIsAlwaysTerminating(): array
'fn() => yield (exit());',
true,
],
[
'@exit();',
true,
],
];
}

Expand Down