From 751d478abf5709d58df24812aaab48e436cd7f33 Mon Sep 17 00:00:00 2001 From: Vladyslav Sikailo Date: Wed, 26 Apr 2023 12:10:54 +0300 Subject: [PATCH] Make plugin method arguments optional as in the original method to avoid fatal error regarding arguments count --- src/Plugin/HandleQueueMessageRejectPlugin.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Plugin/HandleQueueMessageRejectPlugin.php b/src/Plugin/HandleQueueMessageRejectPlugin.php index 99da2ac..29c47fb 100644 --- a/src/Plugin/HandleQueueMessageRejectPlugin.php +++ b/src/Plugin/HandleQueueMessageRejectPlugin.php @@ -27,22 +27,22 @@ public function aroundReject( QueueInterface $subject, callable $proceed, EnvelopeInterface $envelope, - bool $requeue, - string $error + bool $requeue = true, + string $rejectionMessage = null ): void { - if (!$error) { - $proceed($envelope, $requeue, $error); + if (!$rejectionMessage) { + $proceed($envelope, $requeue, $rejectionMessage); return; } $shouldBeSavedForRetry = $this->isMessageShouldBeSavedForRetryService->execute($envelope); if (!$shouldBeSavedForRetry) { - $proceed($envelope, $requeue, $error); + $proceed($envelope, $requeue, $rejectionMessage); return; } - $this->saveFailedMessageService->execute($envelope, $error); + $this->saveFailedMessageService->execute($envelope, $rejectionMessage); $subject->acknowledge($envelope); } }