From 511bbe53142b50bc299c74e8ad3d1ac3357ac8b8 Mon Sep 17 00:00:00 2001 From: Joe Corall Date: Mon, 28 Oct 2024 12:47:01 -0400 Subject: [PATCH] moar normalizer compatability --- src/Normalizer/FieldItemNormalizer.php | 2 +- src/Normalizer/FieldNormalizer.php | 2 +- src/Normalizer/FileEntityNormalizer.php | 2 +- src/Normalizer/NormalizerBase.php | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Normalizer/FieldItemNormalizer.php b/src/Normalizer/FieldItemNormalizer.php index 276652a..1922297 100644 --- a/src/Normalizer/FieldItemNormalizer.php +++ b/src/Normalizer/FieldItemNormalizer.php @@ -138,7 +138,7 @@ public function normalize($field_item, $format = NULL, array $context = []): arr /** * {@inheritdoc} */ - public function denormalize($data, $class, $format = NULL, array $context = []) { + public function denormalize(mixed $data, string $class, ?string $format = NULL, array $context = []) : mixed { if (!isset($context['target_instance'])) { throw new InvalidArgumentException('$context[\'target_instance\'] must be set to denormalize with the FieldItemNormalizer'); diff --git a/src/Normalizer/FieldNormalizer.php b/src/Normalizer/FieldNormalizer.php index 39c4d17..96153c3 100644 --- a/src/Normalizer/FieldNormalizer.php +++ b/src/Normalizer/FieldNormalizer.php @@ -62,7 +62,7 @@ public function normalize($field, $format = NULL, array $context = []): array|bo /** * {@inheritdoc} */ - public function denormalize($data, $class, $format = NULL, array $context = []) { + public function denormalize(mixed $data, string $class, ?string $format = NULL, array $context = []) : mixed { if (!isset($context['target_instance'])) { throw new InvalidArgumentException('$context[\'target_instance\'] must be set to denormalize with the FieldNormalizer'); diff --git a/src/Normalizer/FileEntityNormalizer.php b/src/Normalizer/FileEntityNormalizer.php index 5a4d40d..9d7cc74 100644 --- a/src/Normalizer/FileEntityNormalizer.php +++ b/src/Normalizer/FileEntityNormalizer.php @@ -79,7 +79,7 @@ public function normalize($entity, $format = NULL, array $context = []): array|b /** * {@inheritdoc} */ - public function denormalize($data, $class, $format = NULL, array $context = []) { + public function denormalize(mixed $data, string $class, ?string $format = NULL, array $context = []) : mixed { $file_data = (string) $this->httpClient->get($data['uri'][0]['value'])->getBody(); diff --git a/src/Normalizer/NormalizerBase.php b/src/Normalizer/NormalizerBase.php index 65802fb..64c794c 100644 --- a/src/Normalizer/NormalizerBase.php +++ b/src/Normalizer/NormalizerBase.php @@ -20,7 +20,7 @@ abstract class NormalizerBase extends SerializationNormalizerBase implements Den /** * {@inheritdoc} */ - public function supportsNormalization($data, string $format = NULL, array $context = []): bool { + public function supportsNormalization(mixed $data, ?string $format = NULL, array $context = []): bool { return in_array($format, $this->formats) && parent::supportsNormalization($data, $format); } @@ -28,7 +28,7 @@ public function supportsNormalization($data, string $format = NULL, array $conte /** * {@inheritdoc} */ - public function supportsDenormalization($data, string $type, string $format = NULL, array $context = []): bool { + public function supportsDenormalization($data, string $type, ?string $format = NULL, array $context = []): bool { if (in_array($format, $this->formats) && (class_exists($this->supportedInterfaceOrClass) || interface_exists($this->supportedInterfaceOrClass))) { $target = new \ReflectionClass($type);