Skip to content

Document that usages may be supplied by AsCommand Attribute #21309

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: 7.4
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion console.rst
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,13 @@ If you can't use PHP attributes, register the command as a service and
:ref:`default services.yaml configuration <service-container-services-load-example>`,
this is already done for you, thanks to :ref:`autoconfiguration <services-autoconfigure>`.

You can also use ``#[AsCommand]`` to add a description and longer help text for the command::
You can also use ``#[AsCommand]`` to add a description, usages, and longer help text for the command::

#[AsCommand(
name: 'app:create-user',
description: 'Creates a new user.', // the command description shown when running "php bin/console list"
help: 'This command allows you to create a user...', // the command help shown when running the command with the "--help" option
usages: ['app:create-user alice'],
)]
class CreateUserCommand
{
Expand Down