Fixed
Project:
Metatag
Version:
2.2.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
26 Oct 2026 at 19:16 UTC
Updated:
5 Nov 2026 at 12:23 UTC
Jump to comment: Most recent
In some of the phpstan test failures:
Line metatag_views/src/Controller/MetatagViewsController.php
------ -----------------------------------------------------------------------
43 Direct injection of entity storage via $viewStorage is not
recommended. Inject Drupal\Core\Entity\EntityTypeManagerInterface and
call getStorage() at the call-site instead.
🪪 drupal.entityStorageDirectInjection
💡 See
https://mglaman.dev/blog/dependency-injection-anti-patterns-drupal
44 Storing entity storage as a class property is not recommended. Call
Drupal\Core\Entity\EntityTypeManagerInterface::getStorage() at the
call-site instead.
🪪 drupal.entityStoragePropertyAssignment
💡 See
https://mglaman.dev/blog/dependency-injection-anti-patterns-drupal
and..
Line metatag_views/src/Form/MetatagViewsTranslationForm.php
------ ---------------------------------------------------------------------
119 Storing entity storage as a class property is not recommended. Call
Drupal\Core\Entity\EntityTypeManagerInterface::getStorage() at the
call-site instead.
🪪 drupal.entityStoragePropertyAssignment
💡 See
https://mglaman.dev/blog/dependency-injection-anti-patterns-drupal
.. and some others throughout the module.
Fix these per Matt's blog post.
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 #2
damienmckennaComment #5
shubhamgoel commentedHi team,
The fixes have been applied. Please review and merge the MR https://git.drupalcode.org/project/metatag/-/merge_requests/298/diffs.
Comment #7
liam morlandI have added a commit to have it use the
parent::entityTypeManager().Comment #8
damienmckennaThere are a few other instances of this error across the codebase.
Comment #9
damienmckennaComment #11
damienmckennaCommitted. Thank you.