File tree 1 file changed +7
-6
lines changed 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -146,12 +146,8 @@ available in the ``configure()`` method::
146
146
Registering the Command
147
147
-----------------------
148
148
149
- Symfony commands must be registered as services and :doc: `tagged </service_container/tags >`
150
- with the ``console.command `` tag. If you're using the
151
- :ref: `default services.yaml configuration <service-container-services-load-example >`,
152
- this is already done for you, thanks to :ref: `autoconfiguration <services-autoconfigure >`.
153
-
154
- On PHP 8, you can use native attribute ``AsCommand `` to configure::
149
+ In PHP 8 and newer versions, you can register the command by adding the
150
+ ``AsCommand `` attribute to it::
155
151
156
152
// src/Command/CreateUserCommand.php
157
153
namespace App\Command;
@@ -175,6 +171,11 @@ On PHP 8, you can use native attribute ``AsCommand`` to configure::
175
171
The ability to use PHP attributes to configure commands was introduced in
176
172
Symfony 5.3.
177
173
174
+ If you can't use PHP attributes, register the command as a service and
175
+ :doc: `tag it </service_container/tags >` with the ``console.command `` tag. If you're using the
176
+ :ref: `default services.yaml configuration <service-container-services-load-example >`,
177
+ this is already done for you, thanks to :ref: `autoconfiguration <services-autoconfigure >`.
178
+
178
179
Executing the Command
179
180
---------------------
180
181
You can’t perform that action at this time.
0 commit comments