Skip to content

Commit 7ffd96d

Browse files
authored
Simplify NodeGetAttributeTypeExtension (#142)
1 parent edf0856 commit 7ffd96d

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/ReturnTypeExtension/NodeGetAttributeTypeExtension.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,18 +51,16 @@ public function getTypeFromMethodCall(
5151
MethodReflection $methodReflection,
5252
MethodCall $methodCall,
5353
Scope $scope
54-
): Type {
55-
$returnType = ParametersAcceptorSelector::selectSingle($methodReflection->getVariants())->getReturnType();
56-
54+
): ?Type {
5755
$firstArg = $methodCall->getArgs()[0];
5856

5957
$argumentValue = $this->resolveArgumentValue($firstArg->value);
6058
if ($argumentValue === null) {
61-
return $returnType;
59+
return null;
6260
}
6361

6462
if (! isset(self::ARGUMENT_KEY_TO_RETURN_TYPE[$argumentValue])) {
65-
return $returnType;
63+
return null;
6664
}
6765

6866
$knownReturnType = self::ARGUMENT_KEY_TO_RETURN_TYPE[$argumentValue];

0 commit comments

Comments
 (0)