Skip to content

Make LogoutHandlerToLogoutEventSubscriberRector idempotent - #1080

Merged
TomasVotruba merged 1 commit into
mainfrom
tv-symfony-idempotent
Oct 18, 2026
Merged

TomasVotruba merged 1 commit into
mainfrom
tv-symfony-idempotent

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

Running the rule more than once over the same class kept re-adding EventSubscriberInterface and another getSubscribedEvents() method. After the implements swap the class type can still resolve to LogoutHandlerInterface from stale reflection, so the isObjectType() guard stays true on later passes.

The rule now detects an already-converted class structurally - it bails out when the implements list already contains EventSubscriberInterface.

Harmless today, but the upcoming rector-src node-traverser simplification drops the created-by-rule reprocessing guard, so each rule must settle on its own.

Rule test, ECS and PHPStan pass.

Skip a class already converted to EventSubscriberInterface. The class
type can still resolve to the handler interface from stale reflection
after the implements swap, so detect the converted state structurally
instead of re-adding the interface and getSubscribedEvents() each pass.
@TomasVotruba
TomasVotruba merged commit aa3effa into main Oct 18, 2026
8 checks passed
@TomasVotruba
TomasVotruba deleted the tv-symfony-idempotent branch October 18, 2026 14:01
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