Skip to content

Commit

Permalink
Merge branch '6.4' into 7.0
Browse files Browse the repository at this point in the history
* 6.4:
  Fix implicitly-required parameters
  minor #53524 [Messenger] [AmazonSqs] Allow `async-aws/sqs` version 2 (smoench)
  Fix bad merge
  List CS fix in .git-blame-ignore-revs
  Fix implicitly-required parameters
  List CS fix in .git-blame-ignore-revs
  Apply php-cs-fixer fix --rules nullable_type_declaration_for_default_null_value
  [Messenger][AmazonSqs] Allow async-aws/sqs version 2
  • Loading branch information
nicolas-grekas committed Jan 23, 2024
2 parents dc789f1 + 838efb3 commit 85019d3
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Tests/Transport/AmqpTransportTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function testReceivesMessages()
$this->assertSame($decodedMessage, $envelopes[0]->getMessage());
}

private function getTransport(SerializerInterface $serializer = null, Connection $connection = null): AmqpTransport
private function getTransport(?SerializerInterface $serializer = null, ?Connection $connection = null): AmqpTransport
{
$serializer ??= $this->createMock(SerializerInterface::class);
$connection ??= $this->createMock(Connection::class);
Expand Down
2 changes: 1 addition & 1 deletion Transport/AmqpReceiver.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class AmqpReceiver implements QueueReceiverInterface, MessageCountAwareInterface
private SerializerInterface $serializer;
private Connection $connection;

public function __construct(Connection $connection, SerializerInterface $serializer = null)
public function __construct(Connection $connection, ?SerializerInterface $serializer = null)
{
$this->connection = $connection;
$this->serializer = $serializer ?? new PhpSerializer();
Expand Down
2 changes: 1 addition & 1 deletion Transport/AmqpSender.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class AmqpSender implements SenderInterface
private SerializerInterface $serializer;
private Connection $connection;

public function __construct(Connection $connection, SerializerInterface $serializer = null)
public function __construct(Connection $connection, ?SerializerInterface $serializer = null)
{
$this->connection = $connection;
$this->serializer = $serializer ?? new PhpSerializer();
Expand Down
6 changes: 3 additions & 3 deletions Transport/AmqpStamp.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ final class AmqpStamp implements NonSendableStampInterface
private array $attributes;
private bool $isRetryAttempt = false;

public function __construct(string $routingKey = null, int $flags = \AMQP_NOPARAM, array $attributes = [])
public function __construct(?string $routingKey = null, int $flags = \AMQP_NOPARAM, array $attributes = [])
{
$this->routingKey = $routingKey;
$this->flags = $flags;
Expand All @@ -46,7 +46,7 @@ public function getAttributes(): array
return $this->attributes;
}

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

Expand Down Expand Up @@ -79,7 +79,7 @@ public function isRetryAttempt(): bool
return $this->isRetryAttempt;
}

public static function createWithAttributes(array $attributes, self $previousStamp = null): self
public static function createWithAttributes(array $attributes, ?self $previousStamp = null): self
{
return new self(
$previousStamp->routingKey ?? null,
Expand Down
2 changes: 1 addition & 1 deletion Transport/AmqpTransport.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class AmqpTransport implements QueueReceiverInterface, TransportInterface, Setup
private AmqpReceiver $receiver;
private AmqpSender $sender;

public function __construct(Connection $connection, SerializerInterface $serializer = null)
public function __construct(Connection $connection, ?SerializerInterface $serializer = null)
{
$this->connection = $connection;
$this->serializer = $serializer ?? new PhpSerializer();
Expand Down
10 changes: 5 additions & 5 deletions Transport/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class Connection
private \AMQPExchange $amqpDelayExchange;
private int $lastActivityTime = 0;

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

Expand Down Expand Up @@ -313,7 +313,7 @@ public function countMessagesInQueues(): int
/**
* @throws \AMQPException
*/
private function publishWithDelay(string $body, array $headers, int $delay, AmqpStamp $amqpStamp = null): void
private function publishWithDelay(string $body, array $headers, int $delay, ?AmqpStamp $amqpStamp = null): void
{
$routingKey = $this->getRoutingKeyForMessage($amqpStamp);
$isRetryAttempt = $amqpStamp ? $amqpStamp->isRetryAttempt() : false;
Expand All @@ -329,7 +329,7 @@ private function publishWithDelay(string $body, array $headers, int $delay, Amqp
);
}

private function publishOnExchange(\AMQPExchange $exchange, string $body, string $routingKey = null, array $headers = [], AmqpStamp $amqpStamp = null): void
private function publishOnExchange(\AMQPExchange $exchange, string $body, ?string $routingKey = null, array $headers = [], ?AmqpStamp $amqpStamp = null): void
{
$attributes = $amqpStamp ? $amqpStamp->getAttributes() : [];
$attributes['headers'] = array_merge($attributes['headers'] ?? [], $headers);
Expand Down

0 comments on commit 85019d3

Please sign in to comment.