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

[Serializer] Deprecate calling createChildContext without the format parameter #31030

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -555,8 +555,12 @@ protected function denormalizeParameter(\ReflectionClass $class, \ReflectionPara
*
* @internal
fabpot marked this conversation as resolved.
Show resolved Hide resolved
*/
protected function createChildContext(array $parentContext, $attribute/*, string $format = null */)
protected function createChildContext(array $parentContext, $attribute/*, ?string $format */)
{
if (\func_num_args() < 3) {
@trigger_error(sprintf('Method "%s::%s()" will have a third "?string $format" argument in version 5.0; not defining it is deprecated since Symfony 4.3.', \get_class($this), __FUNCTION__), E_USER_DEPRECATED);
$format = null;
}
if (isset($parentContext[self::ATTRIBUTES][$attribute])) {
$parentContext[self::ATTRIBUTES] = $parentContext[self::ATTRIBUTES][$attribute];
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -559,18 +559,19 @@ private function isMaxDepthReached(array $attributesMetadata, string $class, str
* We must not mix up the attribute cache between parent and children.
*
* {@inheritdoc}
*
* @param string|null $format
*/
protected function createChildContext(array $parentContext, $attribute/*, string $format = null */)
protected function createChildContext(array $parentContext, $attribute/*, ?string $format */)
dbu marked this conversation as resolved.
Show resolved Hide resolved
{
if (\func_num_args() >= 3) {
$format = \func_get_arg(2);
} else {
// will be deprecated in version 4
@trigger_error(sprintf('Method "%s::%s()" will have a third "?string $format" argument in version 5.0; not defining it is deprecated since Symfony 4.3.', \get_class($this), __FUNCTION__), E_USER_DEPRECATED);
$format = null;
}

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

return $context;
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.