Skip to content

[TypeDeclaration] Skip type-guarded trait methods in StrictArrayParamDimFetchRector#8139

Merged
TomasVotruba merged 1 commit into
mainfrom
type-guard-trait-methods
Jul 3, 2026
Merged

[TypeDeclaration] Skip type-guarded trait methods in StrictArrayParamDimFetchRector#8139
TomasVotruba merged 1 commit into
mainfrom
type-guard-trait-methods

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

StrictArrayParamDimFetchRector added an array param type to trait methods even when the trait was listed in withTypeGuardedClasses().

Root cause: the rule only checked hasParentClassMethod(), never isTypeGuardedClass(), so the guard did not apply.

  • Add isTypeGuardedClass() bail-out to StrictArrayParamDimFetchRector
  • The guard already resolves trait reflections correctly (ClassReflection::is() matches the trait by name, traits are never final), so no change to ParentClassMethodTypeOverrideGuard was needed
  • Cover with a guarded-trait skip fixture in the TypeGuardedClasses suite

@TomasVotruba TomasVotruba merged commit 5f16b59 into main Jul 3, 2026
65 checks passed
@TomasVotruba TomasVotruba deleted the type-guard-trait-methods branch July 3, 2026 11:47
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.

1 participant