Skip to content

Skip FormEvents in EventSubscriberToAttributeRector - #1099

Merged
TomasVotruba merged 2 commits into
mainfrom
skip-form-events-subscriber
Oct 28, 2026
Merged

TomasVotruba merged 2 commits into
mainfrom
skip-form-events-subscriber

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

Form event subscribers (FormEvents::*) are usually registered manually on a form builder, not as a global listener. Converting them to #[AsEventListener] would change behavior, so skip any getSubscribedEvents whose event key references Symfony\Component\Form\FormEvents.

public static function getSubscribedEvents(): array
{
    return [
        FormEvents::PRE_SUBMIT => 'preSubmitData',
    ];
}

Note: whole class is skipped when any Form event key is present, to avoid half-converting a subscriber.

@TomasVotruba
TomasVotruba force-pushed the skip-form-events-subscriber branch from bdf3dab to 969b09f Compare October 28, 2026 16:22
@TomasVotruba
TomasVotruba merged commit b2bdcce into main Oct 28, 2026
8 checks passed
@TomasVotruba
TomasVotruba deleted the skip-form-events-subscriber branch October 28, 2026 16:25
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