Documentation for EntityDefinitionUpdateManagerInterface::getFieldStorageDefinition missing NULL return

Created on 14 July 2020, almost 4 years ago
Updated 26 June 2023, 11 months ago

Problem/Motivation

The documentation for \Drupal\Core\Entity\EntityDefinitionUpdateManagerInterface::getFieldStorageDefinition says that methods always returns \Drupal\Core\Field\FieldStorageDefinitionInterface:

   * @return \Drupal\Core\Field\FieldStorageDefinitionInterface
   *   The field storage definition.

But implementation \Drupal\Core\Entity\EntityDefinitionUpdateManager::getFieldStorageDefinition can return NULL.

  /**
   * {@inheritdoc}
   */
  public function getFieldStorageDefinition($name, $entity_type_id) {
    $storage_definitions = $this->entityLastInstalledSchemaRepository->getLastInstalledFieldStorageDefinitions($entity_type_id);
    return isset($storage_definitions[$name]) ? clone $storage_definitions[$name] : NULL;
  }

Proposed resolution

Add NULL as return type to the interface documentation.

Remaining tasks

- Reviews needed

πŸ› Bug report
Status

Needs work

Version

11.0 πŸ”₯

Component
DocumentationΒ  β†’

Last updated about 9 hours ago

No maintainer
Created by

πŸ‡·πŸ‡ΊRussia Niklan Russia, Perm

Live updates comments and jobs are added and updated live.
  • Quick fix

    Very small and simple change. Preferred over Quickfix.

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.

  • πŸ‡¬πŸ‡§United Kingdom joachim

    > I think we should deprecate returning NULL and throw an exception (in the D10 future) instead.

    Agreed, but could we reset this issue to being a documentation quick fix, so the docs correctly reflect what the code does, and file a separate issue to improve the code?

Production build 0.69.0 2024