Skip to content

Fixes to upgrade to PHPStan 2.3.1 - #1694

Merged
cpeel merged 6 commits into
DistributedProofreaders:masterfrom
bpfoley:phpstan-2.3.1
Oct 21, 2026
Merged

cpeel merged 6 commits into
DistributedProofreaders:masterfrom
bpfoley:phpstan-2.3.1

Conversation

@bpfoley

@bpfoley bpfoley commented Oct 20, 2026

Copy link
Copy Markdown
Collaborator

Add some final warning fixes and upgrade to PHPStan 2.3.1.

We're staying at level 6 for the moment, but PHPStan 2.3 has significantly improved its type analysis, and has introduced a number of unused/overwritten parameter/variable warnings that are very helpful for finding dead or incomplete code.

Found by PHPStan 2.3 complaining about unused `$valid_fields`
PHPStan can't see that the global `_bad_byte_sequences` is mutated
by `_install_bad_sequence` and thinks it's empty unless told otherwise
The table is an associative array, not a list, and the scores are
floats (because 'days since reg' is float).

Found by PHPStan 2.3.
We will be able to remove this with PHPStan 2.3.2
Comment thread pinc/html_page_common.inc
Comment on lines 22 to +26
static $was_output = false;
if ($was_output) {
return;
}
$was_output = true;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm 99% confident that this function is called once and only once now that we've cleaned up the codebase a few years back. We could consider adding a deprecation warning with a traceback in the if() to alert us if it is actually triggered anywhere so we could clean it up.

Not required in this PR but an idea for later while I was reviewing it.

@cpeel
cpeel merged commit 97120e8 into DistributedProofreaders:master Oct 21, 2026
12 checks passed
@bpfoley
bpfoley deleted the phpstan-2.3.1 branch October 21, 2026 22:36
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