Skip to content

Commit 66d13dc

Browse files
committed
Merge branch '6.4' into 7.0
* 6.4: Make more nullable types explicit Add more explicit nullable types for default null values
2 parents 7d2f94d + 95bd270 commit 66d13dc

File tree

8 files changed

+9
-9
lines changed

8 files changed

+9
-9
lines changed

Caster/ReflectionCaster.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ public static function getSignature(array $a): string
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).' ';

Tests/Caster/StubCasterTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ public function testClassStub()
155155

156156
$expectedDump = <<<'EODUMP'
157157
<foo></foo><bar><span class=sf-dump-note>array:1</span> [<samp data-depth=1 class=sf-dump-expanded>
158-
<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>"
158+
<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>"
159159
</samp>]
160160
</bar>
161161
EODUMP;

Tests/Dumper/CliDumperTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public function testGet()
9090
+foo: ""…3
9191
+"bar": "bar"
9292
}
93-
"closure" => Closure(\$a, PDO &\$b = null) {#%d
93+
"closure" => Closure(\$a, ?PDO &\$b = null) {#%d
9494
class: "Symfony\Component\VarDumper\Tests\Dumper\CliDumperTest"
9595
this: Symfony\Component\VarDumper\Tests\Dumper\CliDumperTest {#%d …}
9696
file: "%s%eTests%eFixtures%edumb-var.php"

Tests/Dumper/HtmlDumperTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public function testGet()
8484
+<span class=sf-dump-public title="Public property">foo</span>: "<span class=sf-dump-str title="3 characters">foo</span>"
8585
+"<span class=sf-dump-public title="Runtime added dynamic property">bar</span>": "<span class=sf-dump-str title="3 characters">bar</span>"
8686
</samp>}
87-
"<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>
87+
"<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>
8888
<span class=sf-dump-meta>class</span>: "<span class=sf-dump-str title="Symfony\Component\VarDumper\Tests\Dumper\HtmlDumperTest
8989
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>"
9090
<span class=sf-dump-meta>this</span>: <span class=sf-dump-note title="Symfony\Component\VarDumper\Tests\Dumper\HtmlDumperTest

Tests/Dumper/functions/dump_data_collector_with_spl_array.phpt

Lines 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]);

Tests/Fixtures/FooInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ interface FooInterface
77
/**
88
* Hello.
99
*/
10-
public function foo(?\stdClass $a, \stdClass $b = null);
10+
public function foo(?\stdClass $a, ?\stdClass $b = null);
1111
}

Tests/Fixtures/Twig.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class __TwigTemplate_VarDumperFixture_u75a09 extends AbstractTwigTemplate
1818
{
1919
private $path;
2020

21-
public function __construct(Twig\Environment $env = null, $path = null)
21+
public function __construct(?Twig\Environment $env = null, $path = null)
2222
{
2323
if (null !== $env) {
2424
parent::__construct($env);

Tests/Fixtures/dumb-var.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class DumbFoo
3131
'[]' => [],
3232
'res' => $g,
3333
'obj' => $foo,
34-
'closure' => function ($a, \PDO &$b = null) {},
34+
'closure' => function ($a, ?\PDO &$b = null) {},
3535
'line' => __LINE__ - 1,
3636
'nobj' => [(object) []],
3737
];

0 commit comments

Comments
 (0)