Skip to content

Commit 884cbab

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 50b490a + 7058c7a commit 884cbab

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
@@ -931,12 +931,12 @@ public function testProvidingContextCacheKeyGeneratesSameChildContextCacheKey()
931931
$normalizer = new class() extends AbstractObjectNormalizerDummy {
932932
public $childContextCacheKey;
933933

934-
protected function extractAttributes(object $object, string $format = null, array $context = []): array
934+
protected function extractAttributes(object $object, ?string $format = null, array $context = []): array
935935
{
936936
return array_keys((array) $object);
937937
}
938938

939-
protected function getAttributeValue(object $object, string $attribute, string $format = null, array $context = []): mixed
939+
protected function getAttributeValue(object $object, string $attribute, ?string $format = null, array $context = []): mixed
940940
{
941941
return $object->{$attribute};
942942
}
@@ -971,12 +971,12 @@ public function testChildContextKeepsOriginalContextCacheKey()
971971
$normalizer = new class() extends AbstractObjectNormalizerDummy {
972972
public $childContextCacheKey;
973973

974-
protected function extractAttributes(object $object, string $format = null, array $context = []): array
974+
protected function extractAttributes(object $object, ?string $format = null, array $context = []): array
975975
{
976976
return array_keys((array) $object);
977977
}
978978

979-
protected function getAttributeValue(object $object, string $attribute, string $format = null, array $context = []): mixed
979+
protected function getAttributeValue(object $object, string $attribute, ?string $format = null, array $context = []): mixed
980980
{
981981
return $object->{$attribute};
982982
}
@@ -1006,12 +1006,12 @@ public function testChildContextCacheKeyStaysFalseWhenOriginalCacheKeyIsFalse()
10061006
$normalizer = new class() extends AbstractObjectNormalizerDummy {
10071007
public $childContextCacheKey;
10081008

1009-
protected function extractAttributes(object $object, string $format = null, array $context = []): array
1009+
protected function extractAttributes(object $object, ?string $format = null, array $context = []): array
10101010
{
10111011
return array_keys((array) $object);
10121012
}
10131013

1014-
protected function getAttributeValue(object $object, string $attribute, string $format = null, array $context = []): mixed
1014+
protected function getAttributeValue(object $object, string $attribute, ?string $format = null, array $context = []): mixed
10151015
{
10161016
return $object->{$attribute};
10171017
}

0 commit comments

Comments
 (0)