Skip to content
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

Merged
merged 1 commit into from
Oct 3, 2024
Merged

Conversation

staabm
Copy link
Contributor

@staabm staabm commented Oct 2, 2024

remove unnecessary use of ParametersAcceptorSelector::selectSingle which is deprecated with PHPStan 2.x

@@ -51,18 +51,16 @@ public function getTypeFromMethodCall(
MethodReflection $methodReflection,
MethodCall $methodCall,
Scope $scope
): Type {
$returnType = ParametersAcceptorSelector::selectSingle($methodReflection->getVariants())->getReturnType();
Copy link
Member

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();

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

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 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exactly

@TomasVotruba TomasVotruba merged commit 7ffd96d into symplify:main Oct 3, 2024
6 checks passed
@TomasVotruba
Copy link
Member

Thanks 👍

@staabm staabm deleted the fix branch October 3, 2024 08:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants