Issue with supportsNormalization declaration

Created on 24 April 2023, over 1 year ago
Updated 8 May 2024, 6 months ago

Problem/Motivation

I tried to use the Anu LMS module on Drupal 10.0.4 and I get WSOD with the message:

Fatal error: Declaration of Drupal\rest_paragraphs_recursive\Normalizer\ParagraphsNormalizer::supportsNormalization($entity, $format = null) must be compatible with Drupal\serialization\Normalizer\NormalizerBase::supportsNormalization($data, ?string $format = null, array $context = []): bool in /var/www/html/docroot/modules/contrib/rest_entity_recursive/modules/rest_paragraphs_recursive/src/Normalizer/ParagraphsNormalizer.php on line 47

Upon inspection, I found out that this module is set as a dependency on the Anu LMS module and the supportsNormalization method declaration is different from the one in the core.

Core:
public function supportsNormalization($data, string $format = NULL, array $context = []): bool {
REST Entity Recursive:
public function supportsNormalization($entity, $format = NULL) {

This is particularly a problem in Drupal 10.

Proposed resolution

Fix the declaration.

🐛 Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

🇸🇮Slovenia josip.rajkovic

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024