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

Understand variadic arg types with @no-named-arguments #1349

Merged
merged 3 commits into from May 28, 2022

Conversation

jrmajor
Copy link
Contributor

@jrmajor jrmajor commented May 25, 2022

First step for phpstan/phpstan#5968.

Comment on lines -2613 to +2617
if ($this->phpVersion->supportsNamedArguments()) {
if ($this->phpVersion->supportsNamedArguments() && $functionReflection->acceptsNamedArguments()) {
Copy link
Contributor Author

@jrmajor jrmajor May 25, 2022

Choose a reason for hiding this comment

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

There is a simillar check in getFunctionType(). I'm not sure whether I need to change anything there, as it seems to work as is.

@jrmajor
Copy link
Contributor Author

jrmajor commented May 25, 2022

We would also need a rule preventing child class from declaring @no-named-arguments when the parent doesn't and a rule reporting usage of named arguments when this annotation is present.

@ondrejmirtes
Copy link
Member

Really really nice!

We would also need a rule preventing child class from declaring...

This should be done in MethodSignatureRule.

And the usage of named arguments in @no-named-arguments should be reported in FunctionCallParametersCheck.

@ondrejmirtes ondrejmirtes merged commit 87b213d into phpstan:1.7.x May 28, 2022
@ondrejmirtes
Copy link
Member

Thank you! Looking forward to follow-up PRs!

@mhsdesign
Copy link

Fyi this seems to be the first followup #1400 but there seems to be no pr yet for preventing the calling site to use named args

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants