Skip to content

Commit

Permalink
docs formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
weitzman committed Mar 9, 2024
1 parent 2cf879e commit bb5620b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion docs/dependency-injection.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ Drush command files obtain references to the resources they need through a techn

Autowire
------------------
:octicons-tag-24: 13
:octicons-tag-24: 12.5+

Command files may inject Drush and Drupal services by adding the [AutowireTrait](https://github.com/drush-ops/drush/blob/13.x/src/Commands/AutowireTrait.php) to the class (example: [PmCommands](https://github.com/drush-ops/drush/blob/13.x/src/Commands/pm/PmCommands.php)). This enables your [Constructor parameter type hints determine the the injected service](https://www.drupal.org/node/3396179). When a type hint is insufficient, an [#[Autowire] Attribute](https://www.drupal.org/node/3396179) on the constructor property (with _service:_ named argument) directs AutoWireTrait to the right service (example: [LoginCommands](https://github.com/drush-ops/drush/blob/13.x/src/Commands/core/LoginCommands.php)). This Attribute is currently _required_ when injecting Drush services (not required for Drupal services).

If your command is not found by Drush, add the `-vvv` option for debug info about any service instantiation errors. If Autowire is still insufficient, a commandfile may implement its own `create()` method (see below).
Expand Down

0 comments on commit bb5620b

Please sign in to comment.