Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 998fa9d

Browse filesBrowse files
minor #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
Copy full SHA for 998fa9d

File tree

Expand file treeCollapse file tree

19 files changed

+27
-27
lines changed
Filter options
Expand file treeCollapse file tree

19 files changed

+27
-27
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/PhpDumper/Fixtures/proxy-implem.php
+1-1Lines 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

Copy file name to clipboardExpand all lines: src/Symfony/Component/ErrorHandler/Tests/Fixtures/ClassWithAnnotatedParameters.php
+2-2Lines 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

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpFoundation/ParameterBag.php
+1-1Lines 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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Mailer/Transport.php
+3-3Lines 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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Messenger/Command/AbstractFailedMessagesCommand.php
+1-1Lines 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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Messenger/Handler/BatchHandlerInterface.php
+1-1Lines 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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Messenger/Retry/RetryStrategyInterface.php
+2-2Lines 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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Notifier/Bridge/Esendex/CHANGELOG.md
+2-2Lines 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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Notifier/Bridge/GoogleChat/CHANGELOG.md
+2-2Lines 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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Notifier/Bridge/Mattermost/CHANGELOG.md
+2-2Lines 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
-----

‎src/Symfony/Component/PropertyInfo/Extractor/ReflectionExtractor.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/PropertyInfo/Extractor/ReflectionExtractor.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -681,7 +681,7 @@ private function getMutatorMethod(string $class, string $property): ?array
681681
continue;
682682
}
683683

684-
// Parameter can be optional to allow things like: method(array $foo = null)
684+
// Parameter can be optional to allow things like: method(?array $foo = null)
685685
if ($reflectionMethod->getNumberOfParameters() >= 1) {
686686
return [$reflectionMethod, $prefix];
687687
}

‎src/Symfony/Component/Security/Core/Authentication/AuthenticationTrustResolverInterface.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Security/Core/Authentication/AuthenticationTrustResolverInterface.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*
1919
* @author Johannes M. Schmitt <schmittjoh@gmail.com>
2020
*
21-
* @method bool isAuthenticated(TokenInterface $token = null)
21+
* @method bool isAuthenticated(?TokenInterface $token = null)
2222
*/
2323
interface AuthenticationTrustResolverInterface
2424
{

‎src/Symfony/Component/Security/Core/Authorization/AccessDecisionManager.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Security/Core/Authorization/AccessDecisionManager.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class AccessDecisionManager implements AccessDecisionManagerInterface
6868
*
6969
* @throws \InvalidArgumentException
7070
*/
71-
public function __construct(iterable $voters = [], /* AccessDecisionStrategyInterface */ $strategy = null)
71+
public function __construct(iterable $voters = [], /* ?AccessDecisionStrategyInterface */ $strategy = null)
7272
{
7373
$this->voters = $voters;
7474
if (\is_string($strategy)) {

‎src/Symfony/Component/Security/Http/Firewall/ChannelListener.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Security/Http/Firewall/ChannelListener.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class ChannelListener extends AbstractListener
3434
private $httpPort;
3535
private $httpsPort;
3636

37-
public function __construct(AccessMapInterface $map, /* LoggerInterface */ $logger = null, /* int */ $httpPort = 80, /* int */ $httpsPort = 443)
37+
public function __construct(AccessMapInterface $map, /* ?LoggerInterface */ $logger = null, /* int */ $httpPort = 80, /* int */ $httpsPort = 443)
3838
{
3939
if ($logger instanceof AuthenticationEntryPointInterface) {
4040
trigger_deprecation('symfony/security-http', '5.4', 'The "$authenticationEntryPoint" argument of "%s()" is deprecated.', __METHOD__);

‎src/Symfony/Component/VarDumper/Caster/ReflectionCaster.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/VarDumper/Caster/ReflectionCaster.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ public static function getSignature(array $a)
368368
if (!$type instanceof \ReflectionNamedType) {
369369
$signature .= $type.' ';
370370
} else {
371-
if (!$param->isOptional() && $param->allowsNull() && 'mixed' !== $type->getName()) {
371+
if ($param->allowsNull() && 'mixed' !== $type->getName()) {
372372
$signature .= '?';
373373
}
374374
$signature .= substr(strrchr('\\'.$type->getName(), '\\'), 1).' ';

‎src/Symfony/Component/VarDumper/Tests/Caster/StubCasterTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/VarDumper/Tests/Caster/StubCasterTest.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ public function testClassStub()
141141

142142
$expectedDump = <<<'EODUMP'
143143
<foo></foo><bar><span class=sf-dump-note>array:1</span> [<samp data-depth=1 class=sf-dump-expanded>
144-
<span class=sf-dump-index>0</span> => "<a href="%sFooInterface.php:10" rel="noopener noreferrer"><span class=sf-dump-str title="39 characters">hello(?stdClass $a, stdClass $b = null)</span></a>"
144+
<span class=sf-dump-index>0</span> => "<a href="%sFooInterface.php:10" rel="noopener noreferrer"><span class=sf-dump-str title="40 characters">hello(?stdClass $a, ?stdClass $b = null)</span></a>"
145145
</samp>]
146146
</bar>
147147
EODUMP;

‎src/Symfony/Component/VarDumper/Tests/Dumper/CliDumperTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/VarDumper/Tests/Dumper/CliDumperTest.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public function testGet()
8787
+foo: ""…3
8888
+"bar": "bar"
8989
}
90-
"closure" => Closure(\$a, PDO &\$b = null) {#%d
90+
"closure" => Closure(\$a, ?PDO &\$b = null) {#%d
9191
class: "Symfony\Component\VarDumper\Tests\Dumper\CliDumperTest"
9292
this: Symfony\Component\VarDumper\Tests\Dumper\CliDumperTest {#%d …}
9393
file: "%s%eTests%eFixtures%edumb-var.php"

‎src/Symfony/Component/VarDumper/Tests/Dumper/HtmlDumperTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/VarDumper/Tests/Dumper/HtmlDumperTest.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public function testGet()
8383
+<span class=sf-dump-public title="Public property">foo</span>: "<span class=sf-dump-str title="3 characters">foo</span>"
8484
+"<span class=sf-dump-public title="Runtime added dynamic property">bar</span>": "<span class=sf-dump-str title="3 characters">bar</span>"
8585
</samp>}
86-
"<span class=sf-dump-key>closure</span>" => <span class=sf-dump-note>Closure(\$a, PDO &amp;\$b = null)</span> {<a class=sf-dump-ref>#%d</a><samp data-depth=2 class=sf-dump-compact>
86+
"<span class=sf-dump-key>closure</span>" => <span class=sf-dump-note>Closure(\$a, ?PDO &amp;\$b = null)</span> {<a class=sf-dump-ref>#%d</a><samp data-depth=2 class=sf-dump-compact>
8787
<span class=sf-dump-meta>class</span>: "<span class=sf-dump-str title="Symfony\Component\VarDumper\Tests\Dumper\HtmlDumperTest
8888
55 characters"><span class="sf-dump-ellipsis sf-dump-ellipsis-class">Symfony\Component\VarDumper\Tests\Dumper</span><span class="sf-dump-ellipsis sf-dump-ellipsis-class">\</span>HtmlDumperTest</span>"
8989
<span class=sf-dump-meta>this</span>: <span class=sf-dump-note title="Symfony\Component\VarDumper\Tests\Dumper\HtmlDumperTest

‎src/Symfony/Component/VarDumper/Tests/Dumper/functions/dump_data_collector_with_spl_array.phpt

Copy file name to clipboardExpand all lines: src/Symfony/Component/VarDumper/Tests/Dumper/functions/dump_data_collector_with_spl_array.phpt
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ use Symfony\Component\HttpKernel\DataCollector\DumpDataCollector;
1414
use Symfony\Component\VarDumper\Cloner\VarCloner;
1515
use Symfony\Component\VarDumper\VarDumper;
1616

17-
VarDumper::setHandler(function ($var, string $label = null) {
17+
VarDumper::setHandler(function ($var, ?string $label = null) {
1818
$dumper = new DumpDataCollector();
1919
$cloner = new VarCloner();
20-
$handler = function ($var, string $label = null) use ($dumper, $cloner) {
20+
$handler = function ($var, ?string $label = null) use ($dumper, $cloner) {
2121
$var = $cloner->cloneVar($var);
2222
if (null !== $label) {
2323
$var = $var->withContext(['label' => $label]);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.