Skip to content

Commit 24b8a0c

Browse files
committed
fix regression
1 parent 3b55545 commit 24b8a0c

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/Analyser/NodeScopeResolver.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2601,7 +2601,8 @@ static function (): void {
26012601

26022602
if ($parametersAcceptor !== null) {
26032603
$expr = ArgumentsNormalizer::reorderFuncArguments($parametersAcceptor, $expr) ?? $expr;
2604-
$isAlwaysTerminating = $parametersAcceptor->getReturnType() instanceof NeverType;
2604+
$returnType = $parametersAcceptor->getReturnType();
2605+
$isAlwaysTerminating = $returnType instanceof NeverType && $returnType->isExplicit();
26052606
}
26062607
$result = $this->processArgs($stmt, $functionReflection, null, $parametersAcceptor, $expr, $scope, $nodeCallback, $context);
26072608
$scope = $result->getScope();
@@ -2857,7 +2858,8 @@ static function (): void {
28572858

28582859
if ($parametersAcceptor !== null) {
28592860
$expr = ArgumentsNormalizer::reorderMethodArguments($parametersAcceptor, $expr) ?? $expr;
2860-
$isAlwaysTerminating = $parametersAcceptor->getReturnType() instanceof NeverType;
2861+
$returnType = $parametersAcceptor->getReturnType();
2862+
$isAlwaysTerminating = $returnType instanceof NeverType && $returnType->isExplicit();
28612863
}
28622864

28632865
$result = $this->processArgs(
@@ -3044,7 +3046,8 @@ static function (): void {
30443046

30453047
if ($parametersAcceptor !== null) {
30463048
$expr = ArgumentsNormalizer::reorderStaticCallArguments($parametersAcceptor, $expr) ?? $expr;
3047-
$isAlwaysTerminating = $parametersAcceptor->getReturnType() instanceof NeverType;
3049+
$returnType = $parametersAcceptor->getReturnType();
3050+
$isAlwaysTerminating = $returnType instanceof NeverType && $returnType->isExplicit();
30483051
}
30493052
$result = $this->processArgs($stmt, $methodReflection, null, $parametersAcceptor, $expr, $scope, $nodeCallback, $context, $closureBindScope ?? null);
30503053
$scope = $result->getScope();

0 commit comments

Comments
 (0)