Skip to content

Burn down PHPStan baseline and raise level 6 → 8 (Phase 4) #96

@tonydspaniard

Description

@tonydspaniard

Tracking issue for the Phase 4 static-analysis program (AGENT.md §7, item 4.1).

Current state

PR #95 raised PHPStan to level 6 with a regenerated phpstan-baseline.neon (746 grandfathered errors). CI now enforces level 6 on all new/changed code; the baseline holds the existing debt.

The debt

The 746 baselined errors are overwhelmingly no value type specified in iterable type arrayarray declarations missing their array<K, V> value-type shapes. Fixing each requires understanding the concrete data shape, so this is per-package manual work, not automatable (Rector's TYPE_DECLARATION set is already applied and clean).

Plan (incremental, one PR per chunk)

  • Burn down the level-6 baseline package-by-package (add array<K,V> shapes, remove the corresponding baseline entries). Suggested order: smallest packages first (Structure, Common, Cookie), then larger (Http, Container).
  • When the baseline is empty (or near-empty), raise level 6 → 7, regenerate baseline, repeat burn-down.
  • Raise level 7 → 8, regenerate, burn down to zero.
  • Goal: phpstan-baseline.neon deleted, level: 8, no ignoreErrors beyond the documented ext-* stubs.

How to work it

# see remaining baselined errors for a package
vendor/bin/phpstan analyse src/Altair/<Package> --level=6   # without baseline include
# after fixing a package, regenerate:
vendor/bin/phpstan analyse --generate-baseline

Don't hand-edit phpstan-baseline.neon — regenerate it. Fix at root cause (add the array<K,V> annotation), never widen types to silence the checker.

Acceptance criteria

  • Level reaches 8 with an empty/deleted baseline
  • Each raise is its own PR, CI-green (stan + rector --dry-run + cs)
  • No type widened just to pass; annotations reflect real data shapes

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions