Problem/Motivation

#3396166: Convert entity type discovery to PHP attributes introduced a regression in DX and possibly translatability:

label_count used to be a PluralTranslation, which enforced the keys:

  public function __construct(array $values) {
    if (!isset($values['singular'])) {
      throw new \InvalidArgumentException('Missing "singular" value in the PluralTranslation annotation');
    }
    if (!isset($values['plural'])) {
      throw new \InvalidArgumentException('Missing "plural" value in the PluralTranslation annotation');
    }

Now it's just an array and there's no check of the keys:

    public readonly array $label_count = [],

Steps to reproduce

1. Change the label_count property of an entity type to no longer had one of its child items.
2. Do a rebuild.
3. Note absence of helpful exception

Proposed resolution

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Comments

joachim created an issue. See original summary.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.