Incorrect types in variables used in Drupal\Core\Field\Annotation\FieldType

Created on 12 January 2024, 12 months ago
Updated 1 March 2024, 10 months ago

Problem/Motivation

Hi!

Two issues related with the Drupal/Core/Field/Annotation/FieldType.php file:

1)
After https://www.drupal.org/node/3375748 β†’ landed, FieldType can be grouped by "category", and if that is the case, then the description is added as array; but it can also be added as a @Translation.
If we check the definition of the variable:

  /**
   * A short human readable description for the field type.
   *
   * @ingroup plugin_translatable
   *
   * @var \Drupal\Core\Annotation\Translation
   */
  public $description;

It only allows Translation as type but not array

2) In the same file:

  /**
   * The category under which the field type should be listed in the UI.
   *
   * @ingroup plugin_translatable
   *
   * @var \Drupal\Core\Annotation\Translation
   */
  public $category = '';

after the same https://www.drupal.org/node/3375748 β†’ , the category now expects 'string' instead.

Steps to reproduce

- nothing apart of reading the file

Proposed resolution

Could be:

  /**
   * A short human readable description for the field type.
   *
   * @ingroup plugin_translatable
   *
   * @var \Drupal\Core\Annotation\Translation|array
   */
  public $description;

  /**
   * The category under which the field type should be listed in the UI.
   *
   * @var string
   */
  public $category = '';

but not sure if @ingroup plugin_translatable can be used as well with array

Remaining tasks

- Patch & nothing else i believe

πŸ› Bug report
Status

Needs work

Version

11.0 πŸ”₯

Component
FieldΒ  β†’

Last updated 1 day ago

Created by

πŸ‡§πŸ‡ͺBelgium gorkagr

Live updates comments and jobs are added and updated live.
  • Documentation

    Primarily changes documentation, not code. For Drupal core issues, select the Documentation component instead of using this tag. In general, component selection is preferred over tag selection.

Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024