From 65f06d258c01eb70135d4a64a46bbfe0425a44c9 Mon Sep 17 00:00:00 2001 From: Alexander Trauzzi Date: Mon, 28 Sep 2020 15:32:49 -0500 Subject: [PATCH 1/2] Allow fals-y values for unsupported options This is to acomodate any situations where `0` is passed via configuration or even defaults from other layers (in my case, laravel). --- pkg/stomp/StompProducer.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/stomp/StompProducer.php b/pkg/stomp/StompProducer.php index c275bd6a3..4ada1f8fe 100644 --- a/pkg/stomp/StompProducer.php +++ b/pkg/stomp/StompProducer.php @@ -47,7 +47,7 @@ public function send(Destination $destination, Message $message): void public function setDeliveryDelay(int $deliveryDelay = null): Producer { - if (null === $deliveryDelay) { + if (empty($deliveryDelay)) { return $this; } @@ -61,7 +61,7 @@ public function getDeliveryDelay(): ?int public function setPriority(int $priority = null): Producer { - if (null === $priority) { + if (empty($priority)) { return $this; } @@ -75,7 +75,7 @@ public function getPriority(): ?int public function setTimeToLive(int $timeToLive = null): Producer { - if (null === $timeToLive) { + if (empty($timeToLive)) { return $this; } From b6514d003dfd08f64a09b9b049fee626d5393759 Mon Sep 17 00:00:00 2001 From: Alexander Trauzzi Date: Tue, 29 Sep 2020 08:34:08 -0500 Subject: [PATCH 2/2] Resolve code style issues. --- pkg/stomp/StompProducer.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/pkg/stomp/StompProducer.php b/pkg/stomp/StompProducer.php index 4ada1f8fe..8c1933ee4 100644 --- a/pkg/stomp/StompProducer.php +++ b/pkg/stomp/StompProducer.php @@ -20,9 +20,6 @@ class StompProducer implements Producer */ private $stomp; - /** - * @param Client $stomp - */ public function __construct(Client $stomp) { $this->stomp = $stomp; @@ -45,6 +42,9 @@ public function send(Destination $destination, Message $message): void $this->stomp->send($destination->getQueueName(), $stompMessage); } + /** + * @return $this|Producer + */ public function setDeliveryDelay(int $deliveryDelay = null): Producer { if (empty($deliveryDelay)) { @@ -59,6 +59,11 @@ public function getDeliveryDelay(): ?int return null; } + /** + * @throws PriorityNotSupportedException + * + * @return $this|Producer + */ public function setPriority(int $priority = null): Producer { if (empty($priority)) { @@ -73,6 +78,9 @@ public function getPriority(): ?int return null; } + /** + * @return $this|Producer + */ public function setTimeToLive(int $timeToLive = null): Producer { if (empty($timeToLive)) {