Skip to content

Commit b730aed

Browse files
committed
fix regression
1 parent d7241b6 commit b730aed

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
@@ -2603,7 +2603,8 @@ static function (): void {
26032603

26042604
if ($parametersAcceptor !== null) {
26052605
$expr = ArgumentsNormalizer::reorderFuncArguments($parametersAcceptor, $expr) ?? $expr;
2606-
$isAlwaysTerminating = $parametersAcceptor->getReturnType() instanceof NeverType;
2606+
$returnType = $parametersAcceptor->getReturnType();
2607+
$isAlwaysTerminating = $returnType instanceof NeverType && $returnType->isExplicit();
26072608
}
26082609
$result = $this->processArgs($stmt, $functionReflection, null, $parametersAcceptor, $expr, $scope, $nodeCallback, $context);
26092610
$scope = $result->getScope();
@@ -2860,7 +2861,8 @@ static function (): void {
28602861

28612862
if ($parametersAcceptor !== null) {
28622863
$expr = ArgumentsNormalizer::reorderMethodArguments($parametersAcceptor, $expr) ?? $expr;
2863-
$isAlwaysTerminating = $parametersAcceptor->getReturnType() instanceof NeverType;
2864+
$returnType = $parametersAcceptor->getReturnType();
2865+
$isAlwaysTerminating = $returnType instanceof NeverType && $returnType->isExplicit();
28642866
}
28652867

28662868
$result = $this->processArgs(
@@ -3047,7 +3049,8 @@ static function (): void {
30473049

30483050
if ($parametersAcceptor !== null) {
30493051
$expr = ArgumentsNormalizer::reorderStaticCallArguments($parametersAcceptor, $expr) ?? $expr;
3050-
$isAlwaysTerminating = $parametersAcceptor->getReturnType() instanceof NeverType;
3052+
$returnType = $parametersAcceptor->getReturnType();
3053+
$isAlwaysTerminating = $returnType instanceof NeverType && $returnType->isExplicit();
30513054
}
30523055
$result = $this->processArgs($stmt, $methodReflection, null, $parametersAcceptor, $expr, $scope, $nodeCallback, $context, $closureBindScope ?? null);
30533056
$scope = $result->getScope();

0 commit comments

Comments
 (0)