diff --git a/src/Command/Consume.php b/src/Command/Consume.php index cc3c4ab..642739a 100644 --- a/src/Command/Consume.php +++ b/src/Command/Consume.php @@ -109,8 +109,8 @@ class Consume extends Command private function getExchange(ConsumerParameters $params): Exchange { return new Exchange( - name: $params->exchange->toString() ?? 'amq.direct', - type: $params->exchangeType->toString() ?? 'direct', + name: $params->exchange->toString() ?: 'amq.direct', + type: $params->exchangeType->toString() ?: 'direct', isDefault: $params->exchangeIsDefault->toBool(), declaration: new ExchangeDeclaration() ); diff --git a/src/Listener/PublishEvent.php b/src/Listener/PublishEvent.php index 3fa1efa..6a09b7d 100644 --- a/src/Listener/PublishEvent.php +++ b/src/Listener/PublishEvent.php @@ -33,21 +33,21 @@ class PublishEvent implements ShouldQueue $config = $this->configuration->getConnection($event->getConnection()); $exchange = new Exchange( + declaration: new ExchangeDeclaration(), name: $event->getExchange(), type: $event->getExchangeType(), isDefault: $event->getExchangeIsDefault(), - declaration: new ExchangeDeclaration() ); $queue = null; if ($event->getQueue()) { $queue = new Queue( - name: $event->getQueue(), declaration: new QueueDeclaration(), bindings: new QueueBindings( routingKey: $event->getRoutingKey() ), + name: $event->getQueue(), ); } diff --git a/src/Object/Exchange.php b/src/Object/Exchange.php index 2936389..a01bd0c 100644 --- a/src/Object/Exchange.php +++ b/src/Object/Exchange.php @@ -7,10 +7,10 @@ namespace Diffhead\PHP\LaravelRabbitMQ\Object; class Exchange { public function __construct( + private ExchangeDeclaration $declaration, private string $name = 'amq.direct', private string $type = 'direct', private bool $isDefault = true, - private ExchangeDeclaration $declaration, ) {} public function name(): string diff --git a/src/Object/Queue.php b/src/Object/Queue.php index 3fbea9a..79e04bb 100644 --- a/src/Object/Queue.php +++ b/src/Object/Queue.php @@ -7,9 +7,9 @@ namespace Diffhead\PHP\LaravelRabbitMQ\Object; class Queue { public function __construct( - private string $name = 'default', private QueueDeclaration $declaration, private QueueBindings $bindings, + private string $name = 'default', ) {} public function name(): string