Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commitea05e7b

Browse files
committed
deprecate calling createChildContext without the format parameter
1 parent77f642e commitea05e7b

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

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

Lines 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-
protectedfunctioncreateChildContext(array$parentContext,$attribute/*, string $format = null */)
489+
protectedfunctioncreateChildContext(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‎

Lines 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-
protectedfunctioncreateChildContext(array$parentContext,$attribute/*, string $format = null */)
518+
protectedfunctioncreateChildContext(array$parentContext,$attribute/*,?string $format */)
517519
{
518520
if (\func_num_args() >=3) {
519521
$format =\func_get_arg(2);
520522
}else {
521-
//willbe deprecatedin version4
523+
@trigger_error(sprintf('Method %s::%s()willhave a 3rd `?string $format` argumentin version5.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)

[8]ページ先頭

©2009-2025 Movatter.jp