Skip to content

Commit 3529d3a

Browse files
committed
Merge remote-tracking branch 'upstream/6.4' into 6.4
* upstream/6.4: (29 commits) Update events.rst Tweaks Update messenger.rst Prefer placing services before query parameters Reword [Console] Fix a typo after symfony#18739 Tweaks Tweaks [Console] Improve console events doc Add the versionadded directive Tweaks Minor tweaks Clearer difference with max and quiet options [Mailer] Fix attachment changes Minor tweak Minor tweak Missing information about payload in callback [Server] Fix typo in Symfony Local Web Server page [AssetMapper] Add docs for the importmap:install command [Validator] Deprecate annotations ...
2 parents 4d66627 + 8e729dc commit 3529d3a

25 files changed

+408
-64
lines changed

components/console/events.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ the wheel, it uses the Symfony EventDispatcher component to do the work::
1717
.. caution::
1818

1919
Console events are only triggered by the main command being executed.
20-
Commands called by the main command will not trigger any event.
20+
Commands called by the main command will not trigger any event, unless
21+
run by the application itself, see :doc:`/console/calling_commands`.
2122

2223
The ``ConsoleEvents::COMMAND`` Event
2324
------------------------------------

components/console/helpers/formatterhelper.rst

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,13 @@ in the default helper set and you can get it by calling
1313

1414
The methods return a string, which you'll usually render to the console by
1515
passing it to the
16-
:method:`OutputInterface::writeln <Symfony\\Component\\Console\\Output\\OutputInterface::writeln>` method.
16+
:method:`OutputInterface::writeln <Symfony\\Component\\Console\\Output\\OutputInterface::writeln>`
17+
method.
18+
19+
.. note::
20+
21+
As an alternative, consider using the
22+
:ref:`SymfonyStyle <symfony-style-blocks>` to display stylized blocks.
1723

1824
Print Messages in a Section
1925
---------------------------

components/console/helpers/processhelper.rst

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
Process Helper
22
==============
33

4-
The Process Helper shows processes as they're running and reports
5-
useful information about process status.
4+
The Process Helper shows processes as they're running and reports useful
5+
information about process status.
66

7-
To display process details, use the :class:`Symfony\\Component\\Console\\Helper\\ProcessHelper`
8-
and run your command with verbosity. For example, running the following code with
7+
To display process details, use the
8+
:class:`Symfony\\Component\\Console\\Helper\\ProcessHelper` and run your command
9+
with verbosity. For example, running the following code with
910
a very verbose verbosity (e.g. ``-vv``)::
1011

1112
use Symfony\Component\Process\Process;

components/console/helpers/progressbar.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ information, which updates as your command runs:
66

77
.. image:: /_images/components/console/progressbar.gif
88

9+
.. note::
10+
11+
As an alternative, consider using the
12+
:ref:`SymfonyStyle <symfony-style-progressbar>` to display a progress bar.
13+
914
To display progress details, use the
1015
:class:`Symfony\\Component\\Console\\Helper\\ProgressBar`, pass it a total
1116
number of units, and advance the progress as the command executes::

components/console/helpers/questionhelper.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ first argument, an :class:`Symfony\\Component\\Console\\Output\\OutputInterface`
1515
instance as the second argument and a
1616
:class:`Symfony\\Component\\Console\\Question\\Question` as last argument.
1717

18+
.. note::
19+
20+
As an alternative, consider using the
21+
:ref:`SymfonyStyle <symfony-style-questions>` to ask questions.
22+
1823
Asking the User for Confirmation
1924
--------------------------------
2025

components/console/helpers/table.rst

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ When building a console application it may be useful to display tabular data:
1414
| 80-902734-1-6 | And Then There Were None | Agatha Christie |
1515
+---------------+--------------------------+------------------+
1616
17+
.. note::
18+
19+
As an alternative, consider using the
20+
:ref:`SymfonyStyle <symfony-style-content>` to display a table.
21+
1722
To display a table, use :class:`Symfony\\Component\\Console\\Helper\\Table`,
1823
set the headers, set the rows and then render the table::
1924

@@ -38,7 +43,7 @@ set the headers, set the rows and then render the table::
3843
])
3944
;
4045
$table->render();
41-
46+
4247
return Command::SUCCESS;
4348
}
4449
}
@@ -435,7 +440,7 @@ The only requirement to append rows is that the table must be rendered inside a
435440
$table->render();
436441

437442
$table->appendRow(['Symfony']);
438-
443+
439444
return Command::SUCCESS;
440445
}
441446
}

components/lock.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -927,7 +927,7 @@ have synchronized clocks.
927927
PostgreSqlStore
928928
~~~~~~~~~~~~~~~
929929

930-
The PdoStore relies on the `Advisory Locks`_ properties of the PostgreSQL
930+
The PostgreSqlStore relies on the `Advisory Locks`_ properties of the PostgreSQL
931931
database. That means that by using :ref:`PostgreSqlStore <lock-store-pgsql>`
932932
the locks will be automatically released at the end of the session in case the
933933
client cannot unlock for any reason.

components/phpunit_bridge.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,8 @@ message, enclosed with ``/``. For example, with:
215215
`PHPUnit`_ will stop your test suite once a deprecation notice is triggered whose
216216
message contains the ``"foobar"`` string.
217217

218+
.. _making-tests-fail:
219+
218220
Making Tests Fail
219221
~~~~~~~~~~~~~~~~~
220222

@@ -349,6 +351,10 @@ It's also possible to change verbosity per deprecation type. For example, using
349351
``quiet[]=indirect&quiet[]=other`` will hide details for deprecations of types
350352
"indirect" and "other".
351353

354+
The ``quiet`` option hides details for the specified deprecation types, but will
355+
not change the outcome in terms of exit code. That's what :ref:`max <making-tests-fail>`
356+
is for, and both settings are orthogonal.
357+
352358
Disabling the Deprecation Helper
353359
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
354360

components/validator/resources.rst

Lines changed: 45 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,14 @@ configure the locations of these files::
8686
The AnnotationLoader
8787
--------------------
8888

89-
At last, the component provides an
89+
.. deprecated:: 6.4
90+
91+
The :class:`Symfony\\Component\\Validator\\Mapping\\Loader\\AnnotationLoader`
92+
is deprecated since Symfony 6.4, use the
93+
:class:`Symfony\\Component\\Validator\\Mapping\\Loader\\AttributeLoader`
94+
instead.
95+
96+
The component provides an
9097
:class:`Symfony\\Component\\Validator\\Mapping\\Loader\\AnnotationLoader` to get
9198
the metadata from the annotations of the class. Annotations are defined as ``@``
9299
prefixed classes included in doc block comments (``/** ... */``). For example::
@@ -121,8 +128,44 @@ If you use annotations instead of attributes, it's also required to call
121128
To disable the annotation loader after it was enabled, call
122129
:method:`Symfony\\Component\\Validator\\ValidatorBuilder::disableAnnotationMapping`.
123130

131+
.. deprecated:: 6.4
132+
133+
The :method:`Symfony\\Component\\Validator\\ValidatorBuilder::enableAnnotationMapping`
134+
and :method:`Symfony\\Component\\Validator\\ValidatorBuilder::disableAnnotationMapping`
135+
methods are deprecated since Symfony 6.4, use the
136+
:method:`Symfony\\Component\\Validator\\ValidatorBuilder::enableAttributeMapping`
137+
and :method:`Symfony\\Component\\Validator\\ValidatorBuilder::disableAttributeMapping`
138+
methods instead.
139+
124140
.. include:: /_includes/_annotation_loader_tip.rst.inc
125141

142+
The AttributeLoader
143+
-------------------
144+
145+
.. versionadded:: 6.4
146+
147+
The :class:`Symfony\\Component\\Validator\\Mapping\\Loader\\AttributeLoader`
148+
was introduced in Symfony 6.4.
149+
150+
The component provides an
151+
:class:`Symfony\\Component\\Validator\\Mapping\\Loader\\AttributeLoader` to get
152+
the metadata from the attributes of the class. For example::
153+
154+
use Symfony\Component\Validator\Constraints as Assert;
155+
// ...
156+
157+
class User
158+
{
159+
#[Assert\NotBlank]
160+
protected string $name;
161+
}
162+
163+
To enable the attribute loader, call the
164+
:method:`Symfony\\Component\\Validator\\ValidatorBuilder::enableAttributeMapping` method.
165+
166+
To disable the annotation loader after it was enabled, call
167+
:method:`Symfony\\Component\\Validator\\ValidatorBuilder::disableAttributeMapping`.
168+
126169
Using Multiple Loaders
127170
----------------------
128171

@@ -136,8 +179,7 @@ multiple mappings::
136179
use Symfony\Component\Validator\Validation;
137180

138181
$validator = Validation::createValidatorBuilder()
139-
->enableAnnotationMapping(true)
140-
->addDefaultDoctrineAnnotationReader()
182+
->enableAttributeMapping()
141183
->addMethodMapping('loadValidatorMetadata')
142184
->addXmlMapping('validator/validation.xml')
143185
->getValidator();

console.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -577,6 +577,12 @@ registers an :doc:`event subscriber </event_dispatcher>` to listen to the
577577
:ref:`ConsoleEvents::TERMINATE event <console-events-terminate>` and adds a log
578578
message whenever a command doesn't finish with the ``0`` `exit status`_.
579579

580+
Using Events And Handling Signals
581+
---------------------------------
582+
583+
When a command is running, many events are dispatched, one of them allows to
584+
react to signals, read more in :doc:`this section </components/console/events>`.
585+
580586
Learn More
581587
----------
582588

@@ -596,6 +602,7 @@ tools capable of helping you with different tasks:
596602
* :doc:`/components/console/helpers/table`: displays tabular data as a table
597603
* :doc:`/components/console/helpers/debug_formatter`: provides functions to
598604
output debug information when running an external program
605+
* :doc:`/components/console/helpers/processhelper`: allows to run processes using ``DebugFormatterHelper``
599606
* :doc:`/components/console/helpers/cursor`: allows to manipulate the cursor in the terminal
600607

601608
.. _`exit status`: https://en.wikipedia.org/wiki/Exit_status

0 commit comments

Comments
 (0)