Skip to content

Commit 85322e3

Browse files
committed
Tweaks
1 parent a1a5933 commit 85322e3

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

console.rst

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -146,12 +146,8 @@ available in the ``configure()`` method::
146146
Registering the Command
147147
-----------------------
148148

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::
155151

156152
// src/Command/CreateUserCommand.php
157153
namespace App\Command;
@@ -175,6 +171,11 @@ On PHP 8, you can use native attribute ``AsCommand`` to configure::
175171
The ability to use PHP attributes to configure commands was introduced in
176172
Symfony 5.3.
177173

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+
178179
Executing the Command
179180
---------------------
180181

0 commit comments

Comments
 (0)