Skip to content

Commit 4fcdb8f

Browse files
committed
minor #20247 [Console] Document the silent verbosity level (javiereguiluz)
This PR was squashed before being merged into the 7.2 branch. Discussion ---------- [Console] Document the silent verbosity level Fixes #20243. Commits ------- 2492dd1 [Console] Document the silent verbosity level
2 parents b8a153d + 2492dd1 commit 4fcdb8f

File tree

3 files changed

+34
-4
lines changed

3 files changed

+34
-4
lines changed

components/console/usage.rst

+8
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,17 @@ You can suppress output with:
6565

6666
.. code-block:: terminal
6767
68+
# suppresses all output, including errors
69+
$ php application.php list --silent
70+
71+
# suppresses all output except errors
6872
$ php application.php list --quiet
6973
$ php application.php list -q
7074
75+
.. versionadded:: 7.2
76+
77+
The ``--silent`` option was introduced in Symfony 7.2.
78+
7179
You can get more verbose messages (if this is supported for a command)
7280
with:
7381

console/input.rst

+6-1
Original file line numberDiff line numberDiff line change
@@ -446,12 +446,17 @@ The Console component adds some predefined options to all commands:
446446

447447
* ``--verbose``: sets the verbosity level (e.g. ``1`` the default, ``2`` and
448448
``3``, or you can use respective shortcuts ``-v``, ``-vv`` and ``-vvv``)
449-
* ``--quiet``: disables output and interaction
449+
* ``--silent``: disables all output and interaction, including errors
450+
* ``--quiet``: disables output and interaction, but errors are still displayed
450451
* ``--no-interaction``: disables interaction
451452
* ``--version``: outputs the version number of the console application
452453
* ``--help``: displays the command help
453454
* ``--ansi|--no-ansi``: whether to force of disable coloring the output
454455

456+
.. versionadded:: 7.2
457+
458+
The ``--silent`` option was introduced in Symfony 7.2.
459+
455460
When using the ``FrameworkBundle``, two more options are predefined:
456461

457462
* ``--env``: sets the Kernel configuration environment (defaults to ``APP_ENV``)

console/verbosity.rst

+20-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ messages, but you can control their verbosity with the ``-q`` and ``-v`` options
77

88
.. code-block:: terminal
99
10-
# do not output any message (not even the command result messages)
10+
# suppress all output, including errors
11+
$ php bin/console some-command --silent
12+
13+
# suppress all output (even the command result messages) but display errors
1114
$ php bin/console some-command -q
1215
$ php bin/console some-command --quiet
1316
@@ -23,13 +26,18 @@ messages, but you can control their verbosity with the ``-q`` and ``-v`` options
2326
# display all messages (useful to debug errors)
2427
$ php bin/console some-command -vvv
2528
29+
.. versionadded:: 7.2
30+
31+
The ``--silent`` option was introduced in Symfony 7.2.
32+
2633
The verbosity level can also be controlled globally for all commands with the
2734
``SHELL_VERBOSITY`` environment variable (the ``-q`` and ``-v`` options still
2835
have more precedence over the value of ``SHELL_VERBOSITY``):
2936

3037
===================== ========================= ===========================================
3138
Console option ``SHELL_VERBOSITY`` value Equivalent PHP constant
3239
===================== ========================= ===========================================
40+
``--silent`` ``-2`` ``OutputInterface::VERBOSITY_SILENT``
3341
``-q`` or ``--quiet`` ``-1`` ``OutputInterface::VERBOSITY_QUIET``
3442
(none) ``0`` ``OutputInterface::VERBOSITY_NORMAL``
3543
``-v`` ``1`` ``OutputInterface::VERBOSITY_VERBOSE``
@@ -58,7 +66,7 @@ level. For example::
5866
'Password: '.$input->getArgument('password'),
5967
]);
6068

61-
// available methods: ->isQuiet(), ->isVerbose(), ->isVeryVerbose(), ->isDebug()
69+
// available methods: ->isSilent(), ->isQuiet(), ->isVerbose(), ->isVeryVerbose(), ->isDebug()
6270
if ($output->isVerbose()) {
6371
$output->writeln('User class: '.get_class($user));
6472
}
@@ -73,10 +81,19 @@ level. For example::
7381
}
7482
}
7583

76-
When the quiet level is used, all output is suppressed as the default
84+
.. versionadded:: 7.2
85+
86+
The ``isSilent()`` method was introduced in Symfony 7.2.
87+
88+
When the silent or quiet level are used, all output is suppressed as the default
7789
:method:`Symfony\\Component\\Console\\Output\\Output::write` method returns
7890
without actually printing.
7991

92+
.. tip::
93+
94+
When using the ``silent`` verbosity, errors won't be displayed in the console
95+
but they will still be logged through the :doc:`Symfony logger </logging>` integration.
96+
8097
.. tip::
8198

8299
The MonologBridge provides a :class:`Symfony\\Bridge\\Monolog\\Handler\\ConsoleHandler`

0 commit comments

Comments
 (0)