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 fb73b72

Browse filesBrowse files
committed
deprecate calling createChildContext without the format parameter
1 parent 77f642e commit fb73b72
Copy full SHA for fb73b72

File tree

2 files changed

+9
-4
lines changed
Filter options

2 files changed

+9
-4
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php
+5-1Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,8 +486,12 @@ protected function denormalizeParameter(\ReflectionClass $class, \ReflectionPara
486486
*
487487
* @internal
488488
*/
489-
protected function createChildContext(array $parentContext, $attribute/*, string $format = null */)
489+
protected function createChildContext(array $parentContext, $attribute/*, ?string $format */)
490490
{
491+
if (\func_num_args() < 3) {
492+
@trigger_error(sprintf('Method %s::%s() will have a 3rd `?string $format` argument in version 5.0. Not defining it is deprecated since Symfony 4.3.', \get_class($this), __FUNCTION__), E_USER_DEPRECATED);
493+
$format = null;
494+
}
491495
if (isset($parentContext[self::ATTRIBUTES][$attribute])) {
492496
$parentContext[self::ATTRIBUTES] = $parentContext[self::ATTRIBUTES][$attribute];
493497
} else {

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php
+4-3Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -512,18 +512,19 @@ private function isMaxDepthReached(array $attributesMetadata, string $class, str
512512
* We must not mix up the attribute cache between parent and children.
513513
*
514514
* {@inheritdoc}
515+
*
516+
* @param string|null $format
515517
*/
516-
protected function createChildContext(array $parentContext, $attribute/*, string $format = null */)
518+
protected function createChildContext(array $parentContext, $attribute/*, ?string $format */)
517519
{
518520
if (\func_num_args() >= 3) {
519521
$format = \func_get_arg(2);
520522
} else {
521-
// will be deprecated in version 4
523+
@trigger_error(sprintf('Method %s::%s() will have a 3rd `?string $format` argument in version 5.0. Not defining it is deprecated since Symfony 4.3.', \get_class($this), __FUNCTION__), E_USER_DEPRECATED);
522524
$format = null;
523525
}
524526

525527
$context = parent::createChildContext($parentContext, $attribute, $format);
526-
// format is already included in the cache_key of the parent.
527528
$context['cache_key'] = $this->getCacheKey($format, $context);
528529

529530
return $context;

0 commit comments

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