From 3d03d561f2dca25bcc48a02fa54097c514f1ea88 Mon Sep 17 00:00:00 2001 From: Christophe Coevoet Date: Thu, 4 Jul 2024 15:54:12 +0200 Subject: [PATCH] Fix PHP deprecation for implicit nullable types --- Broker/PeclFactory.php | 2 +- Broker/Publisher.php | 2 +- Command/SwarrotCommand.php | 2 +- DataCollector/SwarrotDataCollector.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Broker/PeclFactory.php b/Broker/PeclFactory.php index 34b75a2..48e055c 100644 --- a/Broker/PeclFactory.php +++ b/Broker/PeclFactory.php @@ -33,7 +33,7 @@ class PeclFactory implements FactoryInterface /** @var array */ protected $amqpConnections = []; - public function __construct(LoggerInterface $logger = null, bool $publisherConfirms = false, float $timeout = 0.0) + public function __construct(?LoggerInterface $logger = null, bool $publisherConfirms = false, float $timeout = 0.0) { $this->logger = $logger ?: new NullLogger(); $this->publisherConfirms = $publisherConfirms; diff --git a/Broker/Publisher.php b/Broker/Publisher.php index 636714f..b0fcaac 100644 --- a/Broker/Publisher.php +++ b/Broker/Publisher.php @@ -19,7 +19,7 @@ class Publisher /** @var LoggerInterface */ protected $logger; - public function __construct(FactoryInterface $factory, EventDispatcherInterface $eventDispatcher, array $messageTypes = [], LoggerInterface $logger = null) + public function __construct(FactoryInterface $factory, EventDispatcherInterface $eventDispatcher, array $messageTypes = [], ?LoggerInterface $logger = null) { $this->factory = $factory; $this->eventDispatcher = $eventDispatcher; diff --git a/Command/SwarrotCommand.php b/Command/SwarrotCommand.php index e82ff82..679c1a8 100644 --- a/Command/SwarrotCommand.php +++ b/Command/SwarrotCommand.php @@ -40,7 +40,7 @@ public function __construct( ProcessorInterface $processor, array $processorConfigurators, array $extras, - string $queue = null, + ?string $queue = null, array $aliases = [] ) { $this->swarrotFactory = $swarrotFactory; diff --git a/DataCollector/SwarrotDataCollector.php b/DataCollector/SwarrotDataCollector.php index e3ef48f..34e3315 100644 --- a/DataCollector/SwarrotDataCollector.php +++ b/DataCollector/SwarrotDataCollector.php @@ -13,7 +13,7 @@ class SwarrotDataCollector extends DataCollector /** * @param \Throwable|\Exception $exception */ - public function collect(Request $request, Response $response, \Throwable $exception = null): void + public function collect(Request $request, Response $response, ?\Throwable $exception = null): void { }