Add return-type declaration to Drupal\migrate\Plugin\MigrateDestinationInterface::fields()

Created on 27 September 2024, 3 months ago

Problem/Motivation

The declaration of Drupal\migrate\Plugin\MigrateDestinationInterface::fields() does not match its doc block:

  /**
   * ...
   * @return array
   *   - Keys: machine names of the fields
   *   - Values: Human-friendly descriptions of the fields.
   *
   * @throws \Drupal\migrate\MigrateException
   *   Thrown when the destination plugin is not configured correctly.
   */
  public function fields();

Steps to reproduce

Proposed resolution

Add the return-type declaration:

  public function fields(): array;

Make the same change in the core destination plugins. Some of these currently have no return statement (so they return NULL instead of []).

First deprecate any implementation that does not declare and return an array.

Remaining tasks

User interface changes

Introduced terminology

API changes

Any implementation of Drupal\migrate\Plugin\MigrateDestinationInterface::fields() must declare its return type and return an array.

Data model changes

None.

Release notes snippet

N/A

πŸ“Œ Task
Status

Active

Version

11.0 πŸ”₯

Component

migration system

Created by

πŸ‡ΊπŸ‡ΈUnited States benjifisher Boston area

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

Comments & Activities

Production build 0.71.5 2024