Skip to content

Commit 1fc5c2d

Browse files
committed
Merge branch '5.2' into 5.x
* 5.2: Update rounding mode defintion integer type Added a link to the related RFC [FrameworkBundle][WebLink] Config reference for the WebLink component
2 parents 8c44f29 + 8b02723 commit 1fc5c2d

File tree

2 files changed

+38
-16
lines changed

2 files changed

+38
-16
lines changed

reference/configuration/framework.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,7 @@ Configuration
304304
* `static_method`_
305305
* `translation_domain`_
306306

307+
* `web_link`_
307308
* `workflows`_
308309

309310
* :ref:`enabled <reference-workflows-enabled>`
@@ -3185,6 +3186,16 @@ headers
31853186
Headers to add to emails. The key (``name`` attribute in xml format) is the
31863187
header name and value the header value.
31873188

3189+
web_link
3190+
~~~~~~~~
3191+
3192+
enabled
3193+
.......
3194+
3195+
**type**: ``boolean`` **default**: ``true`` or ``false`` depending on your installation
3196+
3197+
Adds a `Link HTTP header`_ to the response.
3198+
31883199
workflows
31893200
~~~~~~~~~
31903201

@@ -3358,3 +3369,4 @@ to know their differences.
33583369
.. _`session.cache-limiter`: https://www.php.net/manual/en/session.configuration.php#ini.session.cache-limiter
33593370
.. _`Microsoft NTLM authentication protocol`: https://docs.microsoft.com/en-us/windows/win32/secauthn/microsoft-ntlm
33603371
.. _`utf-8 modifier`: https://www.php.net/reference.pcre.pattern.modifiers
3372+
.. _`Link HTTP header`: https://tools.ietf.org/html/rfc5988

reference/forms/types/integer.rst

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -58,31 +58,41 @@ Field Options
5858
``rounding_mode``
5959
~~~~~~~~~~~~~~~~~
6060

61-
**type**: ``integer`` **default**: ``IntegerToLocalizedStringTransformer::ROUND_DOWN``
61+
**type**: ``integer`` **default**: ``\NumberFormatter::ROUND_HALFUP``
6262

6363
By default, if the user enters a non-integer number, it will be rounded
64-
down. There are several other rounding methods and each is a constant
65-
on the :class:`Symfony\\Component\\Form\\Extension\\Core\\DataTransformer\\IntegerToLocalizedStringTransformer`:
64+
down. You have several configurable options for that rounding. Each option
65+
is a constant on the :phpclass:`NumberFormatter` class:
6666

67-
* ``IntegerToLocalizedStringTransformer::ROUND_DOWN`` Round towards zero.
67+
* ``\NumberFormatter::ROUND_DOWN`` Round towards zero. It
68+
rounds ``1.4`` to ``1`` and ``-1.4`` to ``-1``.
6869

69-
* ``IntegerToLocalizedStringTransformer::ROUND_FLOOR`` Round towards negative
70-
infinity.
70+
* ``\NumberFormatter::ROUND_FLOOR`` Round towards negative
71+
infinity. It rounds ``1.4`` to ``1`` and ``-1.4`` to ``-2``.
7172

72-
* ``IntegerToLocalizedStringTransformer::ROUND_UP`` Round away from zero.
73+
* ``\NumberFormatter::ROUND_UP`` Round away from zero. It
74+
rounds ``1.4`` to ``2`` and ``-1.4`` to ``-2``.
7375

74-
* ``IntegerToLocalizedStringTransformer::ROUND_CEILING`` Round towards
75-
positive infinity.
76+
* ``\NumberFormatter::ROUND_CEILING`` Round towards positive
77+
infinity. It rounds ``1.4`` to ``2`` and ``-1.4`` to ``-1``.
7678

77-
* ``IntegerToLocalizedStringTransformer::ROUND_HALF_DOWN`` Round towards the
78-
"nearest neighbor". If both neighbors are equidistant, round down.
79+
* ``\NumberFormatter::ROUND_HALFDOWN`` Round towards the
80+
"nearest neighbor". If both neighbors are equidistant, round down. It rounds
81+
``2.5`` and ``1.6`` to ``2``, ``1.5`` and ``1.4`` to ``1``.
7982

80-
* ``IntegerToLocalizedStringTransformer::ROUND_HALF_EVEN`` Round towards the
81-
"nearest neighbor". If both neighbors are equidistant, round towards the
82-
even neighbor.
83+
* ``\NumberFormatter::ROUND_HALFEVEN`` Round towards the
84+
"nearest neighbor". If both neighbors are equidistant, round towards the even
85+
neighbor. It rounds ``2.5``, ``1.6`` and ``1.5`` to ``2`` and ``1.4`` to ``1``.
8386

84-
* ``IntegerToLocalizedStringTransformer::ROUND_HALF_UP`` Round towards the
85-
"nearest neighbor". If both neighbors are equidistant, round up.
87+
* ``\NumberFormatter::ROUND_HALFUP`` Round towards the
88+
"nearest neighbor". If both neighbors are equidistant, round up. It rounds
89+
``2.5`` to ``3``, ``1.6`` and ``1.5`` to ``2`` and ``1.4`` to ``1``.
90+
91+
.. deprecated:: 5.1
92+
93+
In Symfony versions prior to 5.1, these constants were also defined as aliases
94+
in the :class:`Symfony\\Component\\Form\\Extension\\Core\\DataTransformer\\NumberToLocalizedStringTransformer`
95+
class, but they are now deprecated in favor of the :phpclass:`NumberFormatter` constants.
8696

8797
Overridden Options
8898
------------------

0 commit comments

Comments
 (0)