Skip to content

Commit db4f6ba

Browse files
committed
Merge branch '5.4' into 6.4
* 5.4: Make more nullable types explicit Add more explicit nullable types for default null values
2 parents bb6975c + 998fa9d commit db4f6ba

File tree

44 files changed

+92
-72
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+92
-72
lines changed

src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/ConfigurationTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ public function testBaselineFileWriteError()
525525
$this->expectException(\ErrorException::class);
526526
$this->expectExceptionMessageMatches('/[Ff]ailed to open stream: Permission denied/');
527527

528-
set_error_handler(static function (int $errno, string $errstr, string $errfile = null, int $errline = null): bool {
528+
set_error_handler(static function (int $errno, string $errstr, ?string $errfile = null, ?int $errline = null): bool {
529529
if ($errno & (E_WARNING | E_WARNING)) {
530530
throw new \ErrorException($errstr, 0, $errno, $errfile, $errline);
531531
}

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/Cache/Tests/Fixtures/DriverWrapper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function connect(array $params, $username = null, $password = null, array
3232
return $this->driver->connect($params, $username, $password, $driverOptions);
3333
}
3434

35-
public function getDatabasePlatform(ServerVersionProvider $versionProvider = null): AbstractPlatform
35+
public function getDatabasePlatform(?ServerVersionProvider $versionProvider = null): AbstractPlatform
3636
{
3737
return $this->driver->getDatabasePlatform($versionProvider);
3838
}

src/Symfony/Component/DependencyInjection/Tests/Compiler/AutowirePassTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
use Symfony\Component\DependencyInjection\Tests\Fixtures\BarInterface;
3636
use Symfony\Component\DependencyInjection\Tests\Fixtures\CaseSensitiveClass;
3737
use Symfony\Component\DependencyInjection\Tests\Fixtures\includes\FooVariadic;
38+
use Symfony\Component\DependencyInjection\Tests\Fixtures\OptionalParameter;
3839
use Symfony\Component\DependencyInjection\Tests\Fixtures\WithTarget;
3940
use Symfony\Component\DependencyInjection\Tests\Fixtures\WithTargetAnonymous;
4041
use Symfony\Component\DependencyInjection\TypedReference;
@@ -405,6 +406,9 @@ public function testResolveParameter()
405406
$this->assertEquals(Foo::class, $container->getDefinition('bar')->getArgument(0));
406407
}
407408

409+
/**
410+
* @group legacy
411+
*/
408412
public function testOptionalParameter()
409413
{
410414
$container = new ContainerBuilder();

src/Symfony/Component/DependencyInjection/Tests/Fixtures/Bar.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ class Bar implements BarInterface
1515
{
1616
public $quz;
1717

18-
public function __construct($quz = null, \NonExistent $nonExistent = null, BarInterface $decorated = null, array $foo = [], iterable $baz = [])
18+
public function __construct($quz = null, ?\NonExistent $nonExistent = null, ?BarInterface $decorated = null, array $foo = [], iterable $baz = [])
1919
{
2020
$this->quz = $quz;
2121
}
2222

23-
public static function create(\NonExistent $nonExistent = null, $factory = null)
23+
public static function create(?\NonExistent $nonExistent = null, $factory = null)
2424
{
2525
}
2626

src/Symfony/Component/DependencyInjection/Tests/Fixtures/CheckTypeDeclarationsPass/BarMethodCall.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public function setFoosVariadic(Foo $foo, Foo ...$foos)
2020
$this->foo = $foo;
2121
}
2222

23-
public function setFoosOptional(Foo $foo, Foo $fooOptional = null)
23+
public function setFoosOptional(Foo $foo, ?Foo $fooOptional = null)
2424
{
2525
$this->foo = $foo;
2626
}

src/Symfony/Component/DependencyInjection/Tests/Fixtures/CheckTypeDeclarationsPass/BarOptionalArgument.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ class BarOptionalArgument
66
{
77
public $foo;
88

9-
public function __construct(\stdClass $foo = null)
9+
public function __construct(?\stdClass $foo = null)
1010
{
1111
$this->foo = $foo;
1212
}

src/Symfony/Component/DependencyInjection/Tests/Fixtures/CheckTypeDeclarationsPass/Foo.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public static function createBar()
99
return new Bar(new \stdClass());
1010
}
1111

12-
public static function createBarArguments(\stdClass $stdClass, \stdClass $stdClassOptional = null)
12+
public static function createBarArguments(\stdClass $stdClass, ?\stdClass $stdClassOptional = null)
1313
{
1414
return new Bar($stdClass);
1515
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\DependencyInjection\Tests\Fixtures;
13+
14+
use Symfony\Component\DependencyInjection\Tests\Compiler\A;
15+
use Symfony\Component\DependencyInjection\Tests\Compiler\CollisionInterface;
16+
use Symfony\Component\DependencyInjection\Tests\Compiler\Foo;
17+
18+
class OptionalParameter
19+
{
20+
public function __construct(?CollisionInterface $c = null, A $a, ?Foo $f = null)
21+
{
22+
}
23+
}

src/Symfony/Component/DependencyInjection/Tests/Fixtures/Prototype/Foo.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#[When(env: 'dev')]
99
class Foo implements FooInterface, Sub\BarInterface
1010
{
11-
public function __construct($bar = null, iterable $foo = null, object $baz = null)
11+
public function __construct($bar = null, ?iterable $foo = null, ?object $baz = null)
1212
{
1313
}
1414

0 commit comments

Comments
 (0)