Skip to content

Commit

Permalink
NeverType is not callable
Browse files Browse the repository at this point in the history
  • Loading branch information
staabm committed Jul 15, 2024
1 parent d361fd2 commit 18e7e7f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
5 changes: 1 addition & 4 deletions src/Analyser/NodeScopeResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
5 changes: 2 additions & 3 deletions src/Type/NeverType.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 18e7e7f

Please sign in to comment.