Closed (won't fix)
Project:
Group
Version:
4.0.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
19 Dec 2024 at 11:26 UTC
Updated:
19 Feb 2025 at 09:14 UTC
Jump to comment: Most recent
I have noticed that some classes that extend from ControllerBase still have `entity_type.manager` (or similar) injected but later they are not used, as the function provided by the parent class is used instead.
therefore, we can avoid inject them.
In addition, the construct params and variables can be declared directly, so we can use this issue to review them.
code it, push it, review it and merge :)
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 #3
gorkagr commentedI am not sure if you have also planned to do smth in the constructors and declare the variables directly in the params:
smth like
original:
idea:
But then i assume that should be done to all files that have a __construct(), so all of them are unified
Comment #4
gorkagr commentedComment #5
kristiaanvandeneyndeUh yeah, property promotion and the omission of constructor docblocks is also on my todo list
Comment #6
kristiaanvandeneyndeActually, we should still inject them because if we call the parent method without injecting them, they will use \Drupal::service() instead. We should absolutely avoid using that where we can.
Closing as won't fix as I've just upgraded all constructors to use property promotion where possible instead. See #3506163: Drop constructor documentation and use property promotion where possible