Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 988eba1

Browse files
committed
fix tests
1 parent 98bcb91 commit 988eba1

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -323,14 +323,13 @@ protected function instantiateObject(array &$data, $class, array &$context, \Ref
323323
}
324324
} elseif ($allowed && !$ignored && (isset($data[$key]) || array_key_exists($key, $data))) {
325325
$parameterData = $data[$key];
326-
if (null !== $constructorParameter->getType()) {
327-
try {
326+
try {
327+
if (null !== $constructorParameter->getClass()) {
328328
$parameterClass = $constructorParameter->getClass()->getName();
329-
} catch (\ReflectionException $e) {
330-
throw new RuntimeException(sprintf('Could not determine the class of the parameter "%s".', $key), 0, $e);
329+
$parameterData = $this->serializer->deserialize($parameterData, $parameterClass, $format, $context);
331330
}
332-
333-
$parameterData = $this->serializer->deserialize($parameterData, $parameterClass, $format, $context);
331+
} catch (\ReflectionException $e) {
332+
throw new RuntimeException(sprintf('Could not determine the class of the parameter "%s".', $key), 0, $e);
334333
}
335334

336335
// Don't run set for a parameter passed to the constructor

0 commit comments

Comments
 (0)