Skip to content

Commit 5b2a664

Browse files
clxmstaabstaabm
authored andcommitted
Remove unnecessary ParametersAcceptorSelector::selectSingle handling
1 parent 5eb198b commit 5b2a664

File tree

3 files changed

+4
-6
lines changed

3 files changed

+4
-6
lines changed

src/TypeExtension/MethodCall/ContainerGetReturnTypeExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function getTypeFromMethodCall(
3838
MethodReflection $methodReflection,
3939
MethodCall $methodCall,
4040
Scope $scope
41-
): Type {
41+
): ?Type {
4242
return $this->classConstFetchReturnTypeResolver->resolve($methodReflection, $methodCall);
4343
}
4444
}

src/TypeExtension/MethodCall/LaravelContainerMakeTypeExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function getTypeFromMethodCall(
3636
MethodReflection $methodReflection,
3737
MethodCall $methodCall,
3838
Scope $scope
39-
): Type {
39+
): ?Type {
4040
return $this->classConstFetchReturnTypeResolver->resolve($methodReflection, $methodCall);
4141
}
4242
}

src/TypeResolver/ClassConstFetchReturnTypeResolver.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,8 @@
1818

1919
final class ClassConstFetchReturnTypeResolver
2020
{
21-
public function resolve(MethodReflection $methodReflection, MethodCall $methodCall): Type
21+
public function resolve(MethodReflection $methodReflection, MethodCall $methodCall): ?Type
2222
{
23-
$returnType = ParametersAcceptorSelector::selectSingle($methodReflection->getVariants())->getReturnType();
24-
2523
if (! isset($methodCall->args[0])) {
2624
throw new ShouldNotHappenException('Not supported without argument');
2725
}
@@ -45,6 +43,6 @@ public function resolve(MethodReflection $methodReflection, MethodCall $methodCa
4543
return new ObjectType($className);
4644
}
4745

48-
return $returnType;
46+
return null;
4947
}
5048
}

0 commit comments

Comments
 (0)