Skip to content

Commit 583d6af

Browse files
authored
ImpossibleCheckTypeHelper: Remove unnecessary late-resolving
1 parent f1298b5 commit 583d6af

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/Rules/Comparison/ImpossibleCheckTypeHelper.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
use PHPStan\Type\ObjectType;
2929
use PHPStan\Type\Type;
3030
use PHPStan\Type\TypeTraverser;
31-
use PHPStan\Type\TypeUtils;
3231
use PHPStan\Type\TypeWithClassName;
3332
use PHPStan\Type\UnionType;
3433
use PHPStan\Type\VerbosityLevel;
@@ -428,7 +427,7 @@ private function determineContext(Scope $scope, Expr $node): TypeSpecifierContex
428427
if ($this->reflectionProvider->hasFunction($node->name, $scope)) {
429428
$functionReflection = $this->reflectionProvider->getFunction($node->name, $scope);
430429
$parametersAcceptor = ParametersAcceptorSelector::selectFromArgs($scope, $node->getArgs(), $functionReflection->getVariants(), $functionReflection->getNamedArgumentsVariants());
431-
$returnType = TypeUtils::resolveLateResolvableTypes($parametersAcceptor->getReturnType());
430+
$returnType = $parametersAcceptor->getReturnType();
432431

433432
return $returnType->isVoid()->yes() ? TypeSpecifierContext::createNull() : TypeSpecifierContext::createTruthy();
434433
}
@@ -437,7 +436,7 @@ private function determineContext(Scope $scope, Expr $node): TypeSpecifierContex
437436
$methodReflection = $scope->getMethodReflection($methodCalledOnType, $node->name->name);
438437
if ($methodReflection !== null) {
439438
$parametersAcceptor = ParametersAcceptorSelector::selectFromArgs($scope, $node->getArgs(), $methodReflection->getVariants(), $methodReflection->getNamedArgumentsVariants());
440-
$returnType = TypeUtils::resolveLateResolvableTypes($parametersAcceptor->getReturnType());
439+
$returnType = $parametersAcceptor->getReturnType();
441440

442441
return $returnType->isVoid()->yes() ? TypeSpecifierContext::createNull() : TypeSpecifierContext::createTruthy();
443442
}
@@ -451,7 +450,7 @@ private function determineContext(Scope $scope, Expr $node): TypeSpecifierContex
451450
$staticMethodReflection = $scope->getMethodReflection($calleeType, $node->name->name);
452451
if ($staticMethodReflection !== null) {
453452
$parametersAcceptor = ParametersAcceptorSelector::selectFromArgs($scope, $node->getArgs(), $staticMethodReflection->getVariants(), $staticMethodReflection->getNamedArgumentsVariants());
454-
$returnType = TypeUtils::resolveLateResolvableTypes($parametersAcceptor->getReturnType());
453+
$returnType = $parametersAcceptor->getReturnType();
455454

456455
return $returnType->isVoid()->yes() ? TypeSpecifierContext::createNull() : TypeSpecifierContext::createTruthy();
457456
}

0 commit comments

Comments
 (0)