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

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

daffie created an issue. See original summary.

daffie’s picture

Status: Active » Needs review
FileSize
2.08 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+supportsNormalization%2.... Maybe we need to wait for D10.0 to commit this patch.

larowlan’s picture

Yeah, although we can do the test one now

daffie’s picture

Version: 9.3.x-dev » 10.0.x-dev
Priority: Normal » Critical
Issue tags: +Drupal 10

I 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=.

longwave’s picture

Status: Needs review » Needs work

Does \Drupal\jsonapi\Serializer\Serializer need this as well?

  /**
   * {@inheritdoc}
   */
  public function supportsNormalization($data, $format = NULL, array $context = []) {
paulocs’s picture

Status: Needs work » Needs review
FileSize
611 bytes
2.72 KB

Added the "bool" type hint to \Drupal\jsonapi\Serializer\Serializer::supportsNormalization() too.

longwave’s picture

Status: Needs review » Reviewed & tested by the community

Thanks, this looks good for 10.0.x now.

  • catch committed 203654b on 10.0.x
    Issue #3232063 by paulocs, daffie, longwave: [Symfony 6] Add "bool" type...
catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed 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

Status: Fixed » Closed (fixed)

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