|
116 | 116 | use Symfony\Component\Messenger\MessageBus;
|
117 | 117 | use Symfony\Component\Messenger\MessageBusInterface;
|
118 | 118 | use Symfony\Component\Messenger\Middleware\RouterContextMiddleware;
|
119 |
| -use Symfony\Component\Messenger\Stamp\SerializedMessageStamp; |
120 | 119 | use Symfony\Component\Messenger\Transport\Serialization\SerializerInterface;
|
121 | 120 | use Symfony\Component\Messenger\Transport\TransportFactoryInterface;
|
122 | 121 | use Symfony\Component\Messenger\Transport\TransportInterface;
|
@@ -666,29 +665,18 @@ public function load(array $configs, ContainerBuilder $container)
|
666 | 665 | $definition->addTag('controller.service_arguments');
|
667 | 666 | });
|
668 | 667 |
|
669 |
| - if (class_exists(SerializedMessageStamp::class)) { |
670 |
| - // symfony/messenger >= 6.1 |
671 |
| - $container->registerAttributeForAutoconfiguration(AsMessageHandler::class, static function (ChildDefinition $definition, AsMessageHandler $attribute, \ReflectionClass|\ReflectionMethod $reflector): void { |
672 |
| - $tagAttributes = get_object_vars($attribute); |
673 |
| - $tagAttributes['from_transport'] = $tagAttributes['fromTransport']; |
674 |
| - unset($tagAttributes['fromTransport']); |
675 |
| - if ($reflector instanceof \ReflectionMethod) { |
676 |
| - if (isset($tagAttributes['method'])) { |
677 |
| - throw new LogicException(sprintf('AsMessageHandler attribute cannot declare a method on "%s::%s()".', $reflector->class, $reflector->name)); |
678 |
| - } |
679 |
| - $tagAttributes['method'] = $reflector->getName(); |
| 668 | + $container->registerAttributeForAutoconfiguration(AsMessageHandler::class, static function (ChildDefinition $definition, AsMessageHandler $attribute, \ReflectionClass|\ReflectionMethod $reflector): void { |
| 669 | + $tagAttributes = get_object_vars($attribute); |
| 670 | + $tagAttributes['from_transport'] = $tagAttributes['fromTransport']; |
| 671 | + unset($tagAttributes['fromTransport']); |
| 672 | + if ($reflector instanceof \ReflectionMethod) { |
| 673 | + if (isset($tagAttributes['method'])) { |
| 674 | + throw new LogicException(sprintf('AsMessageHandler attribute cannot declare a method on "%s::%s()".', $reflector->class, $reflector->name)); |
680 | 675 | }
|
681 |
| - $definition->addTag('messenger.message_handler', $tagAttributes); |
682 |
| - }); |
683 |
| - } else { |
684 |
| - // symfony/messenger < 6.1 |
685 |
| - $container->registerAttributeForAutoconfiguration(AsMessageHandler::class, static function (ChildDefinition $definition, AsMessageHandler $attribute): void { |
686 |
| - $tagAttributes = get_object_vars($attribute); |
687 |
| - $tagAttributes['from_transport'] = $tagAttributes['fromTransport']; |
688 |
| - unset($tagAttributes['fromTransport']); |
689 |
| - $definition->addTag('messenger.message_handler', $tagAttributes); |
690 |
| - }); |
691 |
| - } |
| 676 | + $tagAttributes['method'] = $reflector->getName(); |
| 677 | + } |
| 678 | + $definition->addTag('messenger.message_handler', $tagAttributes); |
| 679 | + }); |
692 | 680 |
|
693 | 681 | if (!$container->getParameter('kernel.debug')) {
|
694 | 682 | // remove tagged iterator argument for resource checkers
|
|
0 commit comments