Skip to content

Raise PHPStan to level 10 - #1

Merged
dnnsjsk merged 1 commit into
mainfrom
phpstan-level-10
May 19, 2026
Merged

Raise PHPStan to level 10#1
dnnsjsk merged 1 commit into
mainfrom
phpstan-level-10

Conversation

@dnnsjsk

@dnnsjsk dnnsjsk commented May 19, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Bumps phpstan.neon.dist from level 5 → 10 and resolves all 167 resulting errors across the src/ tree.
  • Tightens types throughout: narrow mixed with explicit checks, surface stdlib failure modes (unpack, zlib_encode, hex2bin) as typed exceptions, and add precise array shape / list / generic annotations where the contract was implicit.
  • Rewrites the recursive nested-array tree builders in Notes, Stash, and Repository as flat path-grouping passes. PHPStan can't express recursive array types via @phpstan-type, so the flat structure is both more type-safe and easier to follow.
  • Replaces SplPriorityQueue in CommitWalker with a typed array-based heap. The stdlib stub for SplPriorityQueue doesn't propagate the generic parameter from new, and the workaround (factory + inline @var) violates project rules. Order is preserved: newest-first by committer timestamp, FIFO for ties.

Test plan

  • composer analyse (level 10) — green
  • composer cs — green
  • ./bin/verify-all locally — 761/761 scenarios passed, full oracle regression clean
  • GitHub Actions CI green

🤖 Generated with Claude Code

Tighten types across the codebase so static analysis runs at the
strictest level. Replace unsafe casts of mixed values with explicit
narrowing, surface stdlib failure modes (unpack, zlib_encode, hex2bin)
as typed exceptions, and rewrite the recursive nested-array tree
builders in Notes/Stash/Repository as flat path-grouping passes that
phpstan can reason about. Replace SplPriorityQueue in CommitWalker
with a typed array-based heap (preserves newest-first + FIFO tiebreak)
because the stdlib stub is too loose at level 10.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented May 19, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
pitmaster Ignored Ignored May 19, 2026 5:40am

Request Review

@dnnsjsk
dnnsjsk merged commit cc4ab7e into main May 19, 2026
17 checks passed
@dnnsjsk
dnnsjsk deleted the phpstan-level-10 branch May 19, 2026 05:51
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