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

Remove SlevomatCodingStandard.Functions.UnusedParameter #25

Open
asispts opened this issue Jan 17, 2024 · 0 comments
Open

Remove SlevomatCodingStandard.Functions.UnusedParameter #25

asispts opened this issue Jan 17, 2024 · 0 comments

Comments

@asispts
Copy link
Owner

asispts commented Jan 17, 2024

Coding standard can't be used for this purpose as it's unable to analyze code from a different file.

The main problem is that the rule can't ignore unused parameters that belong to the function definition inherited from parent methods or an interface. For example, in Symfony form, parameter $options is often unused, the rule will report it as unused. Although we can use phpcs:ignore to ignore this warning, it will add unnecessary technical debt.

public function buildForm(FormBuilderInterface $builder, array $options): void
{
    ...
}

We can use static analyzer for this task. See, for example, phpstan/phpstan#3031

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

No branches or pull requests

1 participant