From 3697adf91f83516c86b4912c08c28084711ed560 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Wed, 27 Mar 2024 22:24:38 +0100 Subject: [PATCH] stop marking parameters implicitly as nullable --- Tests/Fixtures/FooInterfaceDummyDenormalizer.php | 4 ++-- Tests/Fixtures/FormatAndContextAwareNormalizer.php | 2 +- Tests/Fixtures/StaticConstructorNormalizer.php | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Tests/Fixtures/FooInterfaceDummyDenormalizer.php b/Tests/Fixtures/FooInterfaceDummyDenormalizer.php index a8c45373b..0fa3c8202 100644 --- a/Tests/Fixtures/FooInterfaceDummyDenormalizer.php +++ b/Tests/Fixtures/FooInterfaceDummyDenormalizer.php @@ -15,7 +15,7 @@ final class FooInterfaceDummyDenormalizer implements DenormalizerInterface { - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): array + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): array { $result = []; foreach ($data as $foo) { @@ -27,7 +27,7 @@ public function denormalize(mixed $data, string $type, string $format = null, ar return $result; } - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { if (str_ends_with($type, '[]')) { $className = substr($type, 0, -2); diff --git a/Tests/Fixtures/FormatAndContextAwareNormalizer.php b/Tests/Fixtures/FormatAndContextAwareNormalizer.php index 404228845..428c618a9 100644 --- a/Tests/Fixtures/FormatAndContextAwareNormalizer.php +++ b/Tests/Fixtures/FormatAndContextAwareNormalizer.php @@ -15,7 +15,7 @@ class FormatAndContextAwareNormalizer extends ObjectNormalizer { - protected function isAllowedAttribute($classOrObject, string $attribute, string $format = null, array $context = []): bool + protected function isAllowedAttribute($classOrObject, string $attribute, ?string $format = null, array $context = []): bool { return \in_array($attribute, ['foo', 'bar']) && 'foo_and_bar_included' === $format; } diff --git a/Tests/Fixtures/StaticConstructorNormalizer.php b/Tests/Fixtures/StaticConstructorNormalizer.php index c2e77aa4b..1ba6884bd 100644 --- a/Tests/Fixtures/StaticConstructorNormalizer.php +++ b/Tests/Fixtures/StaticConstructorNormalizer.php @@ -23,17 +23,17 @@ public function getSupportedTypes(?string $format): array return [StaticConstructorDummy::class]; } - protected function extractAttributes(object $object, string $format = null, array $context = []): array + protected function extractAttributes(object $object, ?string $format = null, array $context = []): array { return get_object_vars($object); } - protected function getAttributeValue(object $object, string $attribute, string $format = null, array $context = []): mixed + protected function getAttributeValue(object $object, string $attribute, ?string $format = null, array $context = []): mixed { return $object->$attribute; } - protected function setAttributeValue(object $object, string $attribute, mixed $value, string $format = null, array $context = []): void + protected function setAttributeValue(object $object, string $attribute, mixed $value, ?string $format = null, array $context = []): void { $object->$attribute = $value; }