Skip to content

Commit 96c5ff3

Browse files
Apply php-cs-fixer fix --rules nullable_type_declaration_for_default_null_value
1 parent 98ea3a5 commit 96c5ff3

34 files changed

+44
-44
lines changed

Channel/AbstractChannel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ abstract class AbstractChannel implements ChannelInterface
2323
protected $transport;
2424
protected $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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public function __construct(RequestStack $stack)
2727
$this->stack = $stack;
2828
}
2929

30-
public function notify(Notification $notification, RecipientInterface $recipient, string $transportName = null): void
30+
public function notify(Notification $notification, RecipientInterface $recipient, ?string $transportName = null): void
3131
{
3232
if (null === $request = $this->stack->getCurrentRequest()) {
3333
return;

Channel/ChannelInterface.php

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class EmailChannel implements ChannelInterface
3333
private $from;
3434
private $envelope;
3535

36-
public function __construct(TransportInterface $transport = null, MessageBusInterface $bus = null, string $from = null, Envelope $envelope = null)
36+
public function __construct(?TransportInterface $transport = null, ?MessageBusInterface $bus = null, ?string $from = null, ?Envelope $envelope = null)
3737
{
3838
if (null === $transport && null === $bus) {
3939
throw new LogicException(sprintf('"%s" needs a Transport or a Bus but both cannot be "null".', static::class));
@@ -45,7 +45,7 @@ public function __construct(TransportInterface $transport = null, MessageBusInte
4545
$this->envelope = $envelope;
4646
}
4747

48-
public function notify(Notification $notification, RecipientInterface $recipient, string $transportName = null): void
48+
public function notify(Notification $notification, RecipientInterface $recipient, ?string $transportName = null): void
4949
{
5050
$message = null;
5151
if ($notification instanceof EmailNotificationInterface) {

Channel/PushChannel.php

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
*/
2323
class SmsChannel extends AbstractChannel
2424
{
25-
public function notify(Notification $notification, RecipientInterface $recipient, string $transportName = null): void
25+
public function notify(Notification $notification, RecipientInterface $recipient, ?string $transportName = null): void
2626
{
2727
$message = null;
2828
if ($notification instanceof SmsNotificationInterface) {

Chatter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ final class Chatter implements ChatterInterface
2929
private $bus;
3030
private $dispatcher;
3131

32-
public function __construct(TransportInterface $transport, MessageBusInterface $bus = null, EventDispatcherInterface $dispatcher = null)
32+
public function __construct(TransportInterface $transport, ?MessageBusInterface $bus = null, ?EventDispatcherInterface $dispatcher = null)
3333
{
3434
$this->transport = $transport;
3535
$this->bus = $bus;

DataCollector/NotificationDataCollector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function __construct(NotificationLoggerListener $logger)
3232
/**
3333
* {@inheritdoc}
3434
*/
35-
public function collect(Request $request, Response $response, \Throwable $exception = null)
35+
public function collect(Request $request, Response $response, ?\Throwable $exception = null)
3636
{
3737
$this->data['events'] = $this->logger->getEvents();
3838
}

Event/NotificationEvents.php

Lines changed: 2 additions & 2 deletions
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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class IncompleteDsnException extends InvalidArgumentException
1818
{
1919
private $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

Lines changed: 1 addition & 1 deletion
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/TransportException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class TransportException extends RuntimeException implements TransportExceptionI
2121
private $response;
2222
private $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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ class UnsupportedSchemeException extends LogicException
201201
/**
202202
* @param string[] $supported
203203
*/
204-
public function __construct(Dsn $dsn, string $name = null, array $supported = [], \Throwable $previous = null)
204+
public function __construct(Dsn $dsn, ?string $name = null, array $supported = [], ?\Throwable $previous = null)
205205
{
206206
$provider = $dsn->getScheme();
207207
if (false !== $pos = strpos($provider, '+')) {

Message/ChatMessage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ final class ChatMessage implements MessageInterface
2323
private $options;
2424
private $notification;
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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ final class EmailMessage implements MessageInterface
2828
private $message;
2929
private $envelope;
3030

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

Message/PushMessage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ final class PushMessage implements MessageInterface
2424
private $options;
2525
private $notification;
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;

Notification/ChatNotificationInterface.php

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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($channels, ChannelPolicyInterface $policy = null)
36+
public function __construct($channels, ?ChannelPolicyInterface $policy = null)
3737
{
3838
$this->channels = $channels;
3939
$this->policy = $policy;

Test/TransportFactoryTestCase.php

Lines changed: 3 additions & 3 deletions
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

Lines changed: 4 additions & 4 deletions
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
if (null === $transport) {
6161
$transport = $this->createTransport();
@@ -67,7 +67,7 @@ public function testSupportedMessages(MessageInterface $message, TransportInterf
6767
/**
6868
* @dataProvider unsupportedMessagesProvider
6969
*/
70-
public function testUnsupportedMessages(MessageInterface $message, TransportInterface $transport = null)
70+
public function testUnsupportedMessages(MessageInterface $message, ?TransportInterface $transport = null)
7171
{
7272
if (null === $transport) {
7373
$transport = $this->createTransport();
@@ -79,7 +79,7 @@ public function testUnsupportedMessages(MessageInterface $message, TransportInte
7979
/**
8080
* @dataProvider unsupportedMessagesProvider
8181
*/
82-
public function testUnsupportedMessagesTrowUnsupportedMessageTypeExceptionWhenSend(MessageInterface $message, TransportInterface $transport = null)
82+
public function testUnsupportedMessagesTrowUnsupportedMessageTypeExceptionWhenSend(MessageInterface $message, ?TransportInterface $transport = null)
8383
{
8484
if (null === $transport) {
8585
$transport = $this->createTransport();

Tests/Channel/AbstractChannelTest.php

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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 $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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class DummyMailer implements MailerInterface
2222
{
2323
private $sentMessage = null;
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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ final class Texter implements TexterInterface
2929
private $bus;
3030
private $dispatcher;
3131

32-
public function __construct(TransportInterface $transport, MessageBusInterface $bus = null, EventDispatcherInterface $dispatcher = null)
32+
public function __construct(TransportInterface $transport, ?MessageBusInterface $bus = null, ?EventDispatcherInterface $dispatcher = null)
3333
{
3434
$this->transport = $transport;
3535
$this->bus = $bus;

Transport.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,14 +108,14 @@ class Transport
108108

109109
private $factories;
110110

111-
public static function fromDsn(string $dsn, EventDispatcherInterface $dispatcher = null, HttpClientInterface $client = null): TransportInterface
111+
public static function fromDsn(string $dsn, ?EventDispatcherInterface $dispatcher = null, ?HttpClientInterface $client = null): TransportInterface
112112
{
113113
$factory = new self(self::getDefaultFactories($dispatcher, $client));
114114

115115
return $factory->fromString($dsn);
116116
}
117117

118-
public static function fromDsns(array $dsns, EventDispatcherInterface $dispatcher = null, HttpClientInterface $client = null): TransportInterface
118+
public static function fromDsns(array $dsns, ?EventDispatcherInterface $dispatcher = null, ?HttpClientInterface $client = null): TransportInterface
119119
{
120120
$factory = new self(iterator_to_array(self::getDefaultFactories($dispatcher, $client)));
121121

@@ -182,7 +182,7 @@ private function createFromDsns(array $dsns): array
182182
/**
183183
* @return TransportFactoryInterface[]
184184
*/
185-
private static function getDefaultFactories(EventDispatcherInterface $dispatcher = null, HttpClientInterface $client = null): iterable
185+
private static function getDefaultFactories(?EventDispatcherInterface $dispatcher = null, ?HttpClientInterface $client = null): iterable
186186
{
187187
foreach (self::FACTORY_CLASSES as $factoryClass) {
188188
if (class_exists($factoryClass)) {

Transport/AbstractTransport.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ abstract class AbstractTransport implements TransportInterface
3636
protected $host;
3737
protected $port;
3838

39-
public function __construct(HttpClientInterface $client = null, EventDispatcherInterface $dispatcher = null)
39+
public function __construct(?HttpClientInterface $client = null, ?EventDispatcherInterface $dispatcher = null)
4040
{
4141
$this->client = $client;
4242
if (null === $client) {

Transport/AbstractTransportFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ abstract class AbstractTransportFactory implements TransportFactoryInterface
2626
protected $dispatcher;
2727
protected $client;
2828

29-
public function __construct(EventDispatcherInterface $dispatcher = null, HttpClientInterface $client = null)
29+
public function __construct(?EventDispatcherInterface $dispatcher = null, ?HttpClientInterface $client = null)
3030
{
3131
$this->dispatcher = class_exists(Event::class) ? LegacyEventDispatcherProxy::decorate($dispatcher) : $dispatcher;
3232
$this->client = $client;

Transport/Dsn.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public function getPassword(): ?string
7474
return $this->password;
7575
}
7676

77-
public function getPort(int $default = null): ?int
77+
public function getPort(?int $default = null): ?int
7878
{
7979
return $this->port ?? $default;
8080
}

Transport/NullTransport.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class NullTransport implements TransportInterface
2727
{
2828
private $dispatcher;
2929

30-
public function __construct(EventDispatcherInterface $dispatcher = null)
30+
public function __construct(?EventDispatcherInterface $dispatcher = null)
3131
{
3232
$this->dispatcher = class_exists(Event::class) ? LegacyEventDispatcherProxy::decorate($dispatcher) : $dispatcher;
3333
}

0 commit comments

Comments
 (0)