Skip to content

Commit bc97698

Browse files
committed
ClosureFromCallableDynamicReturnTypeExtension - small fix
1 parent 33af274 commit bc97698

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/Type/Php/ClosureFromCallableDynamicReturnTypeExtension.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use PhpParser\Node\Expr\StaticCall;
66
use PHPStan\Analyser\Scope;
77
use PHPStan\Reflection\MethodReflection;
8+
use PHPStan\Reflection\ParametersAcceptorSelector;
89
use PHPStan\Type\ClosureType;
910
use PHPStan\Type\ErrorType;
1011
use PHPStan\Type\Type;
@@ -25,6 +26,14 @@ public function isStaticMethodSupported(MethodReflection $methodReflection): boo
2526

2627
public function getTypeFromStaticMethodCall(MethodReflection $methodReflection, StaticCall $methodCall, Scope $scope): Type
2728
{
29+
if (!isset($methodCall->args[0])) {
30+
return ParametersAcceptorSelector::selectFromArgs(
31+
$scope,
32+
$methodCall->args,
33+
$methodReflection->getVariants()
34+
)->getReturnType();
35+
}
36+
2837
$callableType = $scope->getType($methodCall->args[0]->value);
2938
if ($callableType->isCallable()->no()) {
3039
return new ErrorType();

0 commit comments

Comments
 (0)