Skip to content

[dx] Add OrderedRectorInterface to order dependent rules in a single pass - #8846

Merged
TomasVotruba merged 1 commit into
mainfrom
tv-ordered-rector-interface
Oct 26, 2026
Merged

TomasVotruba merged 1 commit into
mainfrom
tv-ordered-rector-interface

Conversation

@TomasVotruba

@TomasVotruba TomasVotruba commented Oct 26, 2026 •

Copy link
Copy Markdown
Member

Why

Rules whose output feeds another rule can require more than one pass over a file to converge, because the dependent rule only sees the change on the next pass.

What

  • New OrderedRectorInterface with precededRule(): class-string<RectorInterface> - the rule that must run before this one.
  • RectorRegistry::prepareRectors() topologically sorts active rules so each rule runs after its declared predecessor, within a single pass. Stable order, throws on a cycle. No-op when no rule implements the interface.
  • Unit coverage in RectorRegistryTest.

A rule implementing OrderedRectorInterface declares precededRule(), the rule
that must run before it. RectorRegistry topologically sorts active rules so each
dependent rule runs after its predecessor within one file pass, instead of
relying on repeated FileProcessor passes to converge.
@TomasVotruba
TomasVotruba force-pushed the tv-ordered-rector-interface branch from e3441cd to 0d3fa42 Compare October 26, 2026 10:40
@TomasVotruba
TomasVotruba changed the base branch from tv-file-proces-expr-5 to main October 26, 2026 10:40
@TomasVotruba TomasVotruba changed the title Add OrderedRectorInterface to order dependent rules in a single pass [dx] Add OrderedRectorInterface to order dependent rules in a single pass Oct 26, 2026
@TomasVotruba TomasVotruba reopened this Oct 26, 2026
@TomasVotruba
TomasVotruba merged commit 27281c6 into main Oct 26, 2026
78 of 82 checks passed
@TomasVotruba
TomasVotruba deleted the tv-ordered-rector-interface branch October 26, 2026 10:45
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