Skip to content

Commit c827da0

Browse files
Apply php-cs-fixer fix --rules nullable_type_declaration_for_default_null_value
1 parent 955f7bd commit c827da0

22 files changed

+28
-28
lines changed

DataCollector/MessageDataCollector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function __construct(MessageLoggerListener $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->events;
3838
}

Event/MessageEvents.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 RawMessage[]
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 = [];

EventListener/EnvelopeListener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class EnvelopeListener implements EventSubscriberInterface
3030
* @param Address|string $sender
3131
* @param array<Address|string> $recipients
3232
*/
33-
public function __construct($sender = null, array $recipients = null)
33+
public function __construct($sender = null, ?array $recipients = null)
3434
{
3535
if (null !== $sender) {
3636
$this->sender = Address::create($sender);

EventListener/MessageListener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class MessageListener implements EventSubscriberInterface
4343
private $headerRules = [];
4444
private $renderer;
4545

46-
public function __construct(Headers $headers = null, BodyRendererInterface $renderer = null, array $headerRules = self::DEFAULT_RULES)
46+
public function __construct(?Headers $headers = null, ?BodyRendererInterface $renderer = null, array $headerRules = self::DEFAULT_RULES)
4747
{
4848
$this->headers = $headers;
4949
$this->renderer = $renderer;

Exception/HttpTransportException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class HttpTransportException extends TransportException
2020
{
2121
private $response;
2222

23-
public function __construct(?string $message, ResponseInterface $response, int $code = 0, \Throwable $previous = null)
23+
public function __construct(?string $message, ResponseInterface $response, int $code = 0, ?\Throwable $previous = null)
2424
{
2525
if (null === $message) {
2626
trigger_deprecation('symfony/mailer', '5.3', 'Passing null as $message to "%s()" is deprecated, pass an empty string instead.', __METHOD__);

Exception/UnsupportedSchemeException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class UnsupportedSchemeException extends LogicException
5858
],
5959
];
6060

61-
public function __construct(Dsn $dsn, string $name = null, array $supported = [])
61+
public function __construct(Dsn $dsn, ?string $name = null, array $supported = [])
6262
{
6363
$provider = $dsn->getScheme();
6464
if (false !== $pos = strpos($provider, '+')) {

Mailer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@ final class Mailer implements MailerInterface
3232
private $bus;
3333
private $dispatcher;
3434

35-
public function __construct(TransportInterface $transport, MessageBusInterface $bus = null, EventDispatcherInterface $dispatcher = null)
35+
public function __construct(TransportInterface $transport, ?MessageBusInterface $bus = null, ?EventDispatcherInterface $dispatcher = null)
3636
{
3737
$this->transport = $transport;
3838
$this->bus = $bus;
3939
$this->dispatcher = class_exists(Event::class) && $dispatcher instanceof SymfonyEventDispatcherInterface ? LegacyEventDispatcherProxy::decorate($dispatcher) : $dispatcher;
4040
}
4141

42-
public function send(RawMessage $message, Envelope $envelope = null): void
42+
public function send(RawMessage $message, ?Envelope $envelope = null): void
4343
{
4444
if (null === $this->bus) {
4545
$this->transport->send($message, $envelope);

MailerInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,5 @@ interface MailerInterface
2626
/**
2727
* @throws TransportExceptionInterface
2828
*/
29-
public function send(RawMessage $message, Envelope $envelope = null): void;
29+
public function send(RawMessage $message, ?Envelope $envelope = null): void;
3030
}

Messenger/SendEmailMessage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class SendEmailMessage
2222
private $message;
2323
private $envelope;
2424

25-
public function __construct(RawMessage $message, Envelope $envelope = null)
25+
public function __construct(RawMessage $message, ?Envelope $envelope = null)
2626
{
2727
$this->message = $message;
2828
$this->envelope = $envelope;

Test/Constraint/EmailCount.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ final class EmailCount extends Constraint
2020
private $transport;
2121
private $queued;
2222

23-
public function __construct(int $expectedValue, string $transport = null, bool $queued = false)
23+
public function __construct(int $expectedValue, ?string $transport = null, bool $queued = false)
2424
{
2525
$this->expectedValue = $expectedValue;
2626
$this->transport = $transport;

Test/TransportFactoryTestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public function testCreate(Dsn $dsn, TransportInterface $transport)
7777
/**
7878
* @dataProvider unsupportedSchemeProvider
7979
*/
80-
public function testUnsupportedSchemeException(Dsn $dsn, string $message = null)
80+
public function testUnsupportedSchemeException(Dsn $dsn, ?string $message = null)
8181
{
8282
$factory = $this->getFactory();
8383

Tests/TransportTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public function __construct(string $host)
109109
$this->host = $host;
110110
}
111111

112-
public function send(RawMessage $message, Envelope $envelope = null): ?SentMessage
112+
public function send(RawMessage $message, ?Envelope $envelope = null): ?SentMessage
113113
{
114114
throw new \BadMethodCallException('This method newer should be called.');
115115
}

Transport/AbstractHttpTransport.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ abstract class AbstractHttpTransport extends AbstractTransport
2828
protected $port;
2929
protected $client;
3030

31-
public function __construct(HttpClientInterface $client = null, EventDispatcherInterface $dispatcher = null, LoggerInterface $logger = null)
31+
public function __construct(?HttpClientInterface $client = null, ?EventDispatcherInterface $dispatcher = null, ?LoggerInterface $logger = null)
3232
{
3333
$this->client = $client;
3434
if (null === $client) {

Transport/AbstractTransport.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ abstract class AbstractTransport implements TransportInterface
3333
private $rate = 0;
3434
private $lastSent = 0;
3535

36-
public function __construct(EventDispatcherInterface $dispatcher = null, LoggerInterface $logger = null)
36+
public function __construct(?EventDispatcherInterface $dispatcher = null, ?LoggerInterface $logger = null)
3737
{
3838
$this->dispatcher = class_exists(Event::class) && $dispatcher instanceof SymfonyEventDispatcherInterface ? LegacyEventDispatcherProxy::decorate($dispatcher) : $dispatcher;
3939
$this->logger = $logger ?? new NullLogger();
@@ -56,7 +56,7 @@ public function setMaxPerSecond(float $rate): self
5656
return $this;
5757
}
5858

59-
public function send(RawMessage $message, Envelope $envelope = null): ?SentMessage
59+
public function send(RawMessage $message, ?Envelope $envelope = null): ?SentMessage
6060
{
6161
$message = clone $message;
6262
$envelope = null !== $envelope ? clone $envelope : Envelope::create($message);

Transport/AbstractTransportFactory.php

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

28-
public function __construct(EventDispatcherInterface $dispatcher = null, HttpClientInterface $client = null, LoggerInterface $logger = null)
28+
public function __construct(?EventDispatcherInterface $dispatcher = null, ?HttpClientInterface $client = null, ?LoggerInterface $logger = null)
2929
{
3030
$this->dispatcher = $dispatcher;
3131
$this->client = $client;

Transport/Dsn.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ final class Dsn
2525
private $port;
2626
private $options;
2727

28-
public function __construct(string $scheme, string $host, string $user = null, string $password = null, int $port = null, array $options = [])
28+
public function __construct(string $scheme, string $host, ?string $user = null, ?string $password = null, ?int $port = null, array $options = [])
2929
{
3030
$this->scheme = $scheme;
3131
$this->host = $host;
@@ -77,7 +77,7 @@ public function getPassword(): ?string
7777
return $this->password;
7878
}
7979

80-
public function getPort(int $default = null): ?int
80+
public function getPort(?int $default = null): ?int
8181
{
8282
return $this->port ?? $default;
8383
}

Transport/RoundRobinTransport.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public function __construct(array $transports, int $retryPeriod = 60)
4646
$this->retryPeriod = $retryPeriod;
4747
}
4848

49-
public function send(RawMessage $message, Envelope $envelope = null): ?SentMessage
49+
public function send(RawMessage $message, ?Envelope $envelope = null): ?SentMessage
5050
{
5151
$exception = null;
5252

Transport/SendmailTransport.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class SendmailTransport extends AbstractTransport
4949
*
5050
* -f<sender> flag will be appended automatically if one is not present.
5151
*/
52-
public function __construct(string $command = null, EventDispatcherInterface $dispatcher = null, LoggerInterface $logger = null)
52+
public function __construct(?string $command = null, ?EventDispatcherInterface $dispatcher = null, ?LoggerInterface $logger = null)
5353
{
5454
parent::__construct($dispatcher, $logger);
5555

@@ -68,7 +68,7 @@ public function __construct(string $command = null, EventDispatcherInterface $di
6868
}
6969
}
7070

71-
public function send(RawMessage $message, Envelope $envelope = null): ?SentMessage
71+
public function send(RawMessage $message, ?Envelope $envelope = null): ?SentMessage
7272
{
7373
if ($this->transport) {
7474
return $this->transport->send($message, $envelope);

Transport/Smtp/EsmtpTransport.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class EsmtpTransport extends SmtpTransport
3030
private $username = '';
3131
private $password = '';
3232

33-
public function __construct(string $host = 'localhost', int $port = 0, bool $tls = null, EventDispatcherInterface $dispatcher = null, LoggerInterface $logger = null)
33+
public function __construct(string $host = 'localhost', int $port = 0, ?bool $tls = null, ?EventDispatcherInterface $dispatcher = null, ?LoggerInterface $logger = null)
3434
{
3535
parent::__construct(null, $dispatcher, $logger);
3636

Transport/Smtp/SmtpTransport.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class SmtpTransport extends AbstractTransport
4040
private $stream;
4141
private $domain = '[127.0.0.1]';
4242

43-
public function __construct(AbstractStream $stream = null, EventDispatcherInterface $dispatcher = null, LoggerInterface $logger = null)
43+
public function __construct(?AbstractStream $stream = null, ?EventDispatcherInterface $dispatcher = null, ?LoggerInterface $logger = null)
4444
{
4545
parent::__construct($dispatcher, $logger);
4646

@@ -130,7 +130,7 @@ public function getLocalDomain(): string
130130
return $this->domain;
131131
}
132132

133-
public function send(RawMessage $message, Envelope $envelope = null): ?SentMessage
133+
public function send(RawMessage $message, ?Envelope $envelope = null): ?SentMessage
134134
{
135135
try {
136136
$message = parent::send($message, $envelope);

Transport/TransportInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ interface TransportInterface
2929
/**
3030
* @throws TransportExceptionInterface
3131
*/
32-
public function send(RawMessage $message, Envelope $envelope = null): ?SentMessage;
32+
public function send(RawMessage $message, ?Envelope $envelope = null): ?SentMessage;
3333

3434
public function __toString(): string;
3535
}

Transport/Transports.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function __construct(iterable $transports)
4444
}
4545
}
4646

47-
public function send(RawMessage $message, Envelope $envelope = null): ?SentMessage
47+
public function send(RawMessage $message, ?Envelope $envelope = null): ?SentMessage
4848
{
4949
/** @var Message $message */
5050
if (RawMessage::class === \get_class($message) || !$message->getHeaders()->has('X-Transport')) {

0 commit comments

Comments
 (0)