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.
Comment | File | Size | Author |
---|
Issue fork drupal-3276195
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:
Comments
Comment #2
catchAdding ::supportsDecoding() here too.
Comment #3
mondrakeLooking into this.
Comment #5
mondrakeComment #6
mondrakeThis is adding the new argument and normalizing the typehint signatures of the methods across the codebase.
Comment #7
mondrakeA patch combining this MR with #3275864: Update to Symfony 6.1.1 to check if all deprecations related with this issue are fixed
Comment #8
catchWe 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.
Comment #10
mondrakeAdded draft CR.
Comment #11
catchDon't think there's anything left to do here.
Comment #12
alexpottCommitted 3449a8b and pushed to 10.0.x. Thanks!
Comment #15
mondrakePublished CR
Comment #16
xjmThis is BC-breakish; should we put it in the release notes as an addendum to the SF update info?
Comment #17
xjmComment #18
mondrakeThis ended up in 9.4.0-alpha1 release notes, which is not correct. It’s a D10 only change.