Skip to content

[TypeDeclaration] Speed up StrictArrayParamDimFetchRector with cheap param pre-check - #8606

Merged
TomasVotruba merged 2 commits into
mainfrom
tv-perf-strict-array-param
Oct 10, 2026
Merged

TomasVotruba merged 2 commits into
mainfrom
tv-perf-strict-array-param

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

Perf

StrictArrayParamDimFetchRector ran two parent reflection guards (hasParentClassMethod() walks the parent class/interface/trait reflections, isTypeGuardedClass()) on every ClassMethod before looking at its params. The rule can only ever add a type to a param that is currently untyped and non-variadic.

Added a cheap structural pre-check: if no param is untyped + non-variadic, bail out before touching reflection. Methods with fully typed signatures (the common case) no longer pay for parent reflection resolution.

Behavior unchanged - the guards still run whenever there is an untyped param to consider.

@TomasVotruba
TomasVotruba merged commit e7cdcc1 into main Oct 10, 2026
49 checks passed
@TomasVotruba
TomasVotruba deleted the tv-perf-strict-array-param branch October 10, 2026 22:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants