Problem/Motivation

lazy: true has no effect in Drupal, the only way (apart from using soon-deprecated proxy service class generator) to autowire services lazily in Drupal currently is the AutowireServiceClosure attribute that lazy-loads services by default.

Code like:
#[Autowire(service: SomeClass::class, lazy: TRUE)] or
#[AutowireCallable(service: SomeClass::class, method: 'someMethod')]

Just doesn't work as expected.

Proposed resolution

Let's add a coding standard check and pin usage of those attribute parameters so developers know what to use and when, instead of relying on Symfony docs that just don't apply in Drupal.

Remaining tasks

User interface changes

API changes

Data model changes

Issue fork coder-3609261

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

graber created an issue. See original summary.

graber’s picture

Issue summary: View changes
graber’s picture

Version: 9.x-dev » 8.3.x-dev

Switching to 8.3.x as that's what's used on most projects currently.

graber’s picture

Status: Active » Needs review