Problem/Motivation

phpstan-drupal has a new EntityHandlerDirectInjectionRule, see:

Proposed resolution

Remove direct injection of entity storage

Remaining tasks

  1. Write a merge request
  2. Review
  3. Commit

User interface changes

None

API changes

None

Data model changes

None

Issue fork domain-3612201

Command icon 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

idebr created an issue. See original summary.

yusuf_khan made their first commit to this issue’s fork.

mably made their first commit to this issue’s fork.

mably’s picture

@yusuf_khan thanks for your help, but I'll work on this myself.

Comment if you see anything missing.

mably changed the visibility of the branch 3612201-storage-refactor-4x to hidden.

yusuf_khan’s picture

sure @mably

mably’s picture

Status: Active » Needs review
nitinkumar_7’s picture

Tested locally, existing tests pass against 3.x-dev.

The refactor is clean - swapping direct storage injection for EntityTypeManagerInterface plus lazy xStorage() accessors across the codebase, in line with the EntityHandlerDirectInjectionRule.

In DomainAliasValidator.php, I only see an aliasStorage() accessor added no matching domainStorage() method. If $this->domainStorage is still referenced anywhere in that file, it would now fail since the property no longer exists. Could someone confirm this was handled?
Some classes (DomainAccessControlHandler, Plugin/views/access/Domain, DomainAccessActionBase, DomainAccessContent) changed constructor parameter types rather than just dropping a property. Shouldn't affect normal Drupal usage since these go through create()/createInstance(), but flagging in case it affects the "API changes: None" note in the summary.

Everything else passed locally without issue.

  • mably committed d4993205 on 4.x
    task: #3612201 Fix phpstan: Storing entity storage as a class property...

  • mably committed 6b30d399 on 2.0.x
    task: #3612201 Fix phpstan: Storing entity storage as a class property...

  • mably committed 3cf34e42 on 3.0.x
    task: #3612201 Fix phpstan: Storing entity storage as a class property...

  • mably committed 96c198a9 on 3.x
    task: #3612201 Fix phpstan: Storing entity storage as a class property...
mably’s picture

Status: Needs review » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.