{{ message }}
Repository navigation
Conversation
The configuration hash covered the registered checkers' class names and configuration, so editing a project's own fixer or sniff kept serving results cached with its previous code until --clear-cache. Hash the source files of checkers living outside vendor/ (with their parents and traits) into it; vendor checkers still change only with their package. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0187H51XtF5pkbEiJDmttSnZ
Member
There was a problem hiding this comment.
At first glance, this seems quite costly to help with cache.
I'd accept some non-reflection approach, like package version.
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.

Problem
The cache's configuration hash covers the registered checkers' class names, their configuration and the ECS version, but not their code. A project that ships its own fixer or sniff (registered from
src/,tools/, …) keeps getting cached "no errors" for every unchanged file after editing that checker, until someone thinks of--clear-cache. CI caches restored from a previous run have the same problem, and nothing tells you the results are stale.Fix
FileHashComputer::computeConfig()now also hashes the source files of registered checkers that live outsidevendor/, together with their parent classes and traits. Checkers undervendor/, which covers every built-in rule in an installed ECS, are skipped: they only change with their package. In practice that means reading only the handful of custom checker files a project has, once per run.Only file contents are hashed, not their paths, so the same project checked out elsewhere (a git worktree, a CI runner) keeps its cache.
testInvalidateCacheOnLocalCheckerChangeregisters a local sniff, edits its file and expects a different configuration hash; it fails without the change.Context
PHP-CS-Fixer considered hashing every fixer's code in PHP-CS-Fixer/PHP-CS-Fixer#7003, which stalled partly on the cost of reading hundreds of vendor fixer files per run; skipping
vendor/avoids that cost. Until now we worked around it by feeding a hash of our fixers intowithCache(namespace: …), which only works because the namespace happens to be part of the hashed parameters.🤖 Generated with Claude Code
https://claude.ai/code/session_0187H51XtF5pkbEiJDmttSnZ