Skip to content

Conversation

staabm
Copy link
Contributor

@staabm staabm commented Oct 2, 2024

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

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