You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit a0d9720
Browse filesBrowse the repository at this point in the historyBrowse files
Avoid redundant work in hot type-system and scope paths
Profiling self-analysis (`analyse -l 8 src/Analyser src/Rules src/Type`)
surfaced several spots that recompute results that are either cacheable or
provably unnecessary. None of these change behaviour:
- MutatingScope::shouldInvalidateExpression: getNodeKey() is the
pretty-printed expression and the printer is compositional, so a
sub-expression's key is always a substring of its container's key. When
the invalidated key is not a substring of a stored expression's key, that
expression cannot contain it and the NodeFinder AST traversal is skipped.
Carve-outs for '$this' (matches self/static/parent), the non-compositional
'__phpstan…' virtual nodes, and '/*…*/' key suffixes keep it exact.
- IntersectionType::describe: cache the result per VerbosityLevel, mirroring
UnionType and ObjectType. IntersectionType::describe is a hot cache-key
producer (e.g. ObjectType::isSuperTypeOf) and was recomputed every call.
- ArrayType / ConstantArrayType: only a BenevolentUnionType describes with
the surrounding parens of '(int|string)' / '(int|non-decimal-int-string)'
(a plain union has no outer parens), so gate the describe() comparison
behind `instanceof BenevolentUnionType` instead of calling describe() for
every key type.
- TypeCombinator::intersect: the union-ordering comparator is a no-op unless
there are at least two UnionTypes, so skip the usort() in the common case.
- MemoizingReflectionProvider::hasClass: compute strtolower() once.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
0 commit comments