diff --git a/src/Horizon/RabbitMQQueue.php b/src/Horizon/RabbitMQQueue.php index 894cc24b..e2ca400d 100644 --- a/src/Horizon/RabbitMQQueue.php +++ b/src/Horizon/RabbitMQQueue.php @@ -26,7 +26,7 @@ class RabbitMQQueue extends BaseRabbitMQQueue * * @throws AMQPProtocolChannelException */ - public function readyNow(string $queue = null): int + public function readyNow(?string $queue = null): int { return $this->size($queue); } diff --git a/src/Queue/RabbitMQQueue.php b/src/Queue/RabbitMQQueue.php index 957620ef..fadedce5 100644 --- a/src/Queue/RabbitMQQueue.php +++ b/src/Queue/RabbitMQQueue.php @@ -204,7 +204,7 @@ protected function publishBatch($jobs, $data = '', $queue = null): void /** * @throws AMQPProtocolChannelException */ - public function bulkRaw(string $payload, string $queue = null, array $options = []): int|string|null + public function bulkRaw(string $payload, ?string $queue = null, array $options = []): int|string|null { [$destination, $exchange, $exchangeType, $attempts] = $this->publishProperties($queue, $options); @@ -397,7 +397,7 @@ public function deleteExchange(string $name, bool $unused = false): void * * @throws AMQPProtocolChannelException */ - public function isQueueExists(string $name = null): bool + public function isQueueExists(?string $name = null): bool { $queueName = $this->getQueue($name); @@ -484,7 +484,7 @@ public function bindQueue(string $queue, string $exchange, string $routingKey = /** * Purge the queue of messages. */ - public function purge(string $queue = null): void + public function purge(?string $queue = null): void { // create a temporary channel, so the main channel will not be closed on exception $channel = $this->createChannel(); @@ -637,7 +637,7 @@ protected function getDelayQueueArguments(string $destination, int $ttl): array /** * Get the exchange name, or empty string; as default value. */ - protected function getExchange(string $exchange = null): string + protected function getExchange(?string $exchange = null): string { return $exchange ?? $this->getConfig()->getExchange(); } @@ -654,7 +654,7 @@ protected function getRoutingKey(string $destination): string /** * Get the exchangeType, or AMQPExchangeType::DIRECT as default. */ - protected function getExchangeType(string $type = null): string + protected function getExchangeType(?string $type = null): string { $constant = AMQPExchangeType::class.'::'.Str::upper($type ?: $this->getConfig()->getExchangeType()); @@ -664,7 +664,7 @@ protected function getExchangeType(string $type = null): string /** * Get the exchange for failed messages. */ - protected function getFailedExchange(string $exchange = null): string + protected function getFailedExchange(?string $exchange = null): string { return $exchange ?? $this->getConfig()->getFailedExchange(); } @@ -699,7 +699,7 @@ protected function isQueueDeclared(string $name): bool * * @throws AMQPProtocolChannelException */ - protected function declareDestination(string $destination, string $exchange = null, string $exchangeType = AMQPExchangeType::DIRECT): void + protected function declareDestination(string $destination, ?string $exchange = null, string $exchangeType = AMQPExchangeType::DIRECT): void { // When an exchange is provided and no exchange is present in RabbitMQ, create an exchange. if ($exchange && ! $this->isExchangeExists($exchange)) { diff --git a/tests/TestCase.php b/tests/TestCase.php index 7d50fa67..f1ffb8d4 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -50,7 +50,7 @@ protected function getEnvironmentSetUp($app): void ]); } - protected function connection(string $name = null): RabbitMQQueue + protected function connection(?string $name = null): RabbitMQQueue { return Queue::connection($name); }