Skip to content

Inline class-name import skip voters into ClassNameImportSkipper - #8696

Merged
TomasVotruba merged 1 commit into
mainfrom
tv-inline-voters
Oct 17, 2026
Merged

TomasVotruba merged 1 commit into
mainfrom
tv-inline-voters

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

What

The name-import skip decision was spread across 7 voter services behind ClassNameImportSkipVoterInterface, collected into an array and run via array_any. After #8687, #8691 and #8695 routed every file-global read through ClassNameImportContext, the voters are thin and share the same two dependencies.

This inlines all 7 into ClassNameImportSkipper as private methods and deletes the indirection.

Change

Removed:

  • the 7 *SkipVoter classes
  • ClassNameImportSkipVoterInterface
  • the autodiscover registration in LazyContainerFactory

ClassNameImportSkipper now injects ClassNameImportContext + NamespaceBeforeClassNameResolver directly and ORs the seven conditions, cheap node-local checks first (reserved name, short class, original name) so the file-global lookups are short-circuited when possible. Each voter's condition is preserved verbatim - no behavior change.

Net: skipper + context instead of skipper + 7 tagged services (-345/+190 lines).

Tests

211 import tests green (rules-tests/CodingStyle/ClassNameImport, ImportFullyQualifiedNamesRector, tests/Issues/AutoImport*, NamespacedUseAutoImport, docblock import, RenameClassRector) - container boots and wires correctly. ECS + full PHPStan clean.

@TomasVotruba
TomasVotruba marked this pull request as ready for review October 17, 2026 19:55
@TomasVotruba
TomasVotruba merged commit c63f963 into main Oct 17, 2026
49 checks passed
@TomasVotruba
TomasVotruba deleted the tv-inline-voters branch October 17, 2026 19:56
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