fix: #3639525 Add return types for Drupal 12's native return type deprecations

Description

On Drupal 12, Symfony's DebugClassLoader reports that core and Embed might add native return types to methods we implement, which fails the phpunit (next major) job.

  • Native return types on classes that aren't extension points: EditEmbeddedEntity, EntityEmbedDialog, EntityEmbedFilter, the Entity embed type, the DrupalEntity CKEditor 5 plugin and the three derivers.
  • @return tags only on classes other modules extend (EntityEmbedDisplayBase, FieldFormatterEntityEmbedDisplayBase, the display plugins) and on EntityEmbedDisplayManager::createInstance(): a native type there would break subclasses that override these methods. They can get native types in 2.0.x.
  • EntityEmbedFilter::tips() keeps no native type: it returns translatable markup with HTML, which ?string would escape.

Issue: https://www.drupal.org/project/entity_embed/issues/3639525

AI disclosure

Claude Code (Claude Opus 5.5) wrote the return types and docblocks. I identified the deprecations in the phpunit (next major) job and decided which classes get native types and which only get @return tags, to keep subclasses working. I reviewed the diff; php -l and phpcs pass locally.

🤖 Generated with Claude Code

Merge request reports

Loading
Loading