Skip to content

More PHPStan level 6 cleanups, some *.php files - #1614

Merged
cpeel merged 7 commits into
DistributedProofreaders:masterfrom
bpfoley:level6-2
Aug 31, 2026
Merged

More PHPStan level 6 cleanups, some *.php files#1614
cpeel merged 7 commits into
DistributedProofreaders:masterfrom
bpfoley:level6-2

Conversation

@bpfoley

@bpfoley bpfoley commented Aug 31, 2026

Copy link
Copy Markdown
Collaborator

This is mostly adding function type hints, but in a few cases we:

  • Change the function signature/behaviour to make a little more sense
  • Add a variation of the function to handle polymorphic functions that can work on strings or associative arrays
  • Restrict the function return value (eg "" instead of null) to match the intended behaivour
  • Remove a little unused code
  • Fix a couple of erroneous function return types or array shape definitions (my bad)
  • Use a DTO instead of an array where it seems worth it
  • Express a variadic function more directly rather than using func_get_args

And do some minor tidyup while here.
While here, change credits.php to use a CreditDetails DTO rather
than repeating a shaped array in several PHPDocs or adding a
type alias to phpstan.neon
Introducing a new function where it's difficult to express that
a function based on `str_replace` can operate on strings or on
associative array with string values.

Do some minor tidyups too (although this code needs a lot more love)
This exposed some errors:
- `GraphConfig`'s shape was too restrictive: data can be `int[]` depending
  on the chart type
- `get_round_backlog_stats` had the wrong return type
- A few `SELECT SUM(*)`s need guards for when no rows match
- `stats/equilibria.php`'s days query param is unused.
@cpeel
cpeel merged commit f250f4c into DistributedProofreaders:master Aug 31, 2026
12 checks passed
@bpfoley
bpfoley deleted the level6-2 branch August 31, 2026 18:14
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