Skip to content

chore: raise PHPStan to level 6 with baseline (Phase 4)#95

Merged
tonydspaniard merged 1 commit into
masterfrom
feat/phpstan-level-6
May 27, 2026
Merged

chore: raise PHPStan to level 6 with baseline (Phase 4)#95
tonydspaniard merged 1 commit into
masterfrom
feat/phpstan-level-6

Conversation

@tonydspaniard
Copy link
Copy Markdown
Member

Part of the Phase 4 modernization (AGENT.md §7): raise PHPStan level 5 → 8 incrementally. This is step one — 5 → 6.

What

  • phpstan.neon.dist: level: 5level: 6.
  • phpstan-baseline.neon: regenerated — 746 errors grandfathered.

The project already used the baseline pattern (master is level-5-clean via an existing baseline), so this extends it rather than introducing a new mechanism. CI now enforces level 6 on all new and changed code immediately, while the existing debt is captured for incremental burn-down.

Why a baseline (not fix-all-now)

The 746 errors are overwhelmingly no value type specified in iterable type arrayarray that needs array<K,V> annotations, each requiring the concrete data shape to be understood. That's a multi-session, per-package manual effort; fixing 746 in one PR would be unreviewable. The baseline locks in the level-6 gate today and lets the debt be paid down separately (tracked — see linked issue).

Verification

  • composer stan: No errors (green at level 6)
  • rector process --dry-run: clean
  • php-cs-fixer --dry-run: clean
  • No source/test code changed — only the two config files.

Follow-up

Burn-down of the 746 baselined entries (and the subsequent 6→7→8 raises) is tracked separately. The baseline is auto-generated — regenerate with vendor/bin/phpstan analyse --generate-baseline after removing entries; don't hand-edit.

Raises phpstan.neon.dist level 5 -> 6 and regenerates phpstan-baseline.neon
(746 grandfathered errors). The project already uses the baseline pattern,
so this extends it: CI now enforces level 6 on all NEW and changed code
immediately, while the existing debt is captured for incremental burn-down.

The 746 baselined errors are overwhelmingly "no value type specified in
iterable type array" (missing array<K,V> shapes) — each needs the data
shape understood, so they're fixed per-package over time, not in one pass.

composer stan green; rector --dry-run clean; cs clean. Baseline file is
auto-generated (do not hand-edit) — regenerate with
`vendor/bin/phpstan analyse --generate-baseline` after burning down entries.
@tonydspaniard tonydspaniard merged commit 929e145 into master May 27, 2026
3 checks passed
@tonydspaniard tonydspaniard deleted the feat/phpstan-level-6 branch May 27, 2026 19:40
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