Skip to content

chore(qa): raise PHPStan to level 6 - #55

Merged
ogorzalka merged 4 commits into
mainfrom
chore/phpstan-level-6
Nov 25, 2026
Merged

ogorzalka merged 4 commits into
mainfrom
chore/phpstan-level-6

Conversation

@ogorzalka

Copy link
Copy Markdown
Member

Branch: chore/phpstan-level-6 (base main at 22bc9be). Stack: 6 -> 7 -> 8.

What changed

96 errors, all missingType.iterableValue / template resolution: 52 in src/, 44 in tests/ (hook analyses its tests too).

  • src/: PHPDoc aliases on HookInterface (HookCallback = callable|string|array<array-key, mixed>, HookRegistration), imported with @phpstan-import-type. The callback array is deliberately array<array-key, mixed>: a first attempt with array{object|string, string} was refused by PHPStan itself (count() === 2 always true), because AbstractHook stores any array as-is for deferred resolution. $hooks is string|list<string>. PHPDoc only: no signature changes on the public API (Action, Filter, HookInterface, AbstractHook).
  • tests/: shapes on helpers, stubs and anonymous classes; 5 Pest template errors fixed by reading nullable values explicitly (callbacks('init') ?? [], $caught?->getPrevious()).
  • phpstan.neon: universalObjectCratesClasses: PHPUnit\Framework\TestCase replaces the ignore pattern for "undefined property PHPUnit\Framework\TestCase::$x". Same tolerance (Pest fixtures live in dynamic properties), but the properties are mixed, which expect() can resolve (the ignored error had made them an error type). A typo in a dynamic property is still not reported, as before.
  • composer.json: the phpstan and phpstan:ci scripts hard-coded --level=5, so the level in phpstan.neon was ignored by composer phpstan; removed, phpstan.neon owns the level (pollora-qa reads it from there).

Checked

0 errors at level 6, baseline 0; pest 552 pass + 1 incomplete (on main too); composer qa passes.

Not verified

Semgrep not run; mutation not measured; the WordPress suite (composer test:wordpress) not run (needs a database).

@ogorzalka
ogorzalka merged commit 0932841 into main Nov 25, 2026
15 checks passed
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.

1 participant