Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 7b5d55d

Browse filesBrowse files
committed
Prevent BC in instantiateObject
1 parent e437e04 commit 7b5d55d
Copy full SHA for 7b5d55d

File tree

Expand file treeCollapse file tree

3 files changed

+5
-14
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+5
-14
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php
+3-12Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -268,17 +268,6 @@ protected function getConstructor(array &$data, $class, array &$context, \Reflec
268268
return $reflectionClass->getConstructor();
269269
}
270270

271-
/**
272-
* @see instantiateComplexObject
273-
* @deprecated Since 3.1, will be removed in 4.0. Use instantiateComplexObject instead.
274-
*/
275-
protected function instantiateObject(array &$data, $class, array &$context, \ReflectionClass $reflectionClass, $allowedAttributes)
276-
{
277-
@trigger_error(sprintf('"%s()" has been deprecated since Symfony 3.1 and will be removed in version 4.0. Use "%s::instantiateComplexObject()" instead.', __METHOD__, __CLASS__), E_USER_DEPRECATED);
278-
279-
return $this->instantiateComplexObject($data, $class, $context, $reflectionClass, $allowedAttributes);
280-
}
281-
282271
/**
283272
* Instantiates an object using constructor parameters when needed.
284273
*
@@ -298,8 +287,10 @@ protected function instantiateObject(array &$data, $class, array &$context, \Ref
298287
*
299288
* @throws RuntimeException
300289
*/
301-
protected function instantiateComplexObject(array &$data, $class, array &$context, \ReflectionClass $reflectionClass, $allowedAttributes, $format = null)
290+
protected function instantiateObject(array &$data, $class, array &$context, \ReflectionClass $reflectionClass, $allowedAttributes/*, $format = null*/)
302291
{
292+
$format = func_num_args() >= 6 ? func_get_arg(5) : null;
293+
303294
if (
304295
isset($context[static::OBJECT_TO_POPULATE]) &&
305296
is_object($context[static::OBJECT_TO_POPULATE]) &&

‎src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ public function denormalize($data, $class, $format = null, array $context = arra
175175
$normalizedData = $this->prepareForDenormalization($data);
176176

177177
$reflectionClass = new \ReflectionClass($class);
178-
$object = $this->instantiateComplexObject($normalizedData, $class, $context, $reflectionClass, $allowedAttributes, $format);
178+
$object = $this->instantiateObject($normalizedData, $class, $context, $reflectionClass, $allowedAttributes, $format);
179179

180180
foreach ($normalizedData as $attribute => $value) {
181181
if ($this->nameConverter) {

‎src/Symfony/Component/Serializer/Normalizer/GetSetMethodNormalizer.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Serializer/Normalizer/GetSetMethodNormalizer.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function denormalize($data, $class, $format = null, array $context = arra
4747
$normalizedData = $this->prepareForDenormalization($data);
4848

4949
$reflectionClass = new \ReflectionClass($class);
50-
$object = $this->instantiateComplexObject($normalizedData, $class, $context, $reflectionClass, $allowedAttributes, $format);
50+
$object = $this->instantiateObject($normalizedData, $class, $context, $reflectionClass, $allowedAttributes, $format);
5151

5252
$classMethods = get_class_methods($object);
5353
foreach ($normalizedData as $attribute => $value) {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.