You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Suppress function.unusedParameter for params starting with _ #15480
Sometimes it's desirable to have free standing functions with one or more unused parameters. This can happen, for example, if you're implementing something like a router that dispatches to a registered function based on some runtime parameter.
Of course, you can avoid an extension altogether by simply adding the following to your phpstan.neon
parameters:
ignoreErrors:
# Ignore unused function params prefixed with `_`
- message: '#(Function|Method) .* has an unused parameter \$_.*\.#'
- message: '#(Function|Method) .* has a parameter \$_.* that only flows into values that are never used\.#'
Activity
Ignore unused function params prefixed with `_`
claudepache commentedon Oct 15, 2026
You could implement such a rule for your project with a custom Ignore Error Extension.
bpfoley commentedon Oct 15, 2026
Oh nice! Thanks for the suggestion. I'll probably do that for now, but I think this might be a useful feature to have in PHPStan.
bpfoley commentedon Oct 16, 2026
Of course, you can avoid an extension altogether by simply adding the following to your
phpstan.neonstaabm commentedon Oct 17, 2026
needs a phpstan.org/try reproducer
bpfoley commentedon Oct 17, 2026
https://phpstan.org/r/bdfb387b-d23c-4427-965f-4163694792ac
Ignore unused function params prefixed with `_`
Ignore unused function params prefixed with `_`
Ignore unused function params prefixed with `_`
Ignore unused function params prefixed with `_`