Problem/Motivation
This issue #3478204: Fix MissingParamType in core/lib/Drupal/Core added type hints for Drupal\Core\Entity\EntityStorageInterface::loadMultiple()
and ::resetCache()
as @param int[]|null $ids
, which is incorrect.
- Entity IDs are not guaranteed to be integers; more likely, they will be strings. Even though the base field definition for ID uses an integer DataType by default, it is never cast to an integer and is returned as a string.
Drupal\Core\Entity\EntityInterface::id()
specifies return types as@return string|int|null
, which already makes a simple use of::loadMultiple([$node->id()])
completely incorrect.Drupal\Core\Config\Entity\ConfigEntityStorageInterface
extends this interface, making it problematic as well, because in general, Drupal configurations use strings as their IDs, not integers.- It is a generic interface for all kinds of different entity types and subtypes, and it shouldn't enforce such strict types, as even the Drupal core ones are already incompatible with it.
Proposed resolution
Add an array of strings to the type hint as well, since it is a valid argument.