From 23fd2eb2cf4e1eeb15c8075d26cb4fe1f11a0e51 Mon Sep 17 00:00:00 2001 From: Daniel Rotter Date: Thu, 12 Dec 2024 16:14:42 +0100 Subject: [PATCH] Add template parameter to avoid necessity to assert data in normalize --- .../Serializer/Normalizer/NormalizerInterface.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/Serializer/Normalizer/NormalizerInterface.php b/src/Symfony/Component/Serializer/Normalizer/NormalizerInterface.php index bbc8a94e79da6..e60b24c5d3ba4 100644 --- a/src/Symfony/Component/Serializer/Normalizer/NormalizerInterface.php +++ b/src/Symfony/Component/Serializer/Normalizer/NormalizerInterface.php @@ -18,13 +18,15 @@ /** * @author Jordi Boggiano + * + * @template TData */ interface NormalizerInterface { /** * Normalizes data into a set of arrays/scalars. * - * @param mixed $data Data to normalize + * @param TData $data Data to normalize * @param string|null $format Format the normalization result will be encoded as * @param array $context Context options for the normalizer * @@ -41,8 +43,8 @@ public function normalize(mixed $data, ?string $format = null, array $context = /** * Checks whether the given class is supported for normalization by this normalizer. * - * @param mixed $data Data to normalize - * @param string|null $format The format being (de-)serialized from or into + * @param TData|mixed $data Data to normalize + * @param string|null $format The format being (de-)serialized from or into */ public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool;