Skip to content

Ignore unused function params prefixed with _ - #6743

Open
bpfoley wants to merge 1 commit into
phpstan:2.3.xfrom
bpfoley:2.3.x
Open

bpfoley wants to merge 1 commit into
phpstan:2.3.xfrom
bpfoley:2.3.x

Conversation

@bpfoley

@bpfoley bpfoley commented Oct 14, 2026

Copy link
Copy Markdown

Like variable assignment in UnusedVariableRule and similar to Rust, Python, and GoLang linting rules:

Go treats arguments named _ as dummy arguments.
Rust uses the same rule for unused variables and function params. Python's ruff uses _prefix for unused-function-argument

Fixes phpstan/phpstan#15480

Like variable assignment in UnusedVariableRule and similar to Rust,
Python, and GoLang linting rules:

Go treats arguments named `_` as dummy arguments.
Rust uses the same rule for unused variables and function params.
Python's ruff uses _prefix for unused-function-argument

- https://docs.astral.sh/ruff/rules/unused-function-argument/
- https://doc.rust-lang.org/stable/rustc/lints/listing/warn-by-default.html#unused-variables
- https://tip.golang.org/gopls/analyzers#unusedparams

Fixes phpstan/phpstan#15480
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.

Suppress function.unusedParameter for params starting with _

1 participant