abstract class AbstractHandler implements MessageHandlerInterface {
}
class ExampleHandler extends AbstractHandler {
// ...
}
Thanks to symfony-frameworks registerForAutoconfiguration the ExampleHandler is tagged as messenger.message_handler, as the class (indirect) implements the interface.
Result after rector:
#[AsMessageHandler]
abstract class AbstractHandler {
// ...
}
class ExampleHandler extends AbstractHandler {
// ...
}
No service gets tagged:
abstract classes aren't considered a service, and therefore no tagging is happening
the ExampleHandler has no attribute to it and doesn't get the tag added.
Possible solution:
I would recommend to add final to all modified classes. This prevents extending a message handler service and expecting to automaticly get tagged. Any wrong usages are instantly visible.
Just skipping abstract classes wouldn't be sufficient, as some may also extend a non abstract service.
Example:
Thanks to symfony-frameworks
registerForAutoconfiguration
the ExampleHandler is tagged asmessenger.message_handler
, as the class (indirect) implements the interface.Result after rector:
No service gets tagged:
Possible solution:
I would recommend to add
final
to all modified classes. This prevents extending a message handler service and expecting to automaticly get tagged. Any wrong usages are instantly visible. Just skipping abstract classes wouldn't be sufficient, as some may also extend a non abstract service.