You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/Symfony/Component/Serializer/Serializer.php
+4Lines changed: 4 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -168,6 +168,10 @@ public function normalize($data, string $format = null, array $context = [])
168
168
if (is_countable($data) && 0 === \count($data)) {
169
169
switch (true) {
170
170
case ($context[AbstractObjectNormalizer::PRESERVE_EMPTY_OBJECTS] ?? false) && \is_object($data):
171
+
if (!$datainstanceof \ArrayObject) {
172
+
trigger_deprecation('symfony/serializer', '5.4', 'Returning empty object of class "%s" from "%s()" is deprecated. This class should extend "ArrayObject".', get_debug_type($data), __METHOD__);
173
+
}
174
+
171
175
return$data;
172
176
case ($context[self::EMPTY_ARRAY_AS_OBJECT] ?? false) && \is_array($data):
0 commit comments