Skip to content

Commit 1ef8abb

Browse files
staabmondrejmirtes
authored andcommitted
Simplify ContainerDynamicReturnTypeExtension
1 parent ee51903 commit 1ef8abb

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

build/PHPStan/Build/ContainerDynamicReturnTypeExtension.php

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,22 +30,14 @@ public function isMethodSupported(MethodReflection $methodReflection): bool
3030
], true);
3131
}
3232

33-
public function getTypeFromMethodCall(MethodReflection $methodReflection, MethodCall $methodCall, Scope $scope): Type
33+
public function getTypeFromMethodCall(MethodReflection $methodReflection, MethodCall $methodCall, Scope $scope): ?Type
3434
{
3535
if (count($methodCall->getArgs()) === 0) {
36-
return ParametersAcceptorSelector::selectFromArgs(
37-
$scope,
38-
$methodCall->getArgs(),
39-
$methodReflection->getVariants(),
40-
)->getReturnType();
36+
return null;
4137
}
4238
$argType = $scope->getType($methodCall->getArgs()[0]->value);
4339
if (!$argType instanceof ConstantStringType) {
44-
return ParametersAcceptorSelector::selectFromArgs(
45-
$scope,
46-
$methodCall->getArgs(),
47-
$methodReflection->getVariants(),
48-
)->getReturnType();
40+
return null;
4941
}
5042

5143
$type = new ObjectType($argType->getValue());

0 commit comments

Comments
 (0)