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

Commitf5a666f

Browse files
committed
Merge branch '5.3' into 5.4
* 5.3: [DependencyInjection] Minor improvement of service tag description Rewords and tweaks [Console] Document lazy command via description
2 parents0c6634d +1a7bc4f commitf5a666f

File tree

2 files changed

+26
-7
lines changed

2 files changed

+26
-7
lines changed

‎console.rst‎

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,19 +79,38 @@ 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 command description shown when 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+
// If you don't like using the $defaultDescription static property,
91+
// you can also define the short description using this method:
92+
// ->setDescription('...')
8893

89-
// the full command description shown when running the command with
90-
// the "--help" option
94+
// the command help shown when running the command with the "--help" option
9195
->setHelp('This command allows you to create a user...')
9296
;
9397
}
9498

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+
109+
..versionadded::5.3
110+
111+
The ``$defaultDescription`` static property and the ``--short`` option
112+
were introduced in Symfony 5.3.
113+
95114
The ``configure()`` method is called automatically at the end of the command
96115
constructor. If your command defines its own constructor, set the properties
97116
first and then call to the parent constructor, to make those properties

‎service_container/tags.rst‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -598,9 +598,9 @@ application handlers::
598598
Tagged Services with Priority
599599
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
600600

601-
The tagged services can be prioritized using the ``priority`` attribute.
602-
Thepriority is a positive or negative integer. The higher the number,
603-
the earlier the tagged service will be located in the collection:
601+
The tagged services can be prioritized using the ``priority`` attribute. The
602+
priority is a positive or negative integer that defaults to ``0``. The higher
603+
thenumber, theearlier the tagged service will be located in the collection:
604604

605605
..configuration-block::
606606

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp