fix: #3608027 Fatal error: Declaration of EntityReferenceNormalizer::normalize() must be compatible with ComplexDataNormalizer::normalize() on Drupal core 11.4+
Problem/Motivation
Drupal core 11.4.0 narrowed ComplexDataNormalizer::normalize()'s return type from array|string|int|float|bool|\ArrayObject|null to a strict array (see https://www.drupal.org/node/3588047). EntityReferenceNormalizer still declared the old, wider return type and returned NULL in one branch, which PHP now rejects as an incompatible override and would also throw a TypeError at runtime.
Fix
Narrow the return type to match the parent and return [] instead of NULL, consistent with how ComplexDataNormalizer itself already returns an empty array. Tested against Drupal core 11.4.0 - resolves the fatal error, drush status reports a successful bootstrap again.
Closes #3608027
AI-Generated: Yes (Used Claude/opencode to diagnose the Drupal core 11.4 return-type BC break, write the fix, and prepare this MR.)