Skip to content

Commit 15308f0

Browse files
committed
[Serializer] Simplify AbstractNormalizer::prepareForDenormalization()
1 parent 4ce2211 commit 15308f0

File tree

1 file changed

+1
-13
lines changed

1 file changed

+1
-13
lines changed

Normalizer/AbstractNormalizer.php

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -272,19 +272,7 @@ protected function getAllowedAttributes($classOrObject, array $context, $attribu
272272
*/
273273
protected function prepareForDenormalization($data)
274274
{
275-
if (is_array($data) || is_object($data) && $data instanceof \ArrayAccess) {
276-
$normalizedData = $data;
277-
} elseif (is_object($data)) {
278-
$normalizedData = array();
279-
280-
foreach ($data as $attribute => $value) {
281-
$normalizedData[$attribute] = $value;
282-
}
283-
} else {
284-
$normalizedData = array();
285-
}
286-
287-
return $normalizedData;
275+
return (array) $data;
288276
}
289277

290278
/**

0 commit comments

Comments
 (0)