-
-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simplify NodeGetAttributeTypeExtension #142
Conversation
@@ -51,18 +51,16 @@ public function getTypeFromMethodCall( | |||
MethodReflection $methodReflection, | |||
MethodCall $methodCall, | |||
Scope $scope | |||
): Type { | |||
$returnType = ParametersAcceptorSelector::selectSingle($methodReflection->getVariants())->getReturnType(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think to keep 1 - 1 behaviour, selectFromArgs()
should be used
$returnType = ParametersAcceptorSelector::selectFromArgs($scope, $methodCall->getArgs(), $methodReflection->getVariants())->getReturnType();
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when returning null
PHPStan will use:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getReturnType()
return PHPStan type afaik, it maybe missing test here, but allow return null is changing behavior here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I understand it correctly, it fallbacks to selectFromArgs()
when null
is returned.
LGTM 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exactly
Thanks 👍 |
remove unnecessary use of
ParametersAcceptorSelector::selectSingle
which is deprecated with PHPStan 2.x