Skip to content

Commit 515326d

Browse files
Merge branch '6.4' into 7.0
* 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
2 parents f1e5c63 + 1c6c7a7 commit 515326d

37 files changed

+47
-47
lines changed

Channel/AbstractChannel.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ abstract class AbstractChannel implements ChannelInterface
2323
protected ?TransportInterface $transport;
2424
protected ?MessageBusInterface $bus;
2525

26-
public function __construct(TransportInterface $transport = null, MessageBusInterface $bus = null)
26+
public function __construct(?TransportInterface $transport = null, ?MessageBusInterface $bus = null)
2727
{
2828
if (null === $transport && null === $bus) {
2929
throw new LogicException(sprintf('"%s" needs a Transport or a Bus but both cannot be "null".', static::class));

Channel/BrowserChannel.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function __construct(RequestStack $stack, FlashMessageImportanceMapperInt
3232
$this->mapper = $mapper;
3333
}
3434

35-
public function notify(Notification $notification, RecipientInterface $recipient, string $transportName = null): void
35+
public function notify(Notification $notification, RecipientInterface $recipient, ?string $transportName = null): void
3636
{
3737
if (null === $request = $this->stack->getCurrentRequest()) {
3838
return;

Channel/ChannelInterface.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
*/
2020
interface ChannelInterface
2121
{
22-
public function notify(Notification $notification, RecipientInterface $recipient, string $transportName = null): void;
22+
public function notify(Notification $notification, RecipientInterface $recipient, ?string $transportName = null): void;
2323

2424
public function supports(Notification $notification, RecipientInterface $recipient): bool;
2525
}

Channel/ChatChannel.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
*/
2222
class ChatChannel extends AbstractChannel
2323
{
24-
public function notify(Notification $notification, RecipientInterface $recipient, string $transportName = null): void
24+
public function notify(Notification $notification, RecipientInterface $recipient, ?string $transportName = null): void
2525
{
2626
$message = null;
2727
if ($notification instanceof ChatNotificationInterface) {

Channel/EmailChannel.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class EmailChannel implements ChannelInterface
3434
private string|Address|null $from;
3535
private ?Envelope $envelope;
3636

37-
public function __construct(TransportInterface $transport = null, MessageBusInterface $bus = null, string $from = null, Envelope $envelope = null)
37+
public function __construct(?TransportInterface $transport = null, ?MessageBusInterface $bus = null, ?string $from = null, ?Envelope $envelope = null)
3838
{
3939
if (null === $transport && null === $bus) {
4040
throw new LogicException(sprintf('"%s" needs a Transport or a Bus but both cannot be "null".', static::class));
@@ -49,7 +49,7 @@ public function __construct(TransportInterface $transport = null, MessageBusInte
4949
/**
5050
* @param EmailRecipientInterface $recipient
5151
*/
52-
public function notify(Notification $notification, RecipientInterface $recipient, string $transportName = null): void
52+
public function notify(Notification $notification, RecipientInterface $recipient, ?string $transportName = null): void
5353
{
5454
$message = null;
5555
if ($notification instanceof EmailNotificationInterface) {

Channel/PushChannel.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
*/
2222
class PushChannel extends AbstractChannel
2323
{
24-
public function notify(Notification $notification, RecipientInterface $recipient, string $transportName = null): void
24+
public function notify(Notification $notification, RecipientInterface $recipient, ?string $transportName = null): void
2525
{
2626
$message = null;
2727
if ($notification instanceof PushNotificationInterface) {

Channel/SmsChannel.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class SmsChannel extends AbstractChannel
2525
/**
2626
* @param SmsRecipientInterface $recipient
2727
*/
28-
public function notify(Notification $notification, RecipientInterface $recipient, string $transportName = null): void
28+
public function notify(Notification $notification, RecipientInterface $recipient, ?string $transportName = null): void
2929
{
3030
$message = null;
3131
if ($notification instanceof SmsNotificationInterface) {

Chatter.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ final class Chatter implements ChatterInterface
2727
private ?MessageBusInterface $bus;
2828
private ?EventDispatcherInterface $dispatcher;
2929

30-
public function __construct(TransportInterface $transport, MessageBusInterface $bus = null, EventDispatcherInterface $dispatcher = null)
30+
public function __construct(TransportInterface $transport, ?MessageBusInterface $bus = null, ?EventDispatcherInterface $dispatcher = null)
3131
{
3232
$this->transport = $transport;
3333
$this->bus = $bus;

DataCollector/NotificationDataCollector.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public function __construct(NotificationLoggerListener $logger)
2929
$this->logger = $logger;
3030
}
3131

32-
public function collect(Request $request, Response $response, \Throwable $exception = null): void
32+
public function collect(Request $request, Response $response, ?\Throwable $exception = null): void
3333
{
3434
$this->data['events'] = $this->logger->getEvents();
3535
}

Event/NotificationEvents.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function getTransports(): array
3535
/**
3636
* @return MessageEvent[]
3737
*/
38-
public function getEvents(string $name = null): array
38+
public function getEvents(?string $name = null): array
3939
{
4040
if (null === $name) {
4141
return $this->events;
@@ -54,7 +54,7 @@ public function getEvents(string $name = null): array
5454
/**
5555
* @return MessageInterface[]
5656
*/
57-
public function getMessages(string $name = null): array
57+
public function getMessages(?string $name = null): array
5858
{
5959
$events = $this->getEvents($name);
6060
$messages = [];

Exception/IncompleteDsnException.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class IncompleteDsnException extends InvalidArgumentException
1818
{
1919
private ?string $dsn;
2020

21-
public function __construct(string $message, string $dsn = null, \Throwable $previous = null)
21+
public function __construct(string $message, ?string $dsn = null, ?\Throwable $previous = null)
2222
{
2323
$this->dsn = $dsn;
2424
if ($dsn) {

Exception/MissingRequiredOptionException.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*/
1717
class MissingRequiredOptionException extends IncompleteDsnException
1818
{
19-
public function __construct(string $option, string $dsn = null, \Throwable $previous = null)
19+
public function __construct(string $option, ?string $dsn = null, ?\Throwable $previous = null)
2020
{
2121
$message = sprintf('The option "%s" is required but missing.', $option);
2222

Exception/MultipleExclusiveOptionsUsedException.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class MultipleExclusiveOptionsUsedException extends InvalidArgumentException
2020
* @param string[] $usedExclusiveOptions
2121
* @param string[] $exclusiveOptions
2222
*/
23-
public function __construct(array $usedExclusiveOptions, array $exclusiveOptions, \Throwable $previous = null)
23+
public function __construct(array $usedExclusiveOptions, array $exclusiveOptions, ?\Throwable $previous = null)
2424
{
2525
$message = sprintf(
2626
'Multiple exclusive options have been used "%s". Only one of "%s" can be used.',

Exception/TransportException.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class TransportException extends RuntimeException implements TransportExceptionI
2121
private ResponseInterface $response;
2222
private string $debug = '';
2323

24-
public function __construct(string $message, ResponseInterface $response, int $code = 0, \Throwable $previous = null)
24+
public function __construct(string $message, ResponseInterface $response, int $code = 0, ?\Throwable $previous = null)
2525
{
2626
$this->response = $response;
2727
$this->debug .= $response->getInfo('debug') ?? '';

Exception/UnsupportedSchemeException.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ class UnsupportedSchemeException extends LogicException
301301
/**
302302
* @param string[] $supported
303303
*/
304-
public function __construct(Dsn $dsn, string $name = null, array $supported = [], \Throwable $previous = null)
304+
public function __construct(Dsn $dsn, ?string $name = null, array $supported = [], ?\Throwable $previous = null)
305305
{
306306
$provider = $dsn->getScheme();
307307
if (false !== $pos = strpos($provider, '+')) {

Message/ChatMessage.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class ChatMessage implements MessageInterface, FromNotificationInterface
2323
private ?MessageOptionsInterface $options;
2424
private ?Notification $notification = null;
2525

26-
public function __construct(string $subject, MessageOptionsInterface $options = null)
26+
public function __construct(string $subject, ?MessageOptionsInterface $options = null)
2727
{
2828
$this->subject = $subject;
2929
$this->options = $options;

Message/EmailMessage.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class EmailMessage implements MessageInterface, FromNotificationInterface
2929
private ?Envelope $envelope;
3030
private ?Notification $notification = null;
3131

32-
public function __construct(RawMessage $message, Envelope $envelope = null)
32+
public function __construct(RawMessage $message, ?Envelope $envelope = null)
3333
{
3434
$this->message = $message;
3535
$this->envelope = $envelope;

Message/PushMessage.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class PushMessage implements MessageInterface, FromNotificationInterface
2424
private ?MessageOptionsInterface $options;
2525
private ?Notification $notification = null;
2626

27-
public function __construct(string $subject, string $content, MessageOptionsInterface $options = null)
27+
public function __construct(string $subject, string $content, ?MessageOptionsInterface $options = null)
2828
{
2929
$this->subject = $subject;
3030
$this->content = $content;

Message/SmsMessage.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class SmsMessage implements MessageInterface, FromNotificationInterface
2727
private ?MessageOptionsInterface $options;
2828
private ?Notification $notification = null;
2929

30-
public function __construct(string $phone, string $subject, string $from = '', MessageOptionsInterface $options = null)
30+
public function __construct(string $phone, string $subject, string $from = '', ?MessageOptionsInterface $options = null)
3131
{
3232
if ('' === $phone) {
3333
throw new InvalidArgumentException(sprintf('"%s" needs a phone number, it cannot be empty.', __CLASS__));

Notification/ChatNotificationInterface.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@
1919
*/
2020
interface ChatNotificationInterface
2121
{
22-
public function asChatMessage(RecipientInterface $recipient, string $transport = null): ?ChatMessage;
22+
public function asChatMessage(RecipientInterface $recipient, ?string $transport = null): ?ChatMessage;
2323
}

Notification/EmailNotificationInterface.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@
1919
*/
2020
interface EmailNotificationInterface
2121
{
22-
public function asEmailMessage(EmailRecipientInterface $recipient, string $transport = null): ?EmailMessage;
22+
public function asEmailMessage(EmailRecipientInterface $recipient, ?string $transport = null): ?EmailMessage;
2323
}

Notification/PushNotificationInterface.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@
1616

1717
interface PushNotificationInterface
1818
{
19-
public function asPushMessage(RecipientInterface $recipient, string $transport = null): ?PushMessage;
19+
public function asPushMessage(RecipientInterface $recipient, ?string $transport = null): ?PushMessage;
2020
}

Notification/SmsNotificationInterface.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@
1919
*/
2020
interface SmsNotificationInterface
2121
{
22-
public function asSmsMessage(SmsRecipientInterface $recipient, string $transport = null): ?SmsMessage;
22+
public function asSmsMessage(SmsRecipientInterface $recipient, ?string $transport = null): ?SmsMessage;
2323
}

Notifier.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ final class Notifier implements NotifierInterface
3333
/**
3434
* @param ChannelInterface[]|ContainerInterface $channels
3535
*/
36-
public function __construct(array|ContainerInterface $channels, ChannelPolicyInterface $policy = null)
36+
public function __construct(array|ContainerInterface $channels, ?ChannelPolicyInterface $policy = null)
3737
{
3838
$this->channels = $channels;
3939
$this->policy = $policy;

Test/Constraint/NotificationCount.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ final class NotificationCount extends Constraint
2323
private ?string $transport;
2424
private bool $queued;
2525

26-
public function __construct(int $expectedValue, string $transport = null, bool $queued = false)
26+
public function __construct(int $expectedValue, ?string $transport = null, bool $queued = false)
2727
{
2828
$this->expectedValue = $expectedValue;
2929
$this->transport = $transport;

Test/TransportFactoryTestCase.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public function testCreate(string $expected, string $dsn)
8686
/**
8787
* @dataProvider unsupportedSchemeProvider
8888
*/
89-
public function testUnsupportedSchemeException(string $dsn, string $message = null)
89+
public function testUnsupportedSchemeException(string $dsn, ?string $message = null)
9090
{
9191
$factory = $this->createFactory();
9292

@@ -103,7 +103,7 @@ public function testUnsupportedSchemeException(string $dsn, string $message = nu
103103
/**
104104
* @dataProvider incompleteDsnProvider
105105
*/
106-
public function testIncompleteDsnException(string $dsn, string $message = null)
106+
public function testIncompleteDsnException(string $dsn, ?string $message = null)
107107
{
108108
$factory = $this->createFactory();
109109

@@ -120,7 +120,7 @@ public function testIncompleteDsnException(string $dsn, string $message = null)
120120
/**
121121
* @dataProvider missingRequiredOptionProvider
122122
*/
123-
public function testMissingRequiredOptionException(string $dsn, string $message = null)
123+
public function testMissingRequiredOptionException(string $dsn, ?string $message = null)
124124
{
125125
$factory = $this->createFactory();
126126

Test/TransportTestCase.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ abstract class TransportTestCase extends TestCase
2727
protected const CUSTOM_HOST = 'host.test';
2828
protected const CUSTOM_PORT = 42;
2929

30-
abstract public static function createTransport(HttpClientInterface $client = null): TransportInterface;
30+
abstract public static function createTransport(?HttpClientInterface $client = null): TransportInterface;
3131

3232
/**
3333
* @return iterable<array{0: string, 1: TransportInterface}>
@@ -55,7 +55,7 @@ public function testToString(string $expected, TransportInterface $transport)
5555
/**
5656
* @dataProvider supportedMessagesProvider
5757
*/
58-
public function testSupportedMessages(MessageInterface $message, TransportInterface $transport = null)
58+
public function testSupportedMessages(MessageInterface $message, ?TransportInterface $transport = null)
5959
{
6060
$transport ??= $this->createTransport();
6161

@@ -65,7 +65,7 @@ public function testSupportedMessages(MessageInterface $message, TransportInterf
6565
/**
6666
* @dataProvider unsupportedMessagesProvider
6767
*/
68-
public function testUnsupportedMessages(MessageInterface $message, TransportInterface $transport = null)
68+
public function testUnsupportedMessages(MessageInterface $message, ?TransportInterface $transport = null)
6969
{
7070
$transport ??= $this->createTransport();
7171

@@ -75,7 +75,7 @@ public function testUnsupportedMessages(MessageInterface $message, TransportInte
7575
/**
7676
* @dataProvider unsupportedMessagesProvider
7777
*/
78-
public function testUnsupportedMessagesTrowUnsupportedMessageTypeExceptionWhenSend(MessageInterface $message, TransportInterface $transport = null)
78+
public function testUnsupportedMessagesTrowUnsupportedMessageTypeExceptionWhenSend(MessageInterface $message, ?TransportInterface $transport = null)
7979
{
8080
$transport ??= $this->createTransport();
8181

Tests/Channel/AbstractChannelTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function testChannelCannotBeConstructedWithoutTransportAndBus()
3232

3333
class DummyChannel extends AbstractChannel
3434
{
35-
public function notify(Notification $notification, RecipientInterface $recipient, string $transportName = null): void
35+
public function notify(Notification $notification, RecipientInterface $recipient, ?string $transportName = null): void
3636
{
3737
return;
3838
}

Tests/Event/FailedMessageEventTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public function testFailedMessageEventIsDisptachIfError()
5858
$transport = new class($clientMock, $eventDispatcherMock) extends AbstractTransport {
5959
public NullTransportException $exception;
6060

61-
public function __construct($client, EventDispatcherInterface $dispatcher = null)
61+
public function __construct($client, ?EventDispatcherInterface $dispatcher = null)
6262
{
6363
$this->exception = new NullTransportException();
6464
parent::__construct($client, $dispatcher);

Tests/Mailer/DummyMailer.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class DummyMailer implements MailerInterface
2222
{
2323
private RawMessage $sentMessage;
2424

25-
public function send(RawMessage $message, Envelope $envelope = null): void
25+
public function send(RawMessage $message, ?Envelope $envelope = null): void
2626
{
2727
$this->sentMessage = $message;
2828
}

Tests/Transport/DsnTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ final class DsnTest extends TestCase
2121
/**
2222
* @dataProvider constructProvider
2323
*/
24-
public function testConstruct(string $dsnString, string $scheme, string $host, string $user = null, string $password = null, int $port = null, array $options = [], string $path = null)
24+
public function testConstruct(string $dsnString, string $scheme, string $host, ?string $user = null, ?string $password = null, ?int $port = null, array $options = [], ?string $path = null)
2525
{
2626
$dsn = new Dsn($dsnString);
2727
$this->assertSame($dsnString, $dsn->getOriginalDsn());
@@ -172,7 +172,7 @@ public static function invalidDsnProvider(): iterable
172172
/**
173173
* @dataProvider getOptionProvider
174174
*/
175-
public function testGetOption($expected, string $dsnString, string $option, string $default = null)
175+
public function testGetOption($expected, string $dsnString, string $option, ?string $default = null)
176176
{
177177
$dsn = new Dsn($dsnString);
178178

Texter.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ final class Texter implements TexterInterface
2727
private ?MessageBusInterface $bus;
2828
private ?EventDispatcherInterface $dispatcher;
2929

30-
public function __construct(TransportInterface $transport, MessageBusInterface $bus = null, EventDispatcherInterface $dispatcher = null)
30+
public function __construct(TransportInterface $transport, ?MessageBusInterface $bus = null, ?EventDispatcherInterface $dispatcher = null)
3131
{
3232
$this->transport = $transport;
3333
$this->bus = $bus;

Transport.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -101,14 +101,14 @@ final class Transport
101101

102102
private iterable $factories;
103103

104-
public static function fromDsn(#[\SensitiveParameter] string $dsn, EventDispatcherInterface $dispatcher = null, HttpClientInterface $client = null): TransportInterface
104+
public static function fromDsn(#[\SensitiveParameter] string $dsn, ?EventDispatcherInterface $dispatcher = null, ?HttpClientInterface $client = null): TransportInterface
105105
{
106106
$factory = new self(self::getDefaultFactories($dispatcher, $client));
107107

108108
return $factory->fromString($dsn);
109109
}
110110

111-
public static function fromDsns(#[\SensitiveParameter] array $dsns, EventDispatcherInterface $dispatcher = null, HttpClientInterface $client = null): TransportInterface
111+
public static function fromDsns(#[\SensitiveParameter] array $dsns, ?EventDispatcherInterface $dispatcher = null, ?HttpClientInterface $client = null): TransportInterface
112112
{
113113
$factory = new self(iterator_to_array(self::getDefaultFactories($dispatcher, $client)));
114114

@@ -175,7 +175,7 @@ private function createFromDsns(#[\SensitiveParameter] array $dsns): array
175175
/**
176176
* @return TransportFactoryInterface[]
177177
*/
178-
private static function getDefaultFactories(EventDispatcherInterface $dispatcher = null, HttpClientInterface $client = null): iterable
178+
private static function getDefaultFactories(?EventDispatcherInterface $dispatcher = null, ?HttpClientInterface $client = null): iterable
179179
{
180180
foreach (self::FACTORY_CLASSES as $factoryClass) {
181181
if (class_exists($factoryClass)) {

Transport/AbstractTransport.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ abstract class AbstractTransport implements TransportInterface
3434
protected ?string $host = null;
3535
protected ?int $port = null;
3636

37-
public function __construct(HttpClientInterface $client = null, EventDispatcherInterface $dispatcher = null)
37+
public function __construct(?HttpClientInterface $client = null, ?EventDispatcherInterface $dispatcher = null)
3838
{
3939
$this->client = $client;
4040
if (null === $client) {

Transport/AbstractTransportFactory.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ abstract class AbstractTransportFactory implements TransportFactoryInterface
2424
protected ?EventDispatcherInterface $dispatcher;
2525
protected ?HttpClientInterface $client;
2626

27-
public function __construct(EventDispatcherInterface $dispatcher = null, HttpClientInterface $client = null)
27+
public function __construct(?EventDispatcherInterface $dispatcher = null, ?HttpClientInterface $client = null)
2828
{
2929
$this->dispatcher = $dispatcher;
3030
$this->client = $client;

0 commit comments

Comments
 (0)