Skip to content

Commit 33f4d2a

Browse files
committed
minor symfony#54426 stop marking parameters implicitly as nullable (xabbuh)
This PR was merged into the 6.4 branch. Discussion ---------- stop marking parameters implicitly as nullable | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Issues | | License | MIT Commits ------- e44545a stop marking parameters implicitly as nullable
2 parents 72840c1 + e44545a commit 33f4d2a

File tree

13 files changed

+25
-25
lines changed

13 files changed

+25
-25
lines changed

src/Symfony/Bridge/PsrHttpMessage/Tests/Fixtures/ServerRequest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ class ServerRequest extends Message implements ServerRequestInterface
2626
public function __construct(
2727
string $version = '1.1',
2828
array $headers = [],
29-
StreamInterface $body = null,
29+
?StreamInterface $body = null,
3030
private readonly string $requestTarget = '/',
3131
private readonly string $method = 'GET',
32-
UriInterface|string $uri = null,
32+
UriInterface|string|null $uri = null,
3333
private readonly array $server = [],
3434
private readonly array $cookies = [],
3535
private readonly array $query = [],

src/Symfony/Component/DependencyInjection/LazyProxy/PhpDumper/DumperInterface.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ interface DumperInterface
2626
* @param bool|null &$asGhostObject Set to true after the call if the proxy is a ghost object
2727
* @param string|null $id
2828
*/
29-
public function isProxyCandidate(Definition $definition/* , bool &$asGhostObject = null, string $id = null */): bool;
29+
public function isProxyCandidate(Definition $definition/* , ?bool &$asGhostObject = null, ?string $id = null */): bool;
3030

3131
/**
3232
* Generates the code to be used to instantiate a proxy in the dumped factory code.
@@ -38,5 +38,5 @@ public function getProxyFactoryCode(Definition $definition, string $id, string $
3838
*
3939
* @param string|null $id
4040
*/
41-
public function getProxyCode(Definition $definition/* , string $id = null */): string;
41+
public function getProxyCode(Definition $definition/* , ?string $id = null */): string;
4242
}

src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/autowiring_classes.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class Foo
3030
public static int $counter = 0;
3131

3232
#[Required]
33-
public function cloneFoo(\stdClass $bar = null): static
33+
public function cloneFoo(?\stdClass $bar = null): static
3434
{
3535
++self::$counter;
3636

src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/autowiring_classes_80.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ public function __construct(string $arg1, #[AutowireDecorated] AsDecoratorInterf
107107
#[AsDecorator(decorates: \NonExistent::class, onInvalid: ContainerInterface::NULL_ON_INVALID_REFERENCE)]
108108
class AsDecoratorBaz implements AsDecoratorInterface
109109
{
110-
public function __construct(#[AutowireDecorated] AsDecoratorInterface $inner = null)
110+
public function __construct(#[AutowireDecorated] ?AsDecoratorInterface $inner = null)
111111
{
112112
}
113113
}

src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/classes.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public function callPassed()
8383

8484
class DummyProxyDumper implements DumperInterface
8585
{
86-
public function isProxyCandidate(Definition $definition, bool &$asGhostObject = null, string $id = null): bool
86+
public function isProxyCandidate(Definition $definition, ?bool &$asGhostObject = null, ?string $id = null): bool
8787
{
8888
$asGhostObject = false;
8989

src/Symfony/Component/Form/Tests/Fixtures/TranslatableTextAlign.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ enum TranslatableTextAlign implements TranslatableInterface
2020
case Center;
2121
case Right;
2222

23-
public function trans(TranslatorInterface $translator, string $locale = null): string
23+
public function trans(TranslatorInterface $translator, ?string $locale = null): string
2424
{
2525
return $translator->trans($this->name, locale: $locale);
2626
}

src/Symfony/Component/PropertyInfo/Tests/Extractor/PhpDocExtractorTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public function testEmptyParamAnnotation()
8080
/**
8181
* @dataProvider typesWithNoPrefixesProvider
8282
*/
83-
public function testExtractTypesWithNoPrefixes($property, array $type = null)
83+
public function testExtractTypesWithNoPrefixes($property, ?array $type = null)
8484
{
8585
$noPrefixExtractor = new PhpDocExtractor(null, [], [], []);
8686

@@ -202,7 +202,7 @@ public static function provideCollectionTypes()
202202
/**
203203
* @dataProvider typesWithCustomPrefixesProvider
204204
*/
205-
public function testExtractTypesWithCustomPrefixes($property, array $type = null)
205+
public function testExtractTypesWithCustomPrefixes($property, ?array $type = null)
206206
{
207207
$customExtractor = new PhpDocExtractor(null, ['add', 'remove'], ['is', 'can']);
208208

@@ -401,7 +401,7 @@ public function testUnknownPseudoType()
401401
/**
402402
* @dataProvider constructorTypesProvider
403403
*/
404-
public function testExtractConstructorTypes($property, array $type = null)
404+
public function testExtractConstructorTypes($property, ?array $type = null)
405405
{
406406
$this->assertEquals($type, $this->extractor->getTypesFromConstructor('Symfony\Component\PropertyInfo\Tests\Fixtures\ConstructorDummy', $property));
407407
}

src/Symfony/Component/PropertyInfo/Tests/Extractor/PhpStanExtractorTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ protected function setUp(): void
4444
/**
4545
* @dataProvider typesProvider
4646
*/
47-
public function testExtract($property, array $type = null)
47+
public function testExtract($property, ?array $type = null)
4848
{
4949
$this->assertEquals($type, $this->extractor->getTypes('Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy', $property));
5050
}
@@ -75,7 +75,7 @@ public function testInvalid($property)
7575
/**
7676
* @dataProvider typesWithNoPrefixesProvider
7777
*/
78-
public function testExtractTypesWithNoPrefixes($property, array $type = null)
78+
public function testExtractTypesWithNoPrefixes($property, ?array $type = null)
7979
{
8080
$noPrefixExtractor = new PhpStanExtractor([], [], []);
8181

@@ -130,7 +130,7 @@ public static function typesProvider()
130130
/**
131131
* @dataProvider provideCollectionTypes
132132
*/
133-
public function testExtractCollection($property, array $type = null)
133+
public function testExtractCollection($property, ?array $type = null)
134134
{
135135
$this->testExtract($property, $type);
136136
}
@@ -186,7 +186,7 @@ public static function provideCollectionTypes()
186186
/**
187187
* @dataProvider typesWithCustomPrefixesProvider
188188
*/
189-
public function testExtractTypesWithCustomPrefixes($property, array $type = null)
189+
public function testExtractTypesWithCustomPrefixes($property, ?array $type = null)
190190
{
191191
$customExtractor = new PhpStanExtractor(['add', 'remove'], ['is', 'can']);
192192

@@ -344,7 +344,7 @@ public static function propertiesParentTypeProvider(): array
344344
/**
345345
* @dataProvider constructorTypesProvider
346346
*/
347-
public function testExtractConstructorTypes($property, array $type = null)
347+
public function testExtractConstructorTypes($property, ?array $type = null)
348348
{
349349
$this->assertEquals($type, $this->extractor->getTypesFromConstructor('Symfony\Component\PropertyInfo\Tests\Fixtures\ConstructorDummy', $property));
350350
}
@@ -459,7 +459,7 @@ public static function intRangeTypeProvider(): array
459459
/**
460460
* @dataProvider php80TypesProvider
461461
*/
462-
public function testExtractPhp80Type(string $class, $property, array $type = null)
462+
public function testExtractPhp80Type(string $class, $property, ?array $type = null)
463463
{
464464
$this->assertEquals($type, $this->extractor->getTypes($class, $property, []));
465465
}

src/Symfony/Component/Routing/Tests/Fixtures/TraceableAttributeClassLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ final class TraceableAttributeClassLoader extends AttributeClassLoader
2020
/** @var list<string> */
2121
public array $foundClasses = [];
2222

23-
public function load(mixed $class, string $type = null): RouteCollection
23+
public function load(mixed $class, ?string $type = null): RouteCollection
2424
{
2525
if (!is_string($class)) {
2626
throw new \InvalidArgumentException(sprintf('Expected string, got "%s"', get_debug_type($class)));

src/Symfony/Component/Serializer/Tests/Fixtures/FooInterfaceDummyDenormalizer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
final class FooInterfaceDummyDenormalizer implements DenormalizerInterface
1717
{
18-
public function denormalize(mixed $data, string $type, string $format = null, array $context = []): array
18+
public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): array
1919
{
2020
$result = [];
2121
foreach ($data as $foo) {
@@ -27,7 +27,7 @@ public function denormalize(mixed $data, string $type, string $format = null, ar
2727
return $result;
2828
}
2929

30-
public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool
30+
public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool
3131
{
3232
if (str_ends_with($type, '[]')) {
3333
$className = substr($type, 0, -2);

0 commit comments

Comments
 (0)