Skip to content

Fix PHP 8.4 deprecated nullable parameter warnings #623

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Horizon/RabbitMQQueue.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
14 changes: 7 additions & 7 deletions src/Queue/RabbitMQQueue.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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();
}
Expand All @@ -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());

Expand All @@ -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();
}
Expand Down Expand Up @@ -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)) {
Expand Down
2 changes: 1 addition & 1 deletion tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Loading