Skip to content

Commit 5c6bdf0

Browse files
committed
minor #13654 Deprecated the NumberToLocalizedStringTransformer constants (javiereguiluz)
This PR was squashed before being merged into the master branch. Discussion ---------- Deprecated the NumberToLocalizedStringTransformer constants Fixes #13646. Commits ------- 56a4010 Deprecated the NumberToLocalizedStringTransformer constants
2 parents 3b2031b + 56a4010 commit 5c6bdf0

File tree

1 file changed

+17
-11
lines changed

1 file changed

+17
-11
lines changed
Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,38 @@
11
rounding_mode
22
~~~~~~~~~~~~~
33

4-
**type**: ``integer`` **default**: ``NumberToLocalizedStringTransformer::ROUND_HALF_UP``
4+
**type**: ``integer`` **default**: ``\NumberFormatter::ROUND_HALFUP``
55

6-
If a submitted number needs to be rounded (based on the `scale`_
7-
option), you have several configurable options for that rounding. Each
8-
option is a constant on the :class:`Symfony\\Component\\Form\\Extension\\Core\\DataTransformer\\NumberToLocalizedStringTransformer`:
6+
If a submitted number needs to be rounded (based on the `scale`_ option), you
7+
have several configurable options for that rounding. Each option is a constant
8+
on the ``\NumberFormatter`` class:
99

10-
* ``NumberToLocalizedStringTransformer::ROUND_DOWN`` Round towards zero. It
10+
* ``\NumberFormatter::ROUND_DOWN`` Round towards zero. It
1111
rounds ``1.4`` to ``1`` and ``-1.4`` to ``-1``.
1212

13-
* ``NumberToLocalizedStringTransformer::ROUND_FLOOR`` Round towards negative
13+
* ``\NumberFormatter::ROUND_FLOOR`` Round towards negative
1414
infinity. It rounds ``1.4`` to ``1`` and ``-1.4`` to ``-2``.
1515

16-
* ``NumberToLocalizedStringTransformer::ROUND_UP`` Round away from zero. It
16+
* ``\NumberFormatter::ROUND_UP`` Round away from zero. It
1717
rounds ``1.4`` to ``2`` and ``-1.4`` to ``-2``.
1818

19-
* ``NumberToLocalizedStringTransformer::ROUND_CEILING`` Round towards positive
19+
* ``\NumberFormatter::ROUND_CEILING`` Round towards positive
2020
infinity. It rounds ``1.4`` to ``2`` and ``-1.4`` to ``-1``.
2121

22-
* ``NumberToLocalizedStringTransformer::ROUND_HALF_DOWN`` Round towards the
22+
* ``\NumberFormatter::ROUND_HALFDOWN`` Round towards the
2323
"nearest neighbor". If both neighbors are equidistant, round down. It rounds
2424
``2.5`` and ``1.6`` to ``2``, ``1.5`` and ``1.4`` to ``1``.
2525

26-
* ``NumberToLocalizedStringTransformer::ROUND_HALF_EVEN`` Round towards the
26+
* ``\NumberFormatter::ROUND_HALFEVEN`` Round towards the
2727
"nearest neighbor". If both neighbors are equidistant, round towards the even
2828
neighbor. It rounds ``2.5``, ``1.6`` and ``1.5`` to ``2`` and ``1.4`` to ``1``.
2929

30-
* ``NumberToLocalizedStringTransformer::ROUND_HALF_UP`` Round towards the
30+
* ``\NumberFormatter::ROUND_HALFUP`` Round towards the
3131
"nearest neighbor". If both neighbors are equidistant, round up. It rounds
3232
``2.5`` to ``3``, ``1.6`` and ``1.5`` to ``2`` and ``1.4`` to ``1``.
33+
34+
.. deprecated:: 5.1
35+
36+
In Symfony versions prior to 5.1, these constants were also defined as aliases
37+
in the :class:`Symfony\\Component\\Form\\Extension\\Core\\DataTransformer\\NumberToLocalizedStringTransformer`
38+
class, but they are now deprecated in favor of the ``\NumberFormatter`` constants.

0 commit comments

Comments
 (0)