Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
Method "Symfony\Component\Serializer\Normalizer\NormalizerInterface::supportsNormalization()" will return "bool" as of its next major version. Doing the same in implementation "Drupal\serialization\Normalizer\NormalizerBase" will be required when upgrading.
Steps to reproduce
Proposed resolution
Add the "bool" type hint.
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
Comment | File | Size | Author |
---|---|---|---|
#6 | 3232063-6.patch | 2.72 KB | paulocs |
| |||
#6 | interdiff-2-6.txt | 611 bytes | paulocs |
#2 | 3232063-2.patch | 2.08 KB | daffie |
Comments
Comment #2
daffie CreditAttribution: daffie commentedThe 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+supportsNormalization%2.... Maybe we need to wait for D10.0 to commit this patch.
Comment #3
larowlanYeah, although we can do the test one now
Comment #4
daffie CreditAttribution: daffie commentedI do not think we can do this in a 9.x branch as the method overidden a lot in contrib and therefor would result in a BC break. See: http://grep.xnddx.ru/search?text=supportsNormalization%28&filename=.
Comment #5
longwaveDoes \Drupal\jsonapi\Serializer\Serializer need this as well?
Comment #6
paulocsAdded the "bool" type hint to \Drupal\jsonapi\Serializer\Serializer::supportsNormalization() too.
Comment #7
longwaveThanks, this looks good for 10.0.x now.
Comment #9
catchCommitted 203654b and pushed to 10.0.x. Thanks!
I've added a stub change record for this, so we can at least link the various issues to it https://www.drupal.org/node/3254142