Skip to content

Commit 44cb953

Browse files
committed
conflict with symfony/messenger < 6.2
1 parent 54a53be commit 44cb953

File tree

2 files changed

+13
-25
lines changed

2 files changed

+13
-25
lines changed

DependencyInjection/FrameworkExtension.php

Lines changed: 11 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,6 @@
116116
use Symfony\Component\Messenger\MessageBus;
117117
use Symfony\Component\Messenger\MessageBusInterface;
118118
use Symfony\Component\Messenger\Middleware\RouterContextMiddleware;
119-
use Symfony\Component\Messenger\Stamp\SerializedMessageStamp;
120119
use Symfony\Component\Messenger\Transport\Serialization\SerializerInterface;
121120
use Symfony\Component\Messenger\Transport\TransportFactoryInterface;
122121
use Symfony\Component\Messenger\Transport\TransportInterface;
@@ -666,29 +665,18 @@ public function load(array $configs, ContainerBuilder $container)
666665
$definition->addTag('controller.service_arguments');
667666
});
668667

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));
680675
}
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+
});
692680

693681
if (!$container->getParameter('kernel.debug')) {
694682
// remove tagged iterator argument for resource checkers

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
"symfony/http-client": "^5.4|^6.0",
4949
"symfony/lock": "^5.4|^6.0",
5050
"symfony/mailer": "^5.4|^6.0",
51-
"symfony/messenger": "^5.4|^6.0",
51+
"symfony/messenger": "^6.2",
5252
"symfony/mime": "^5.4|^6.0",
5353
"symfony/notifier": "^5.4|^6.0",
5454
"symfony/process": "^5.4|^6.0",
@@ -83,7 +83,7 @@
8383
"symfony/form": "<5.4",
8484
"symfony/lock": "<5.4",
8585
"symfony/mailer": "<5.4",
86-
"symfony/messenger": "<5.4",
86+
"symfony/messenger": "<6.2",
8787
"symfony/mime": "<5.4",
8888
"symfony/property-info": "<5.4",
8989
"symfony/property-access": "<5.4",

0 commit comments

Comments
 (0)