Skip to content

Commit 512705e

Browse files
committed
simplify
1 parent ed365ba commit 512705e

File tree

1 file changed

+1
-26
lines changed

1 file changed

+1
-26
lines changed

src/Analyser/TypeSpecifier.php

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
use PHPStan\Node\Printer\ExprPrinter;
2727
use PHPStan\Php\PhpVersion;
2828
use PHPStan\Reflection\Assertions;
29+
use PHPStan\Reflection\Callables\CallableParametersAcceptor;
2930
use PHPStan\Reflection\ExtendedParametersAcceptor;
3031
use PHPStan\Reflection\ParametersAcceptor;
3132
use PHPStan\Reflection\ParametersAcceptorSelector;
@@ -1783,7 +1784,6 @@ private function specifyTypesFromCallableCall(TypeSpecifierContext $context, Fun
17831784
$assertions = null;
17841785
$parametersAcceptor = null;
17851786

1786-
// Check for CallableParametersAcceptor with assertions (from first-class callables)
17871787
if ($calleeType->isCallable()->yes()) {
17881788
foreach ($calleeType->getCallableParametersAcceptors($scope) as $variant) {
17891789
$variantAssertions = $variant->getAsserts();
@@ -1797,31 +1797,6 @@ private function specifyTypesFromCallableCall(TypeSpecifierContext $context, Fun
17971797
}
17981798
}
17991799

1800-
// Check for constant string callables (e.g. $f = 'is_positive_int'; $f($v))
1801-
if ($assertions === null) {
1802-
foreach ($calleeType->getConstantStrings() as $constantString) {
1803-
if ($constantString->getValue() === '') {
1804-
continue;
1805-
}
1806-
$functionName = new Name($constantString->getValue());
1807-
if (!$this->reflectionProvider->hasFunction($functionName, $scope)) {
1808-
continue;
1809-
}
1810-
1811-
$functionReflection = $this->reflectionProvider->getFunction($functionName, $scope);
1812-
$functionAssertions = $functionReflection->getAsserts();
1813-
if ($functionAssertions->getAll() === []) {
1814-
continue;
1815-
}
1816-
1817-
$assertions = $functionAssertions;
1818-
if (count($args) > 0) {
1819-
$parametersAcceptor = ParametersAcceptorSelector::selectFromArgs($scope, $args, $functionReflection->getVariants(), $functionReflection->getNamedArgumentsVariants());
1820-
}
1821-
break;
1822-
}
1823-
}
1824-
18251800
if ($assertions === null || $assertions->getAll() === [] || $parametersAcceptor === null) {
18261801
return null;
18271802
}

0 commit comments

Comments
 (0)