Problem/Motivation

Method "Symfony\Component\Serializer\Normalizer\DenormalizerInterface::denormalize()" will return "mixed" as of its next major version.

Steps to reproduce

Proposed resolution

Add the "mixed" return type hint.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

CommentFileSizeAuthor
#7 3232080-7.patch13.35 KBpaulocs
#7 diff-2-7.txt1.26 KBpaulocs
#2 3232080-2.patch12.64 KBdaffie

Comments

daffie created an issue. See original summary.

daffie’s picture

Status: Active » Needs review
StatusFileSize
new12.64 KB

The problem for adding this return type hint is that a lot of contrib modules override the method. See: http://grep.xnddx.ru/search?text=public+function+denormalize%28&filename=. Maybe we need to wait for D10.0 to commit this patch.

catch’s picture

I don't think we can change EntityDenormalizerBase, but we should be able to do all the non-base classes in Drupal 9?

daffie’s picture

Priority: Normal » Critical
Issue tags: +Drupal 10

I do not think we can do this change in a 9.x branch as the method is overridden a lot in contrib and therefor would result in a BC break. See: http://grep.xnddx.ru/search?text=public+function+denormalize%28&filename=.

Part of the Symfony 6 in D10 initiative.

daffie’s picture

Version: 9.3.x-dev » 10.0.x-dev

The "mixed" return type hint is only supported from PHP version 8.0.

longwave’s picture

Status: Needs review » Needs work

What about:

core/modules/jsonapi/src/Serializer/Serializer.php
73:  public function denormalize($data, $type, $format = NULL, array $context = []) {
paulocs’s picture

Status: Needs work » Needs review
StatusFileSize
new1.26 KB
new13.35 KB

I did a re-roll and addressed #6.

longwave’s picture

Status: Needs review » Reviewed & tested by the community

Thanks, this looks good for 10.0.x now.

catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed 45630c7 and pushed to 10.0.x. Thanks!

  • catch committed 45630c7 on 10.0.x
    Issue #3232080 by paulocs, daffie, longwave: [Symfony 6] Add "mixed"...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.