@@ -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
6363By 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
8797Overridden Options
8898------------------
0 commit comments