#3612201 introduced entity-storage getter methods on 4.x to resolve the phpstan-drupal entity-storage warnings (drupal.entityStoragePropertyAssignment and drupal.entityStorageDirectInjection). On 4.x the cached storage properties were removed, which is a backward-compatibility break, so on the 3.x maintenance branch those warnings are currently suppressed in phpstan.neon.
This issue backports those storage getters to 3.x and routes all internal code through them, so the phpstan warnings are fixed rather than suppressed and the eventual 4.0.0 upgrade becomes a smaller step. The storage properties are kept as deprecated backward-compatibility shims, so no backward-compatibility break is introduced on the maintenance branch.
Scope
- For each class changed in #3612201, add the storage getter method (for example a protected domainStorage() that returns entityTypeManager->getStorage()).
- Inject EntityTypeManagerInterface where entity storage was injected directly (a constructor change, which is backward-compatibility exempt).
- Remove all direct access to the storage properties throughout the code and route every use through the getter, so the getter is the single access point.
- Keep the existing protected storage properties, annotated @deprecated for removal in 4.0.0, so any subclass still referencing them keeps working.
- Remove the corresponding entity-storage suppressions from phpstan.neon on 3.x once the warnings are resolved (see !403).
See #3612201 for the 4.x implementation to mirror.
Issue fork domain-3612550
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #4
mably commented