From a69a4d07e20e4f298a5c030623a1a3328145a889 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Tue, 19 Mar 2024 11:13:26 +0100 Subject: [PATCH] Make more nullable types explicit --- Command/AbstractFailedMessagesCommand.php | 2 +- Handler/BatchHandlerInterface.php | 2 +- Retry/RetryStrategyInterface.php | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Command/AbstractFailedMessagesCommand.php b/Command/AbstractFailedMessagesCommand.php index 7a6fc212..43ad8337 100644 --- a/Command/AbstractFailedMessagesCommand.php +++ b/Command/AbstractFailedMessagesCommand.php @@ -185,7 +185,7 @@ protected function printPendingMessagesMessage(ReceiverInterface $receiver, Symf /** * @param string|null $name */ - protected function getReceiver(/* string $name = null */): ReceiverInterface + protected function getReceiver(/* ?string $name = null */): ReceiverInterface { if (1 > \func_num_args() && __CLASS__ !== static::class && __CLASS__ !== (new \ReflectionMethod($this, __FUNCTION__))->getDeclaringClass()->getName() && !$this instanceof \PHPUnit\Framework\MockObject\MockObject && !$this instanceof \Prophecy\Prophecy\ProphecySubjectInterface && !$this instanceof \Mockery\MockInterface) { trigger_deprecation('symfony/messenger', '5.3', 'The "%s()" method will have a new "string $name" argument in version 6.0, not defining it is deprecated.', __METHOD__); diff --git a/Handler/BatchHandlerInterface.php b/Handler/BatchHandlerInterface.php index a2fce4e1..42a8590e 100644 --- a/Handler/BatchHandlerInterface.php +++ b/Handler/BatchHandlerInterface.php @@ -23,7 +23,7 @@ interface BatchHandlerInterface * @return mixed The number of pending messages in the batch if $ack is not null, * the result from handling the message otherwise */ - // public function __invoke(object $message, Acknowledger $ack = null): mixed; + // public function __invoke(object $message, ?Acknowledger $ack = null): mixed; /** * Flushes any pending buffers. diff --git a/Retry/RetryStrategyInterface.php b/Retry/RetryStrategyInterface.php index 52c294be..7abce0df 100644 --- a/Retry/RetryStrategyInterface.php +++ b/Retry/RetryStrategyInterface.php @@ -23,12 +23,12 @@ interface RetryStrategyInterface /** * @param \Throwable|null $throwable The cause of the failed handling */ - public function isRetryable(Envelope $message/* , \Throwable $throwable = null */): bool; + public function isRetryable(Envelope $message/* , ?\Throwable $throwable = null */): bool; /** * @param \Throwable|null $throwable The cause of the failed handling * * @return int The time to delay/wait in milliseconds */ - public function getWaitingTime(Envelope $message/* , \Throwable $throwable = null */): int; + public function getWaitingTime(Envelope $message/* , ?\Throwable $throwable = null */): int; }