From 21235310e3c726b730cea012b6f52bb05b3b7f93 Mon Sep 17 00:00:00 2001 From: Samuel ROZE Date: Sat, 23 Mar 2019 22:30:49 +0700 Subject: [PATCH] Add a BC layer for the `ConsumeMessagesCommand` arguments --- src/Symfony/Component/Messenger/CHANGELOG.md | 2 +- .../Messenger/Command/ConsumeMessagesCommand.php | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/Messenger/CHANGELOG.md b/src/Symfony/Component/Messenger/CHANGELOG.md index 519966d3e9..54c32c1618 100644 --- a/src/Symfony/Component/Messenger/CHANGELOG.md +++ b/src/Symfony/Component/Messenger/CHANGELOG.md @@ -8,7 +8,7 @@ CHANGELOG and `BusNameStamp` were added, which allow you to add a bus identifier to the `Envelope` then find the correct bus when receiving from the transport. See `ConsumeMessagesCommand`. - * An optional `ConsumeMessagesCommand` constructor argument was removed. + * The optional `$busNames` constructor argument of the class `ConsumeMessagesCommand` was removed. * [BC BREAK] 2 new methods were added to `ReceiverInterface`: `ack()` and `reject()`. * [BC BREAK] Error handling was moved from the receivers into diff --git a/src/Symfony/Component/Messenger/Command/ConsumeMessagesCommand.php b/src/Symfony/Component/Messenger/Command/ConsumeMessagesCommand.php index ca1973afd4..af916cb785 100644 --- a/src/Symfony/Component/Messenger/Command/ConsumeMessagesCommand.php +++ b/src/Symfony/Component/Messenger/Command/ConsumeMessagesCommand.php @@ -43,8 +43,14 @@ class ConsumeMessagesCommand extends Command private $retryStrategyLocator; private $eventDispatcher; - public function __construct(ContainerInterface $busLocator, ContainerInterface $receiverLocator, LoggerInterface $logger = null, array $receiverNames = [], ContainerInterface $retryStrategyLocator = null, EventDispatcherInterface $eventDispatcher = null) + public function __construct(ContainerInterface $busLocator, ContainerInterface $receiverLocator, LoggerInterface $logger = null, array $receiverNames = [], /* ContainerInterface */ $retryStrategyLocator = null, EventDispatcherInterface $eventDispatcher = null) { + if (\is_array($retryStrategyLocator)) { + @trigger_error(sprintf('The 5th argument of the class "%s" should be a retry-strategy locator, an array of bus names as a value is deprecated since Symfony 4.3.', __CLASS__), E_USER_DEPRECATED); + + $retryStrategyLocator = null; + } + $this->busLocator = $busLocator; $this->receiverLocator = $receiverLocator; $this->logger = $logger;