Skip to content

Commit 41d9dad

Browse files
Apply php-cs-fixer fix --rules nullable_type_declaration_for_default_null_value
1 parent f5ffb4c commit 41d9dad

File tree

6 files changed

+12
-12
lines changed

6 files changed

+12
-12
lines changed

Tests/Transport/AmqpTransportTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function testReceivesMessages()
5252
$this->assertSame($decodedMessage, $envelopes[0]->getMessage());
5353
}
5454

55-
private function getTransport(SerializerInterface $serializer = null, Connection $connection = null): AmqpTransport
55+
private function getTransport(?SerializerInterface $serializer = null, ?Connection $connection = null): AmqpTransport
5656
{
5757
$serializer = $serializer ?? $this->createMock(SerializerInterface::class);
5858
$connection = $connection ?? $this->createMock(Connection::class);

Transport/AmqpReceiver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class AmqpReceiver implements QueueReceiverInterface, MessageCountAwareInterface
3030
private $serializer;
3131
private $connection;
3232

33-
public function __construct(Connection $connection, SerializerInterface $serializer = null)
33+
public function __construct(Connection $connection, ?SerializerInterface $serializer = null)
3434
{
3535
$this->connection = $connection;
3636
$this->serializer = $serializer ?? new PhpSerializer();

Transport/AmqpSender.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class AmqpSender implements SenderInterface
2929
private $serializer;
3030
private $connection;
3131

32-
public function __construct(Connection $connection, SerializerInterface $serializer = null)
32+
public function __construct(Connection $connection, ?SerializerInterface $serializer = null)
3333
{
3434
$this->connection = $connection;
3535
$this->serializer = $serializer ?? new PhpSerializer();

Transport/AmqpStamp.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ final class AmqpStamp implements NonSendableStampInterface
2424
private $attributes;
2525
private $isRetryAttempt = false;
2626

27-
public function __construct(string $routingKey = null, int $flags = \AMQP_NOPARAM, array $attributes = [])
27+
public function __construct(?string $routingKey = null, int $flags = \AMQP_NOPARAM, array $attributes = [])
2828
{
2929
$this->routingKey = $routingKey;
3030
$this->flags = $flags;
@@ -46,7 +46,7 @@ public function getAttributes(): array
4646
return $this->attributes;
4747
}
4848

49-
public static function createFromAmqpEnvelope(\AMQPEnvelope $amqpEnvelope, self $previousStamp = null, string $retryRoutingKey = null): self
49+
public static function createFromAmqpEnvelope(\AMQPEnvelope $amqpEnvelope, ?self $previousStamp = null, ?string $retryRoutingKey = null): self
5050
{
5151
$attr = $previousStamp->attributes ?? [];
5252

@@ -79,7 +79,7 @@ public function isRetryAttempt(): bool
7979
return $this->isRetryAttempt;
8080
}
8181

82-
public static function createWithAttributes(array $attributes, self $previousStamp = null): self
82+
public static function createWithAttributes(array $attributes, ?self $previousStamp = null): self
8383
{
8484
return new self(
8585
$previousStamp->routingKey ?? null,

Transport/AmqpTransport.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class AmqpTransport implements QueueReceiverInterface, TransportInterface, Setup
2929
private $receiver;
3030
private $sender;
3131

32-
public function __construct(Connection $connection, SerializerInterface $serializer = null)
32+
public function __construct(Connection $connection, ?SerializerInterface $serializer = null)
3333
{
3434
$this->connection = $connection;
3535
$this->serializer = $serializer ?? new PhpSerializer();

Transport/Connection.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ class Connection
112112
*/
113113
private $lastActivityTime = 0;
114114

115-
public function __construct(array $connectionOptions, array $exchangeOptions, array $queuesOptions, AmqpFactory $amqpFactory = null)
115+
public function __construct(array $connectionOptions, array $exchangeOptions, array $queuesOptions, ?AmqpFactory $amqpFactory = null)
116116
{
117117
if (!\extension_loaded('amqp')) {
118118
throw new LogicException(sprintf('You cannot use the "%s" as the "amqp" extension is not installed.', __CLASS__));
@@ -176,7 +176,7 @@ public function __construct(array $connectionOptions, array $exchangeOptions, ar
176176
* * verify: Enable or disable peer verification. If peer verification is enabled then the common name in the
177177
* server certificate must match the server name. Peer verification is enabled by default.
178178
*/
179-
public static function fromDsn(string $dsn, array $options = [], AmqpFactory $amqpFactory = null): self
179+
public static function fromDsn(string $dsn, array $options = [], ?AmqpFactory $amqpFactory = null): self
180180
{
181181
if (false === $params = parse_url($dsn)) {
182182
// this is a valid URI that parse_url cannot handle when you want to pass all parameters as options
@@ -298,7 +298,7 @@ private static function hasCaCertConfigured(array $amqpOptions): bool
298298
/**
299299
* @throws \AMQPException
300300
*/
301-
public function publish(string $body, array $headers = [], int $delayInMs = 0, AmqpStamp $amqpStamp = null): void
301+
public function publish(string $body, array $headers = [], int $delayInMs = 0, ?AmqpStamp $amqpStamp = null): void
302302
{
303303
$this->clearWhenDisconnected();
304304

@@ -334,7 +334,7 @@ public function countMessagesInQueues(): int
334334
/**
335335
* @throws \AMQPException
336336
*/
337-
private function publishWithDelay(string $body, array $headers, int $delay, AmqpStamp $amqpStamp = null)
337+
private function publishWithDelay(string $body, array $headers, int $delay, ?AmqpStamp $amqpStamp = null)
338338
{
339339
$routingKey = $this->getRoutingKeyForMessage($amqpStamp);
340340
$isRetryAttempt = $amqpStamp ? $amqpStamp->isRetryAttempt() : false;
@@ -350,7 +350,7 @@ private function publishWithDelay(string $body, array $headers, int $delay, Amqp
350350
);
351351
}
352352

353-
private function publishOnExchange(\AMQPExchange $exchange, string $body, string $routingKey = null, array $headers = [], AmqpStamp $amqpStamp = null)
353+
private function publishOnExchange(\AMQPExchange $exchange, string $body, ?string $routingKey = null, array $headers = [], ?AmqpStamp $amqpStamp = null)
354354
{
355355
$attributes = $amqpStamp ? $amqpStamp->getAttributes() : [];
356356
$attributes['headers'] = array_merge($attributes['headers'] ?? [], $headers);

0 commit comments

Comments
 (0)