8000 execute tests with the full range of supported Messenger component re… · symfony/symfony@1bc150f · GitHub
[go: up one dir, main page]

Skip to content

Commit 1bc150f

Browse files
committed
execute tests with the full range of supported Messenger component releases
The conflict rule does not exclude the 5.4 and 6.0 releases of the Messenger component. So we should make sure that we also run tests against these versions.
1 parent 0b8581e commit 1bc150f

File tree

2 files changed

+23
-12
lines changed

2 files changed

+23
-12
lines changed

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@
113113
use Symfony\Component\Messenger\MessageBus;
114114
use Symfony\Component\Messenger\MessageBusInterface;
115115
use Symfony\Component\Messenger\Middleware\RouterContextMiddleware;
116+
use Symfony\Component\Messenger\Stamp\SerializedMessageStamp;
116117
use Symfony\Component\Messenger\Transport\Serialization\SerializerInterface;
117118
use Symfony\Component\Messenger\Transport\TransportFactoryInterface;
118119
use Symfony\Component\Messenger\Transport\TransportInterface;
@@ -651,18 +652,28 @@ public function load(array $configs, ContainerBuilder $container)
651652
$container->registerAttributeForAutoconfiguration(AsController::class, static function (ChildDefinition $definition, AsController $attribute): void {
652653
$definition->addTag('controller.service_arguments');
653654
});
654-
$container->registerAttributeForAutoconfiguration(AsMessageHandler::class, static function (ChildDefinition $definition, AsMessageHandler $attribute, \ReflectionClass|\ReflectionMethod $reflector): void {
655-
$tagAttributes = get_object_vars($attribute);
656-
$tagAttributes['from_transport'] = $tagAttributes['fromTransport'];
657-
unset($tagAttributes['fromTransport']);
658-
if ($reflector instanceof \ReflectionMethod) {
659-
if (isset($tagAttributes['method'])) {
660-
throw new LogicException(sprintf('AsMessageHandler attribute cannot declare a method on "%s::%s()".', $reflector->class, $reflector->name));
655+
656+
if (class_exists(SerializedMessageStamp::class)) {
657+
$container->registerAttributeForAutoconfiguration(AsMessageHandler::class, static function (ChildDefinition $definition, AsMessageHandler $attribute, \ReflectionClass|\ReflectionMethod $reflector): void {
658+
$tagAttributes = get_object_vars($attribute);
659+
$tagAttributes['from_transport'] = $tagAttributes['fromTransport'];
660+
unset($tagAttributes['fromTransport']);
661+
if ($reflector instanceof \ReflectionMethod) {
662+
if (isset($tagAttributes['method'])) {
663+
throw new LogicException(sprintf('AsMessageHandler attribute cannot declare a method on "%s::%s()".', $reflector->class, $reflector->name));
664+
}
665+
$tagAttributes['method'] = $reflector->getName();
661666
}
662-
$tagAttributes['method'] = $reflector->getName();
663-
}
664-
$definition->addTag('messenger.message_handler', $tagAttributes);
665-
});
667+
$definition->addTag('messenger.message_handler', $tagAttributes);
668+
});
669+
} else {
670+
$container->registerAttributeForAutoconfiguration(AsMessageHandler::class, static function (ChildDefinition $definition, AsMessageHandler $attribute): void {
671+
$tagAttributes = get_object_vars($attribute);
672+
$tagAttributes['from_transport'] = $tagAttributes['fromTransport'];
673+
unset($tagAttributes['fromTransport']);
674+
$definition->addTag('messenger.message_handler', $tagAttributes);
675+
});
676+
}
666677

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

src/Symfony/Bundle/FrameworkBundle/composer.json

Lines changed: 1 addition & 1 deletion
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": "^6.1",
51+
"symfony/messenger": "^5.4|^6.0",
5252
"symfony/mime": "^5.4|^6.0",
5353
"symfony/notifier": "^5.4|^6.0",
5454
"symfony/process": "^5.4|^6.0",

0 commit comments

Comments
 (0)
0