Skip to content

Commit 7058c7a

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 d4a097f + 978c155 commit 7058c7a

10 files changed

+23
-23
lines changed

Tests/Fixtures/AbstractNormalizerDummy.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,20 @@ public function getAllowedAttributes(string|object $classOrObject, array $contex
3030
return parent::getAllowedAttributes($classOrObject, $context, $attributesAsString);
3131
}
3232

33-
public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null
33+
public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null
3434
{
3535
}
3636

37-
public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool
37+
public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool
3838
{
3939
return true;
4040
}
4141

42-
public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed
42+
public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed
4343
{
4444
}
4545

46-
public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool
46+
public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool
4747
{
4848
return true;
4949
}

Tests/Fixtures/DenormalizableDummy.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
class DenormalizableDummy implements DenormalizableInterface
1818
{
19-
public function denormalize(DenormalizerInterface $denormalizer, array|string|int|float|bool $data, string $format = null, array $context = []): void
19+
public function denormalize(DenormalizerInterface $denormalizer, array|string|int|float|bool $data, ?string $format = null, array $context = []): void
2020
{
2121
}
2222
}

Tests/Fixtures/Dummy.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class Dummy implements NormalizableInterface, DenormalizableInterface
2323
public $baz;
2424
public $qux;
2525

26-
public function normalize(NormalizerInterface $normalizer, string $format = null, array $context = []): array|string|int|float|bool
26+
public function normalize(NormalizerInterface $normalizer, ?string $format = null, array $context = []): array|string|int|float|bool
2727
{
2828
return [
2929
'foo' => $this->foo,
@@ -33,7 +33,7 @@ public function normalize(NormalizerInterface $normalizer, string $format = null
3333
];
3434
}
3535

36-
public function denormalize(DenormalizerInterface $denormalizer, array|string|int|float|bool $data, string $format = null, array $context = []): void
36+
public function denormalize(DenormalizerInterface $denormalizer, array|string|int|float|bool $data, ?string $format = null, array $context = []): void
3737
{
3838
$this->foo = $data['foo'];
3939
$this->bar = $data['bar'];

Tests/Fixtures/DummyString.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class DummyString implements DenormalizableInterface
2222
/** @var string $value */
2323
public $value;
2424

25-
public function denormalize(DenormalizerInterface $denormalizer, $data, string $format = null, array $context = []): void
25+
public function denormalize(DenormalizerInterface $denormalizer, $data, ?string $format = null, array $context = []): void
2626
{
2727
$this->value = $data;
2828
}

Tests/Fixtures/EnvelopeNormalizer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class EnvelopeNormalizer implements NormalizerInterface
2020
{
2121
private $serializer;
2222

23-
public function normalize($envelope, string $format = null, array $context = []): array
23+
public function normalize($envelope, ?string $format = null, array $context = []): array
2424
{
2525
$xmlContent = $this->serializer->serialize($envelope->message, 'xml');
2626

@@ -38,7 +38,7 @@ public function getSupportedTypes(?string $format): array
3838
];
3939
}
4040

41-
public function supportsNormalization($data, string $format = null, array $context = []): bool
41+
public function supportsNormalization($data, ?string $format = null, array $context = []): bool
4242
{
4343
return $data instanceof EnvelopeObject;
4444
}

Tests/Fixtures/EnvelopedMessageNormalizer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919
class EnvelopedMessageNormalizer implements NormalizerInterface
2020
{
21-
public function normalize($message, string $format = null, array $context = []): array
21+
public function normalize($message, ?string $format = null, array $context = []): array
2222
{
2323
return [
2424
'text' => $message->text,
@@ -32,7 +32,7 @@ public function getSupportedTypes(?string $format): array
3232
];
3333
}
3434

35-
public function supportsNormalization($data, string $format = null, array $context = []): bool
35+
public function supportsNormalization($data, ?string $format = null, array $context = []): bool
3636
{
3737
return $data instanceof EnvelopedMessage;
3838
}

Tests/Fixtures/NormalizableTraversableDummy.php

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

1919
class NormalizableTraversableDummy extends TraversableDummy implements NormalizableInterface, DenormalizableInterface
2020
{
21-
public function normalize(NormalizerInterface $normalizer, string $format = null, array $context = []): array|string|int|float|bool
21+
public function normalize(NormalizerInterface $normalizer, ?string $format = null, array $context = []): array|string|int|float|bool
2222
{
2323
return [
2424
'foo' => 'normalizedFoo',
2525
'bar' => 'normalizedBar',
2626
];
2727
}
2828

29-
public function denormalize(DenormalizerInterface $denormalizer, array|string|int|float|bool $data, string $format = null, array $context = []): void
29+
public function denormalize(DenormalizerInterface $denormalizer, array|string|int|float|bool $data, ?string $format = null, array $context = []): void
3030
{
3131
}
3232
}

Tests/Fixtures/NotNormalizableDummy.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public function __construct()
2424
{
2525
}
2626

27-
public function denormalize(DenormalizerInterface $denormalizer, $data, string $format = null, array $context = []): void
27+
public function denormalize(DenormalizerInterface $denormalizer, $data, ?string $format = null, array $context = []): void
2828
{
2929
throw new NotNormalizableValueException();
3030
}

Tests/Fixtures/ScalarDummy.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ class ScalarDummy implements NormalizableInterface, DenormalizableInterface
2121
public $foo;
2222
public $xmlFoo;
2323

24-
public function normalize(NormalizerInterface $normalizer, string $format = null, array $context = []): array|string|int|float|bool
24+
public function normalize(NormalizerInterface $normalizer, ?string $format = null, array $context = []): array|string|int|float|bool
2525
{
2626
return 'xml' === $format ? $this->xmlFoo : $this->foo;
2727
}
2828

29-
public function denormalize(DenormalizerInterface $denormalizer, array|string|int|float|bool $data, string $format = null, array $context = []): void
29+
public function denormalize(DenormalizerInterface $denormalizer, array|string|int|float|bool $data, ?string $format = null, array $context = []): void
3030
{
3131
if ('xml' === $format) {
3232
$this->xmlFoo = $data;

Tests/Normalizer/AbstractObjectNormalizerTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -926,12 +926,12 @@ public function testProvidingContextCacheKeyGeneratesSameChildContextCacheKey()
926926
$normalizer = new class() extends AbstractObjectNormalizerDummy {
927927
public $childContextCacheKey;
928928

929-
protected function extractAttributes(object $object, string $format = null, array $context = []): array
929+
protected function extractAttributes(object $object, ?string $format = null, array $context = []): array
930930
{
931931
return array_keys((array) $object);
932932
}
933933

934-
protected function getAttributeValue(object $object, string $attribute, string $format = null, array $context = []): mixed
934+
protected function getAttributeValue(object $object, string $attribute, ?string $format = null, array $context = []): mixed
935935
{
936936
return $object->{$attribute};
937937
}
@@ -966,12 +966,12 @@ public function testChildContextKeepsOriginalContextCacheKey()
966966
$normalizer = new class() extends AbstractObjectNormalizerDummy {
967967
public $childContextCacheKey;
968968

969-
protected function extractAttributes(object $object, string $format = null, array $context = []): array
969+
protected function extractAttributes(object $object, ?string $format = null, array $context = []): array
970970
{
971971
return array_keys((array) $object);
972972
}
973973

974-
protected function getAttributeValue(object $object, string $attribute, string $format = null, array $context = []): mixed
974+
protected function getAttributeValue(object $object, string $attribute, ?string $format = null, array $context = []): mixed
975975
{
976976
return $object->{$attribute};
977977
}
@@ -1001,12 +1001,12 @@ public function testChildContextCacheKeyStaysFalseWhenOriginalCacheKeyIsFalse()
10011001
$normalizer = new class() extends AbstractObjectNormalizerDummy {
10021002
public $childContextCacheKey;
10031003

1004-
protected function extractAttributes(object $object, string $format = null, array $context = []): array
1004+
protected function extractAttributes(object $object, ?string $format = null, array $context = []): array
10051005
{
10061006
return array_keys((array) $object);
10071007
}
10081008

1009-
protected function getAttributeValue(object $object, string $attribute, string $format = null, array $context = []): mixed
1009+
protected function getAttributeValue(object $object, string $attribute, ?string $format = null, array $context = []): mixed
10101010
{
10111011
return $object->{$attribute};
10121012
}

0 commit comments

Comments
 (0)