ComplexDataDefinitionBase::$propertyDefinitions should default to an empty array, not null

Created on 16 December 2021, about 3 years ago
Updated 3 March 2023, almost 2 years ago

Problem/Motivation

\Drupal\Core\TypedData\ComplexDataDefinitionBase::$propertyDefinitions defaults to null, but is expected to be an array. We can do this in the property declaration and clean up checks which check to see if the value is set or not.

Steps to reproduce

Dump a MapDataDefinition to an array and propertyDefinitions is null when you expect an array

Proposed resolution

  /**
   * An array of data definitions.
   *
   * @var \Drupal\Core\TypedData\DataDefinitionInterface[]
   */
  protected $propertyDefinitions = [];

Remove checks for isset since the value is always an array – empty or not.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Feature request
Status

Needs work

Version

10.1

Component
Typed data 

Last updated 16 days ago

  • Maintained by
  • 🇦🇹Austria @fago
Created by

🇺🇸United States mglaman WI, USA

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024