From a78bb4b0e7120222df525a335d9b48ee81012333 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Niedzielski?= Date: Tue, 8 Oct 2024 10:46:44 +0200 Subject: [PATCH] Introduced normalizers for Generator state --- src/lib/Output/Normalizer/JsonObjectNormalizer.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lib/Output/Normalizer/JsonObjectNormalizer.php b/src/lib/Output/Normalizer/JsonObjectNormalizer.php index 22d7472d..f7b8f0a2 100644 --- a/src/lib/Output/Normalizer/JsonObjectNormalizer.php +++ b/src/lib/Output/Normalizer/JsonObjectNormalizer.php @@ -26,17 +26,17 @@ public function normalize($object, ?string $format = null, array $context = []): { $vars = get_object_vars($object); + $data = []; foreach ($vars as $key => $value) { if ($value instanceof ArrayList) { $name = $value->getName(); - unset($vars[$key]); - $vars[$name] = $this->normalizer->normalize($value, $format, $context); + $data[$name] = $this->normalizer->normalize($value, $format, $context); } else { - $vars[$key] = $this->normalizer->normalize($value, $format, $context); + $data[$key] = $this->normalizer->normalize($value, $format, $context); } } - return $vars; + return $data; } public function supportsNormalization($data, ?string $format = null): bool