Let the compositional-key shortcut clear virtual-node keys on the invalidated side - #6154
Merged
Merged
Conversation
…alidated side The invalidation pre-filters treated every '__phpstan' occurrence in the INVALIDATED expression's key as non-compositional: invalidating a virtual-keyed expression disabled the substring shortcut and swept the scope's whole holder population through the per-holder containment work. The holder side already consulted keyMayHideSubExpressions(); the invalidated side now does too, and ForeachValueByRef, IntertwinedVariableByReference and PropertyInitialization join COMPOSITIONAL_VIRTUAL_KEY_PREFIXES - their printers emit every walked sub-node (or the node walks none). The foreach and parameter original-value markers stay out deliberately: they hide a synthesized Variable child that containment-based invalidation must keep finding when the variable is reassigned. src/Analyser+src/Rules run: shouldInvalidateExpression() calls 759k -> 433k, containment scans 629k -> 297k. Mirrored in the native twin. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DaBZjgksga4c5s6Q9FniY7
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.
Extracted from the resolve-type-rewrite-2 branch (its f65dfce), where the same change plus a caller-prefilter port cut its invalidation-check volume 5.7×.
The invalidation pre-filters treated every
__phpstanoccurrence in the invalidated expression's key as non-compositional: invalidating a virtual-keyed expression (aPossiblyImpureCallExprentry, a foreach marker, …) disabled the substring shortcut and swept the scope's whole holder population through per-holder containment work. The holder side already consultedkeyMayHideSubExpressions(); the invalidated side now does too. Three more printers join the compositional whitelist —ForeachValueByRef,IntertwinedVariableByReference,PropertyInitialization— with a comment documenting the soundness contract and why the foreach/parameter original-value markers can never be listed (they hide a synthesizedVariablechild on purpose; it is their invalidation hook).Numbers on a
src/Analyser src/Rulesrun:shouldInvalidateExpression()calls 759k → 433k, containment scans 629k → 297k. CPU is neutral within noise (12 interleaved pairs: −0.1%) — the surviving scans on 2.2.x are small ones — so the value is the structural reduction and convergence: the rewrite branch already carries this change, and landing it here removes those hunks from the eventual merge diff.Mirrored in the native twin. Full test suite green with and without the active extension,
make phpstanandmake csclean.🤖 Generated with Claude Code
https://claude.ai/code/session_01DaBZjgksga4c5s6Q9FniY7