Skip to content

Preparation for PHPStan 2.3's unused function parameter warning - #1690

Merged
cpeel merged 4 commits into
DistributedProofreaders:masterfrom
bpfoley:phpstan-2.3-prep-2
Oct 20, 2026
Merged

cpeel merged 4 commits into
DistributedProofreaders:masterfrom
bpfoley:phpstan-2.3-prep-2

Conversation

@bpfoley

@bpfoley bpfoley commented Oct 16, 2026

Copy link
Copy Markdown
Collaborator

PHPStan 2.3 introduces a very useful function.unusedParameter warning.

In a few places in the code we have functions that must implement a specific API, even though they don't use all the function parameters, and we prefix all these parameter names with _.

PHPStan itself doesn't ignore unused parameters prefixed with _, as it does for variable assignments, but we can write a phpstan.neon ignoreErrors rule that allows us to ignore them, which we can add once we upgrade to PHPStan 2.3.

So PHPStan 2.3 can ignore them. This naming convention is used in
the Rust compiler & in Python linters.
These functions all need to have the same type signature as
functions from PHPBB, so even though these dummy/test functions
don't use the parameters, we need to keep them.
Comment thread pinc/daily_page_limit.inc
@cpeel
cpeel merged commit 73583be into DistributedProofreaders:master Oct 20, 2026
12 checks passed
@bpfoley
bpfoley deleted the phpstan-2.3-prep-2 branch October 20, 2026 21:53
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.

2 participants