From e21f236c8f24994b6d2c1b13d60729e11632860d Mon Sep 17 00:00:00 2001 From: Dispositif Date: Sun, 14 Jun 2020 02:10:06 +0200 Subject: [PATCH] Add compatible type-hinting Declaration must be compatible with NormalizerInterface --- serializer/custom_normalizer.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/serializer/custom_normalizer.rst b/serializer/custom_normalizer.rst index 9f2e50fdcf1..9893db60488 100644 --- a/serializer/custom_normalizer.rst +++ b/serializer/custom_normalizer.rst @@ -35,7 +35,7 @@ to customize the normalized data. To do that, leverage the ``ObjectNormalizer``: $this->normalizer = $normalizer; } - public function normalize($topic, $format = null, array $context = []) + public function normalize($topic, string $format = null, array $context = []) { $data = $this->normalizer->normalize($topic, $format, $context); @@ -47,7 +47,7 @@ to customize the normalized data. To do that, leverage the ``ObjectNormalizer``: return $data; } - public function supportsNormalization($data, $format = null, array $context = []) + public function supportsNormalization($data, string $format = null, array $context = []) { return $data instanceof Topic; }