Skip to content

Commit 80ba3fb

Browse files
[DependencyInjection] Allow trimming service parameters value in XML configuration files
1 parent f6d8add commit 80ba3fb

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

configuration.rst

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,8 +272,8 @@ reusable configuration value. By convention, parameters are defined under the
272272
273273
.. caution::
274274

275-
When using XML configuration, the values between ``<parameter>`` tags are
276-
not trimmed. This means that the value of the following parameter will be
275+
By default and when using XML configuration, the values between ``<parameter>``
276+
tags are not trimmed. This means that the value of the following parameter will be
277277
``'\n something@example.com\n'``:
278278

279279
.. code-block:: xml
@@ -282,10 +282,23 @@ reusable configuration value. By convention, parameters are defined under the
282282
something@example.com
283283
</parameter>
284284
285+
If you want to trim the value of your parameter, use the ``trim`` attribute.
286+
When using it, the value of the following parameter will be ``something@example.com``:
287+
288+
.. code-block:: xml
289+
290+
<parameter key="app.admin_email" trim="true">
291+
something@example.com
292+
</parameter>
293+
285294
.. versionadded:: 6.2
286295

287296
Passing an enum case as a service parameter was introduced in Symfony 6.2.
288297

298+
.. versionadded:: 6.3
299+
300+
The ``trim`` attribute was intrduced in Symfony 6.3.
301+
289302
Once defined, you can reference this parameter value from any other
290303
configuration file using a special syntax: wrap the parameter name in two ``%``
291304
(e.g. ``%app.admin_email%``):

0 commit comments

Comments
 (0)