2626use PHPStan \Node \Printer \ExprPrinter ;
2727use PHPStan \Php \PhpVersion ;
2828use PHPStan \Reflection \Assertions ;
29+ use PHPStan \Reflection \Callables \CallableParametersAcceptor ;
2930use PHPStan \Reflection \ExtendedParametersAcceptor ;
3031use PHPStan \Reflection \ParametersAcceptor ;
3132use 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