Skip to content

[Php84] [TypeDeclaration] Extract duplicated rule logic into shared services - #8486

Merged
TomasVotruba merged 1 commit into
mainfrom
tv-php84-typedecl-dedup
Sep 12, 2026
Merged

[Php84] [TypeDeclaration] Extract duplicated rule logic into shared services#8486
TomasVotruba merged 1 commit into
mainfrom
tv-php84-typedecl-dedup

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

Removes copy-pasted logic across 3 pairs of sibling Rector rules by extracting the shared code into dedicated services, with behavior preserved exactly (differences passed as parameters).

  • ForeachToArrayAnyRector / ForeachToArrayAllRector -> ForeachToArrayAnyAllFactory (function name, condition negation, boolean polarity, and the else/elseif guard kept as flags; the two had diverged and the divergence is preserved, not unified).
  • ForeachToArrayFindRector / ForeachToArrayFindKeyRector -> ForeachToArrayFindFactory (compared expression passed in).
  • AddArrayAnyAllClosureParamTypeRector / NarrowArrayAnyAllNullableParamTypeRector -> ArrayCallbackParamTypeResolver.
  • TypedPropertyFromContainerGetSetUpRector / TypedPropertyFromGetRepositorySetUpRector -> SetUpAssignedPropertyTyper (assign-expr matcher passed as a callable).

All existing rule tests pass unchanged; no behavior change intended.

@TomasVotruba
TomasVotruba merged commit 6d82405 into main Sep 12, 2026
44 checks passed
@TomasVotruba
TomasVotruba deleted the tv-php84-typedecl-dedup branch September 12, 2026 09:42
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