Skip to content

Commit 998fa9d

Browse files
minor symfony#54335 Make more nullable types explicit (nicolas-grekas)
This PR was merged into the 5.4 branch. Discussion ---------- Make more nullable types explicit | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Issues | - | License | MIT This time in comments and in dumps. Commits ------- 73d769e Make more nullable types explicit
2 parents b9b35dc + 73d769e commit 998fa9d

File tree

19 files changed

+27
-27
lines changed

19 files changed

+27
-27
lines changed

src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/PhpDumper/Fixtures/proxy-implem.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ public function __wakeup()
200200
{
201201
}
202202

203-
public function setProxyInitializer(\Closure $initializer = null)%S
203+
public function setProxyInitializer(%S\Closure $initializer = null)%S
204204
{
205205
$this->initializer%s = $initializer;
206206
}

src/Symfony/Component/ErrorHandler/Tests/Fixtures/ClassWithAnnotatedParameters.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ public function fooMethod(string $foo)
1414
/**
1515
* @param string $bar parameter not implemented yet
1616
*/
17-
public function barMethod(/* string $bar = null */)
17+
public function barMethod(/* ?string $bar = null */)
1818
{
1919
}
2020

2121
/**
2222
* @param Quz $quz parameter not implemented yet
2323
*/
24-
public function quzMethod(/* Quz $quz = null */)
24+
public function quzMethod(/* ?Quz $quz = null */)
2525
{
2626
}
2727

src/Symfony/Component/HttpFoundation/ParameterBag.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function __construct(array $parameters = [])
3939
*
4040
* @return array
4141
*/
42-
public function all(/* string $key = null */)
42+
public function all(/* ?string $key = null */)
4343
{
4444
$key = \func_num_args() > 0 ? func_get_arg(0) : null;
4545

src/Symfony/Component/Mailer/Transport.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class Transport
6363
* @param HttpClientInterface|null $client
6464
* @param LoggerInterface|null $logger
6565
*/
66-
public static function fromDsn(string $dsn/* , EventDispatcherInterface $dispatcher = null, HttpClientInterface $client = null, LoggerInterface $logger = null */): TransportInterface
66+
public static function fromDsn(string $dsn/* , ?EventDispatcherInterface $dispatcher = null, ?HttpClientInterface $client = null, ?LoggerInterface $logger = null */): TransportInterface
6767
{
6868
$dispatcher = 2 <= \func_num_args() ? func_get_arg(1) : null;
6969
$client = 3 <= \func_num_args() ? func_get_arg(2) : null;
@@ -79,7 +79,7 @@ public static function fromDsn(string $dsn/* , EventDispatcherInterface $dispatc
7979
* @param HttpClientInterface|null $client
8080
* @param LoggerInterface|null $logger
8181
*/
82-
public static function fromDsns(array $dsns/* , EventDispatcherInterface $dispatcher = null, HttpClientInterface $client = null, LoggerInterface $logger = null */): TransportInterface
82+
public static function fromDsns(array $dsns/* , ?EventDispatcherInterface $dispatcher = null, ?HttpClientInterface $client = null, ?LoggerInterface $logger = null */): TransportInterface
8383
{
8484
$dispatcher = 2 <= \func_num_args() ? func_get_arg(1) : null;
8585
$client = 3 <= \func_num_args() ? func_get_arg(2) : null;
@@ -183,7 +183,7 @@ public function fromDsnObject(Dsn $dsn): TransportInterface
183183
*
184184
* @return \Traversable<int, TransportFactoryInterface>
185185
*/
186-
public static function getDefaultFactories(/* EventDispatcherInterface $dispatcher = null, HttpClientInterface $client = null, LoggerInterface $logger = null */): iterable
186+
public static function getDefaultFactories(/* ?EventDispatcherInterface $dispatcher = null, ?HttpClientInterface $client = null, ?LoggerInterface $logger = null */): iterable
187187
{
188188
$dispatcher = 1 <= \func_num_args() ? func_get_arg(0) : null;
189189
$client = 2 <= \func_num_args() ? func_get_arg(1) : null;

src/Symfony/Component/Messenger/Command/AbstractFailedMessagesCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ protected function printPendingMessagesMessage(ReceiverInterface $receiver, Symf
185185
/**
186186
* @param string|null $name
187187
*/
188-
protected function getReceiver(/* string $name = null */): ReceiverInterface
188+
protected function getReceiver(/* ?string $name = null */): ReceiverInterface
189189
{
190190
if (1 > \func_num_args() && __CLASS__ !== static::class && __CLASS__ !== (new \ReflectionMethod($this, __FUNCTION__))->getDeclaringClass()->getName() && !$this instanceof \PHPUnit\Framework\MockObject\MockObject && !$this instanceof \Prophecy\Prophecy\ProphecySubjectInterface && !$this instanceof \Mockery\MockInterface) {
191191
trigger_deprecation('symfony/messenger', '5.3', 'The "%s()" method will have a new "string $name" argument in version 6.0, not defining it is deprecated.', __METHOD__);

src/Symfony/Component/Messenger/Handler/BatchHandlerInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ interface BatchHandlerInterface
2323
* @return mixed The number of pending messages in the batch if $ack is not null,
2424
* the result from handling the message otherwise
2525
*/
26-
// public function __invoke(object $message, Acknowledger $ack = null): mixed;
26+
// public function __invoke(object $message, ?Acknowledger $ack = null): mixed;
2727

2828
/**
2929
* Flushes any pending buffers.

src/Symfony/Component/Messenger/Retry/RetryStrategyInterface.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ interface RetryStrategyInterface
2323
/**
2424
* @param \Throwable|null $throwable The cause of the failed handling
2525
*/
26-
public function isRetryable(Envelope $message/* , \Throwable $throwable = null */): bool;
26+
public function isRetryable(Envelope $message/* , ?\Throwable $throwable = null */): bool;
2727

2828
/**
2929
* @param \Throwable|null $throwable The cause of the failed handling
3030
*
3131
* @return int The time to delay/wait in milliseconds
3232
*/
33-
public function getWaitingTime(Envelope $message/* , \Throwable $throwable = null */): int;
33+
public function getWaitingTime(Envelope $message/* , ?\Throwable $throwable = null */): int;
3434
}

src/Symfony/Component/Notifier/Bridge/Esendex/CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ CHANGELOG
1111

1212
* The bridge is not marked as `@experimental` anymore
1313
* [BC BREAK] Change signature of `EsendexTransport::__construct()` method from:
14-
`public function __construct(string $token, string $accountReference, string $from, HttpClientInterface $client = null, EventDispatcherInterface $dispatcher = null)`
14+
`public function __construct(string $token, string $accountReference, string $from, ?HttpClientInterface $client = null, ?EventDispatcherInterface $dispatcher = null)`
1515
to:
16-
`public function __construct(string $email, string $password, string $accountReference, string $from, HttpClientInterface $client = null, EventDispatcherInterface $dispatcher = null)`
16+
`public function __construct(string $email, string $password, string $accountReference, string $from, ?HttpClientInterface $client = null, ?EventDispatcherInterface $dispatcher = null)`
1717

1818
5.2.0
1919
-----

src/Symfony/Component/Notifier/Bridge/GoogleChat/CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ CHANGELOG
77
* The bridge is not marked as `@experimental` anymore
88
* [BC BREAK] Remove `GoogleChatTransport::setThreadKey()` method, this parameter should now be provided via the constructor,
99
which has changed from:
10-
`__construct(string $space, string $accessKey, string $accessToken, HttpClientInterface $client = null, EventDispatcherInterface $dispatcher = null)`
10+
`__construct(string $space, string $accessKey, string $accessToken, ?HttpClientInterface $client = null, ?EventDispatcherInterface $dispatcher = null)`
1111
to:
12-
`__construct(string $space, string $accessKey, string $accessToken, string $threadKey = null, HttpClientInterface $client = null, EventDispatcherInterface $dispatcher = null)`
12+
`__construct(string $space, string $accessKey, string $accessToken, ?string $threadKey = null, ?HttpClientInterface $client = null, ?EventDispatcherInterface $dispatcher = null)`
1313
* [BC BREAK] Rename the parameter `threadKey` to `thread_key` in DSN
1414

1515
5.2.0

src/Symfony/Component/Notifier/Bridge/Mattermost/CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ CHANGELOG
66

77
* The bridge is not marked as `@experimental` anymore
88
* [BC BREAK] Change signature of `MattermostTransport::__construct()` method from:
9-
`public function __construct(string $token, string $channel, HttpClientInterface $client = null, EventDispatcherInterface $dispatcher = null, string $path = null)`
9+
`public function __construct(string $token, string $channel, ?HttpClientInterface $client = null, ?EventDispatcherInterface $dispatcher = null, ?string $path = null)`
1010
to:
11-
`public function __construct(string $token, string $channel, ?string $path = null, HttpClientInterface $client = null, EventDispatcherInterface $dispatcher = null)`
11+
`public function __construct(string $token, string $channel, ?string $path = null, ?HttpClientInterface $client = null, ?EventDispatcherInterface $dispatcher = null)`
1212

1313
5.1.0
1414
-----

0 commit comments

Comments
 (0)