Problem/Motivation

From #3275864: Update to Symfony 6.1.1.

Full test results: https://www.drupal.org/pift-ci-job/2364329

  1x: The "Drupal\serialization\Normalizer\NormalizerBase::supportsNormalization()" method will require a new "array $context" argument in the next major version of its interface "Symfony\Component\Serializer\Normalizer\NormalizerInterface", not defining it is deprecated.
    1x in HttpExceptionNormalizerTest::testNormalize from Drupal\Tests\jsonapi\Unit\Normalizer
1	

  1x: The "Drupal\serialization\Encoder\JsonEncoder::supportsDecoding()" method will require a new "array $context" argument in the next major version of its parent class 

Looks like we need to change the following:

modules/jsonapi/src/Normalizer/EntityDenormalizerBase.php
modules/jsonapi/src/Serializer/Serializer.php
modules/serialization/tests/serialization_test/src/SerializationTestNormalizer.php
modules/serialization/src/Normalizer/NormalizerBase.php

Steps to reproduce

Proposed resolution

Add the new argument to all core classes implementing the interface in 10.x

Contrib modules that also implement the interface will be able to add the extra argument in 9.4.x for forward compatibility because PHP allows adding extra arguments to interface methods in implementing classes, so this shouldn't require separate 9.4.x and 10.0.x branches.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Code that extends Symfony's Serializer component has been updated with stricter typehints and an additional argument for compatibility with Symfony 6.1 and future releases. For more information, review the change record: Context argument added in code that extends from Symfony's Serializer component.

Issue fork drupal-3276195

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

catch created an issue. See original summary.

catch’s picture

Title: Symfony\Component\Serializer\Normalizer\NormalizerInterface will require a new "array $context" argument in the next major version » Symfony\Component\Serializer\Normalizer\NormalizerInterface::supportsEncoding/supportsDecoding will require a new "array $context" argument in the next major version
Issue summary: View changes
Parent issue: » #3275864: Update to Symfony 6.1.1
Related issues: -#3275864: Update to Symfony 6.1.1

Adding ::supportsDecoding() here too.

mondrake’s picture

Assigned: Unassigned » mondrake

Looking into this.

mondrake’s picture

Assigned: mondrake » Unassigned
Status: Active » Needs review
mondrake’s picture

This is adding the new argument and normalizing the typehint signatures of the methods across the codebase.

mondrake’s picture

A patch combining this MR with #3275864: Update to Symfony 6.1.1 to check if all deprecations related with this issue are fixed

catch’s picture

Issue summary: View changes
Issue tags: +Needs change record

We should add a Drupal change record for this one to document what any contrib implementations need to do - for 9.4.x they can just do the same thing, since adding arguments to an interface method in an implementing class is fine.

MR looks good.

Status: Needs review » Needs work

The last submitted patch, 7: 3276195-combined-7.patch, failed testing. View results

mondrake’s picture

Status: Needs work » Needs review
Issue tags: -Needs change record

Added draft CR.

catch’s picture

Status: Needs review » Reviewed & tested by the community

Don't think there's anything left to do here.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed 3449a8b and pushed to 10.0.x. Thanks!

  • alexpott committed 3449a8b on 10.0.x
    Issue #3276195 by mondrake, catch: Symfony\Component\Serializer\...

mondrake’s picture

Published CR

xjm’s picture

Issue tags: +10.0.0 release notes

This is BC-breakish; should we put it in the release notes as an addendum to the SF update info?

xjm’s picture

Issue summary: View changes
mondrake’s picture

This ended up in 9.4.0-alpha1 release notes, which is not correct. It’s a D10 only change.

Status: Fixed » Closed (fixed)

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