Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb80bdbd

Browse files
committed
Rewords and tweaks
1 parentd76ac56 commitb80bdbd

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

‎console.rst‎

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -80,26 +80,36 @@ You can optionally define a description, help message and the
8080
:doc:`input options and arguments</console/input>`::
8181

8282
// ...
83-
// theshort description shownwhile running "php bin/console list"
83+
// thecommand description shownwhen running "php bin/console list"
8484
protected static $defaultDescription = 'Creates a new user.';
8585

8686
// ...
8787
protected function configure(): void
8888
{
8989
$this
90-
->setDescription(self::$defaultDescription)
90+
// If you don't like using the $defaultDescription static property,
91+
// you can also define the short description using this method:
92+
// ->setDescription('...')
9193

92-
// the full command description shown when running the command with
93-
// the "--help" option
94+
// the command help shown when running the command with the "--help" option
9495
->setHelp('This command allows you to create a user...')
9596
;
9697
}
9798

99+
Defining the ``$defaultDescription`` static property instead of using the
100+
``setDescription()`` method allows to get the command description without
101+
instantiating its class. This makes the ``php bin/console list`` command run
102+
much faster.
103+
104+
If you want to always run the ``list`` command fast, add the ``--short`` option
105+
to it (``php bin/console list --short``). This will avoid instantiating command
106+
classes, but it won't show any description for commands that use the
107+
``setDescription()`` method instead of the static property.
108+
98109
..versionadded::5.3
99110

100-
The ``$defaultDescription`` static property was introduced in Symfony 5.3.
101-
It allows to make the ``php bin/console list`` lazy.
102-
You can as well use ``php bin/console list --short`` option to have the output faster.
111+
The ``$defaultDescription`` static property and the ``--short`` option
112+
were introduced in Symfony 5.3.
103113

104114
The ``configure()`` method is called automatically at the end of the command
105115
constructor. If your command defines its own constructor, set the properties

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp