Generated with the help of an LLM.

Problem/Motivation

On Drupal 12, Symfony's DebugClassLoader reports that core methods we override "might add" a native return type in the next major. The phpunit job on the next major lists these classes:

  • EntityEmbedDisplayBase, FieldFormatterEntityEmbedDisplayBase, EntityEmbedDisplayManager::createInstance()
  • EntityEmbedDialog (create(), buildForm(), getFormId())
  • EntityEmbedFilter (create(), process(): FilterProcessResult, tips(): ?string)
  • Plugin\EmbedType\Entity (including getDefaultIconUrl(): string)
  • CKEditor 5 plugin and derivers: DrupalEntity, DrupalEntityDeriver, FieldFormatterDeriver, ViewModeDeriver
  • Display plugins: EntityReferenceFieldFormatter (trustedCallbacks()), FileFieldFormatter, ImageFieldFormatter, MediaImageDecorator, ViewModeFieldFormatter

When core adds these return types, our overrides without them will cause fatal errors.

Proposed resolution

Adding a return type to a method that other modules may override breaks those subclasses. So:

  • In 8.x-1.x, add return types to the concrete plugins, the form, the filter and the derivers. Drupal's backwards compatibility policy doesn't treat individual plugin classes as API.
  • Leave the base classes (EntityEmbedDisplayBase, FieldFormatterEntityEmbedDisplayBase) and EntityEmbedDisplayManager for 2.0.x, which #3639495: [meta] What to remove in 2.0.x tracks, unless core adds the types before then.

Remaining tasks

  • Decide whether to split the base classes out into 2.0.x.
  • Add the return types and confirm the phpunit job on the next major no longer reports them.
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

dave reid created an issue.