From 18e7e7f02aafc70fd39b0202bb99bdb9608e5025 Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Mon, 15 Jul 2024 22:52:00 +0200 Subject: [PATCH] NeverType is not callable --- src/Analyser/NodeScopeResolver.php | 5 +---- src/Type/NeverType.php | 5 ++--- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/Analyser/NodeScopeResolver.php b/src/Analyser/NodeScopeResolver.php index 1b128272a4..26a056877a 100644 --- a/src/Analyser/NodeScopeResolver.php +++ b/src/Analyser/NodeScopeResolver.php @@ -4622,10 +4622,7 @@ private function processArgs( $scope = $exprResult->getScope(); $hasYield = $hasYield || $exprResult->hasYield(); - if ( - $exprType->isCallable()->yes() - && (!$exprType instanceof NeverType || $exprType->isExplicit()) - ) { + if ($exprType->isCallable()->yes()) { $acceptors = $exprType->getCallableParametersAcceptors($scope); if (count($acceptors) === 1) { $scope = $this->processImmediatelyCalledCallable($scope, $acceptors[0]->getInvalidateExpressions(), $acceptors[0]->getUsedVariables()); diff --git a/src/Type/NeverType.php b/src/Type/NeverType.php index da6da83793..7cb90522b8 100644 --- a/src/Type/NeverType.php +++ b/src/Type/NeverType.php @@ -9,7 +9,6 @@ use PHPStan\Reflection\ConstantReflection; use PHPStan\Reflection\ExtendedMethodReflection; use PHPStan\Reflection\PropertyReflection; -use PHPStan\Reflection\TrivialParametersAcceptor; use PHPStan\Reflection\Type\UnresolvedMethodPrototypeReflection; use PHPStan\Reflection\Type\UnresolvedPropertyPrototypeReflection; use PHPStan\ShouldNotHappenException; @@ -334,12 +333,12 @@ public function shuffleArray(): Type public function isCallable(): TrinaryLogic { - return TrinaryLogic::createYes(); + return TrinaryLogic::createNo(); } public function getCallableParametersAcceptors(ClassMemberAccessAnswerer $scope): array { - return [new TrivialParametersAcceptor()]; + return []; } public function isCloneable(): TrinaryLogic