Raise PHPStan to level 10 - #1
Merged
Merged
Conversation
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>
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
phpstan.neon.distfrom level 5 → 10 and resolves all 167 resulting errors across thesrc/tree.mixedwith 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.Notes,Stash, andRepositoryas 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.SplPriorityQueueinCommitWalkerwith a typed array-based heap. The stdlib stub forSplPriorityQueuedoesn't propagate the generic parameter fromnew, 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) — greencomposer cs— green./bin/verify-alllocally — 761/761 scenarios passed, full oracle regression clean🤖 Generated with Claude Code