diff --git a/Tests/Fixtures/AbstractNormalizerDummy.php b/Tests/Fixtures/AbstractNormalizerDummy.php index ae3b411b..a3d28c6c 100644 --- a/Tests/Fixtures/AbstractNormalizerDummy.php +++ b/Tests/Fixtures/AbstractNormalizerDummy.php @@ -31,14 +31,14 @@ public function getAllowedAttributes($classOrObject, array $context, bool $attri /** * {@inheritdoc} */ - public function normalize($object, string $format = null, array $context = []) + public function normalize($object, ?string $format = null, array $context = []) { } /** * {@inheritdoc} */ - public function supportsNormalization($data, string $format = null): bool + public function supportsNormalization($data, ?string $format = null): bool { return true; } @@ -46,14 +46,14 @@ public function supportsNormalization($data, string $format = null): bool /** * {@inheritdoc} */ - public function denormalize($data, string $type, string $format = null, array $context = []) + public function denormalize($data, string $type, ?string $format = null, array $context = []) { } /** * {@inheritdoc} */ - public function supportsDenormalization($data, string $type, string $format = null): bool + public function supportsDenormalization($data, string $type, ?string $format = null): bool { return true; } diff --git a/Tests/Fixtures/DenormalizableDummy.php b/Tests/Fixtures/DenormalizableDummy.php index e7c03e3d..3170e361 100644 --- a/Tests/Fixtures/DenormalizableDummy.php +++ b/Tests/Fixtures/DenormalizableDummy.php @@ -16,7 +16,7 @@ class DenormalizableDummy implements DenormalizableInterface { - public function denormalize(DenormalizerInterface $denormalizer, $data, string $format = null, array $context = []) + public function denormalize(DenormalizerInterface $denormalizer, $data, ?string $format = null, array $context = []) { } } diff --git a/Tests/Fixtures/Dummy.php b/Tests/Fixtures/Dummy.php index da040059..db09a40b 100644 --- a/Tests/Fixtures/Dummy.php +++ b/Tests/Fixtures/Dummy.php @@ -23,7 +23,7 @@ class Dummy implements NormalizableInterface, DenormalizableInterface public $baz; public $qux; - public function normalize(NormalizerInterface $normalizer, string $format = null, array $context = []) + public function normalize(NormalizerInterface $normalizer, ?string $format = null, array $context = []) { return [ 'foo' => $this->foo, @@ -33,7 +33,7 @@ public function normalize(NormalizerInterface $normalizer, string $format = null ]; } - public function denormalize(DenormalizerInterface $denormalizer, $data, string $format = null, array $context = []) + public function denormalize(DenormalizerInterface $denormalizer, $data, ?string $format = null, array $context = []) { $this->foo = $data['foo']; $this->bar = $data['bar']; diff --git a/Tests/Fixtures/DummyString.php b/Tests/Fixtures/DummyString.php index 056de300..4a4bef8a 100644 --- a/Tests/Fixtures/DummyString.php +++ b/Tests/Fixtures/DummyString.php @@ -22,7 +22,7 @@ class DummyString implements DenormalizableInterface /** @var string $value */ public $value; - public function denormalize(DenormalizerInterface $denormalizer, $data, string $format = null, array $context = []) + public function denormalize(DenormalizerInterface $denormalizer, $data, ?string $format = null, array $context = []) { $this->value = $data; } diff --git a/Tests/Fixtures/EnvelopeNormalizer.php b/Tests/Fixtures/EnvelopeNormalizer.php index 1492d5d0..f321d55a 100644 --- a/Tests/Fixtures/EnvelopeNormalizer.php +++ b/Tests/Fixtures/EnvelopeNormalizer.php @@ -20,7 +20,7 @@ class EnvelopeNormalizer implements NormalizerInterface { private $serializer; - public function normalize($envelope, string $format = null, array $context = []): array + public function normalize($envelope, ?string $format = null, array $context = []): array { $xmlContent = $this->serializer->serialize($envelope->message, 'xml'); @@ -31,7 +31,7 @@ public function normalize($envelope, string $format = null, array $context = []) ]; } - public function supportsNormalization($data, string $format = null, array $context = []): bool + public function supportsNormalization($data, ?string $format = null, array $context = []): bool { return $data instanceof EnvelopeObject; } diff --git a/Tests/Fixtures/EnvelopedMessageNormalizer.php b/Tests/Fixtures/EnvelopedMessageNormalizer.php index dfdec91b..68a5b947 100644 --- a/Tests/Fixtures/EnvelopedMessageNormalizer.php +++ b/Tests/Fixtures/EnvelopedMessageNormalizer.php @@ -18,14 +18,14 @@ */ class EnvelopedMessageNormalizer implements NormalizerInterface { - public function normalize($message, string $format = null, array $context = []): array + public function normalize($message, ?string $format = null, array $context = []): array { return [ 'text' => $message->text, ]; } - public function supportsNormalization($data, string $format = null, array $context = []): bool + public function supportsNormalization($data, ?string $format = null, array $context = []): bool { return $data instanceof EnvelopedMessage; } diff --git a/Tests/Fixtures/NormalizableTraversableDummy.php b/Tests/Fixtures/NormalizableTraversableDummy.php index 55b4402b..26bbae37 100644 --- a/Tests/Fixtures/NormalizableTraversableDummy.php +++ b/Tests/Fixtures/NormalizableTraversableDummy.php @@ -18,7 +18,7 @@ class NormalizableTraversableDummy extends TraversableDummy implements NormalizableInterface, DenormalizableInterface { - public function normalize(NormalizerInterface $normalizer, string $format = null, array $context = []) + public function normalize(NormalizerInterface $normalizer, ?string $format = null, array $context = []) { return [ 'foo' => 'normalizedFoo', @@ -26,7 +26,7 @@ public function normalize(NormalizerInterface $normalizer, string $format = null ]; } - public function denormalize(DenormalizerInterface $denormalizer, $data, string $format = null, array $context = []) + public function denormalize(DenormalizerInterface $denormalizer, $data, ?string $format = null, array $context = []) { return [ 'foo' => 'denormalizedFoo', diff --git a/Tests/Fixtures/NotNormalizableDummy.php b/Tests/Fixtures/NotNormalizableDummy.php index 8bb655db..86ee6dbe 100644 --- a/Tests/Fixtures/NotNormalizableDummy.php +++ b/Tests/Fixtures/NotNormalizableDummy.php @@ -24,7 +24,7 @@ public function __construct() { } - public function denormalize(DenormalizerInterface $denormalizer, $data, string $format = null, array $context = []) + public function denormalize(DenormalizerInterface $denormalizer, $data, ?string $format = null, array $context = []) { throw new NotNormalizableValueException(); } diff --git a/Tests/Fixtures/ScalarDummy.php b/Tests/Fixtures/ScalarDummy.php index ffe4ee65..0704db31 100644 --- a/Tests/Fixtures/ScalarDummy.php +++ b/Tests/Fixtures/ScalarDummy.php @@ -21,12 +21,12 @@ class ScalarDummy implements NormalizableInterface, DenormalizableInterface public $foo; public $xmlFoo; - public function normalize(NormalizerInterface $normalizer, string $format = null, array $context = []) + public function normalize(NormalizerInterface $normalizer, ?string $format = null, array $context = []) { return 'xml' === $format ? $this->xmlFoo : $this->foo; } - public function denormalize(DenormalizerInterface $denormalizer, $data, string $format = null, array $context = []) + public function denormalize(DenormalizerInterface $denormalizer, $data, ?string $format = null, array $context = []) { if ('xml' === $format) { $this->xmlFoo = $data; diff --git a/Tests/Normalizer/AbstractObjectNormalizerTest.php b/Tests/Normalizer/AbstractObjectNormalizerTest.php index 5adc3d4e..5243eb2f 100644 --- a/Tests/Normalizer/AbstractObjectNormalizerTest.php +++ b/Tests/Normalizer/AbstractObjectNormalizerTest.php @@ -559,12 +559,12 @@ public function testProvidingContextCacheKeyGeneratesSameChildContextCacheKey() $normalizer = new class() extends AbstractObjectNormalizerDummy { public $childContextCacheKey; - protected function extractAttributes(object $object, string $format = null, array $context = []): array + protected function extractAttributes(object $object, ?string $format = null, array $context = []): array { return array_keys((array) $object); } - protected function getAttributeValue(object $object, string $attribute, string $format = null, array $context = []) + protected function getAttributeValue(object $object, string $attribute, ?string $format = null, array $context = []) { return $object->{$attribute}; } @@ -599,12 +599,12 @@ public function testChildContextKeepsOriginalContextCacheKey() $normalizer = new class() extends AbstractObjectNormalizerDummy { public $childContextCacheKey; - protected function extractAttributes(object $object, string $format = null, array $context = []): array + protected function extractAttributes(object $object, ?string $format = null, array $context = []): array { return array_keys((array) $object); } - protected function getAttributeValue(object $object, string $attribute, string $format = null, array $context = []) + protected function getAttributeValue(object $object, string $attribute, ?string $format = null, array $context = []) { return $object->{$attribute}; } @@ -634,12 +634,12 @@ public function testChildContextCacheKeyStaysFalseWhenOriginalCacheKeyIsFalse() $normalizer = new class() extends AbstractObjectNormalizerDummy { public $childContextCacheKey; - protected function extractAttributes(object $object, string $format = null, array $context = []): array + protected function extractAttributes(object $object, ?string $format = null, array $context = []): array { return array_keys((array) $object); } - protected function getAttributeValue(object $object, string $attribute, string $format = null, array $context = []) + protected function getAttributeValue(object $object, string $attribute, ?string $format = null, array $context = []) { return $object->{$attribute}; }