From b0cb08a07da802b462ac9db7a0676f82cb5dbeba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Fri, 2 Jan 2026 15:10:48 +0100 Subject: [PATCH] Add `getSupportedTypes` and update method signatures in test normalizers --- .../Tests/Serializer/Normalizer/UserNormalizerTest.php | 5 +++++ .../Serializer/Normalizer/PersonJsonNormalizerTest.php | 9 +++++++-- .../tests/Serializer/Normalizer/MotiveNormalizerTest.php | 7 ++++++- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Tests/Serializer/Normalizer/UserNormalizerTest.php b/src/Bundle/ChillMainBundle/Tests/Serializer/Normalizer/UserNormalizerTest.php index a5dadf83e..5fa53d12f 100644 --- a/src/Bundle/ChillMainBundle/Tests/Serializer/Normalizer/UserNormalizerTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Serializer/Normalizer/UserNormalizerTest.php @@ -61,6 +61,11 @@ final class UserNormalizerTest extends TestCase { return true; } + + public function getSupportedTypes(?string $format): array + { + return []; + } }); $this->assertEquals($expected, $normalizer->normalize($user, $format, $context)); diff --git a/src/Bundle/ChillPersonBundle/Tests/Serializer/Normalizer/PersonJsonNormalizerTest.php b/src/Bundle/ChillPersonBundle/Tests/Serializer/Normalizer/PersonJsonNormalizerTest.php index 41aadf4fb..d61ce7a47 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Serializer/Normalizer/PersonJsonNormalizerTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Serializer/Normalizer/PersonJsonNormalizerTest.php @@ -145,12 +145,12 @@ final class PersonJsonNormalizerTest extends TestCase // Inner normalizer that echoes values or simple conversions $inner = new class () implements NormalizerInterface { - public function supportsNormalization($data, $format = null): bool + public function supportsNormalization($data, $format = null, array $context = []): bool { return true; } - public function normalize($object, $format = null, array $context = []) + public function normalize($object, $format = null, array $context = []): float|int|bool|\ArrayObject|array|string|null { // For scalars and arrays, return as-is; for objects, return string or id when possible if (\is_scalar($object) || null === $object) { @@ -169,6 +169,11 @@ final class PersonJsonNormalizerTest extends TestCase // default stub return (string) (method_exists($object, 'getId') ? $object->getId() : 'normalized'); } + + public function getSupportedTypes(?string $format): array + { + return []; + } }; $normalizer->setNormalizer($inner); diff --git a/src/Bundle/ChillTicketBundle/tests/Serializer/Normalizer/MotiveNormalizerTest.php b/src/Bundle/ChillTicketBundle/tests/Serializer/Normalizer/MotiveNormalizerTest.php index 1d9ecd10a..fdfc00fdc 100644 --- a/src/Bundle/ChillTicketBundle/tests/Serializer/Normalizer/MotiveNormalizerTest.php +++ b/src/Bundle/ChillTicketBundle/tests/Serializer/Normalizer/MotiveNormalizerTest.php @@ -145,10 +145,15 @@ final class MotiveNormalizerTest extends TestCase return ['normalized']; } - public function supportsNormalization($data, ?string $format = null): bool + public function supportsNormalization($data, ?string $format = null, array $context = []): bool { return true; } + + public function getSupportedTypes(?string $format): array + { + return []; + } }; } }