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

Commitd76ac56

Browse files
committed
minor#15742 [Console] Document lazy command via description (noniagriconomie)
This PR was merged into the 5.3 branch.Discussion----------[Console] Document lazy command via descriptionHi,PR toclose#14860andclose#14862Is it also relevant to updatehttps://github.com/symfony/demo/blob/main/src/Command/*Command.php? I can PR if neededCommits-------a79e692 [Console] Document lazy command via description
2 parents7a9f5cf +a79e692 commitd76ac56

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

‎console.rst‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,19 +79,28 @@ Configuring the Command
7979
You can optionally define a description, help message and the
8080
:doc:`input options and arguments</console/input>`::
8181

82+
// ...
83+
// the short description shown while running "php bin/console list"
84+
protected static $defaultDescription = 'Creates a new user.';
85+
8286
// ...
8387
protected function configure(): void
8488
{
8589
$this
86-
// the short description shown while running "php bin/console list"
87-
->setDescription('Creates a new user.')
90+
->setDescription(self::$defaultDescription)
8891

8992
// the full command description shown when running the command with
9093
// the "--help" option
9194
->setHelp('This command allows you to create a user...')
9295
;
9396
}
9497

98+
..versionadded::5.3
99+
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.
103+
95104
The ``configure()`` method is called automatically at the end of the command
96105
constructor. If your command defines its own constructor, set the properties
97106
first and then call to the parent constructor, to make those properties

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp