From afc2ca4909dcc1e8f02a3149b3a7dc13cb39e8b5 Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Wed, 2 Oct 2024 13:28:32 +0200 Subject: [PATCH] Simplify NodeGetAttributeTypeExtension --- src/ReturnTypeExtension/NodeGetAttributeTypeExtension.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/ReturnTypeExtension/NodeGetAttributeTypeExtension.php b/src/ReturnTypeExtension/NodeGetAttributeTypeExtension.php index dad02bc4..a52e873e 100644 --- a/src/ReturnTypeExtension/NodeGetAttributeTypeExtension.php +++ b/src/ReturnTypeExtension/NodeGetAttributeTypeExtension.php @@ -51,18 +51,16 @@ public function getTypeFromMethodCall( MethodReflection $methodReflection, MethodCall $methodCall, Scope $scope - ): Type { - $returnType = ParametersAcceptorSelector::selectSingle($methodReflection->getVariants())->getReturnType(); - + ): ?Type { $firstArg = $methodCall->getArgs()[0]; $argumentValue = $this->resolveArgumentValue($firstArg->value); if ($argumentValue === null) { - return $returnType; + return null; } if (! isset(self::ARGUMENT_KEY_TO_RETURN_TYPE[$argumentValue])) { - return $returnType; + return null; } $knownReturnType = self::ARGUMENT_KEY_TO_RETURN_TYPE[$argumentValue];