Skip to content

Commit 3fe9802

Browse files
committed
revert CS
1 parent 5556fa5 commit 3fe9802

File tree

2 files changed

+13
-22
lines changed

2 files changed

+13
-22
lines changed

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

+12-22
Original file line numberDiff line numberDiff line change
@@ -330,11 +330,7 @@ protected function instantiateComplexObject(array &$data, $class, array &$contex
330330

331331
$params = array_merge($params, $data[$paramName]);
332332
}
333-
334-
continue;
335-
}
336-
337-
if ($allowed && !$ignored && (isset($data[$key]) || array_key_exists($key, $data))) {
333+
} elseif ($allowed && !$ignored && (isset($data[$key]) || array_key_exists($key, $data))) {
338334
$parameterData = $data[$key];
339335
if (null !== $constructorParameter->getClass()) {
340336
$parameterData = $this->serializer->deserialize($parameterData, $constructorParameter->getClass()->getName(), $format, $context);
@@ -343,30 +339,24 @@ protected function instantiateComplexObject(array &$data, $class, array &$contex
343339
// Don't run set for a parameter passed to the constructor
344340
$params[] = $parameterData;
345341
unset($data[$key]);
346-
347-
continue;
348-
}
349-
350-
if ($constructorParameter->isDefaultValueAvailable()) {
342+
} elseif ($constructorParameter->isDefaultValueAvailable()) {
351343
$params[] = $constructorParameter->getDefaultValue();
352-
353-
continue;
344+
} else {
345+
throw new RuntimeException(
346+
sprintf(
347+
'Cannot create an instance of %s from serialized data because its constructor requires parameter "%s" to be present.',
348+
$class,
349+
$constructorParameter->name
350+
)
351+
);
354352
}
355-
356-
throw new RuntimeException(
357-
sprintf(
358-
'Cannot create an instance of %s from serialized data because its constructor requires parameter "%s" to be present.',
359-
$class,
360-
$constructorParameter->name
361-
)
362-
);
363353
}
364354

365355
if ($constructor->isConstructor()) {
366356
return $reflectionClass->newInstanceArgs($params);
357+
} else {
358+
return $constructor->invokeArgs(null, $params);
367359
}
368-
369-
return $constructor->invokeArgs(null, $params);
370360
}
371361

372362
return new $class();

src/Symfony/Component/Serializer/composer.json

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"require-dev": {
2222
"symfony/yaml": "~2.8|~3.0",
2323
"symfony/config": "~2.8|~3.0",
24+
"symfony/property-access": "~2.8|~3.0",
2425
"symfony/http-foundation": "~2.8|~3.0",
2526
"symfony/cache": "~3.1",
2627
"symfony/property-info": "~2.8|~3.0",

0 commit comments

Comments
 (0)