Skip to content

Commit 0c2f735

Browse files
committed
Merge pull request #2872 from bschussek/issue8473
Updated rounding_mode documentation to reflect changed ROUND_ constants.
2 parents 0dfcdf7 + b6d5606 commit 0c2f735

File tree

2 files changed

+31
-27
lines changed

2 files changed

+31
-27
lines changed

reference/forms/types/integer.rst

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,17 +48,25 @@ By default, if the user enters a non-integer number, it will be rounded
4848
down. There are several other rounding methods, and each is a constant
4949
on the :class:`Symfony\\Component\\Form\\Extension\\Core\\DataTransformer\\IntegerToLocalizedStringTransformer`:
5050

51-
* ``IntegerToLocalizedStringTransformer::ROUND_DOWN`` Rounding mode to
52-
round towards zero.
51+
* ``IntegerToLocalizedStringTransformer::ROUND_DOWN`` Round towards zero.
5352

54-
* ``IntegerToLocalizedStringTransformer::ROUND_FLOOR`` Rounding mode to
55-
round towards negative infinity.
53+
* ``IntegerToLocalizedStringTransformer::ROUND_FLOOR`` Round towards negative
54+
infinity.
5655

57-
* ``IntegerToLocalizedStringTransformer::ROUND_UP`` Rounding mode to round
58-
away from zero.
56+
* ``IntegerToLocalizedStringTransformer::ROUND_UP`` Round away from zero.
5957

60-
* ``IntegerToLocalizedStringTransformer::ROUND_CEILING`` Rounding mode
61-
to round towards positive infinity.
58+
* ``IntegerToLocalizedStringTransformer::ROUND_CEILING`` Round towards
59+
positive infinity.
60+
61+
* ``IntegerToLocalizedStringTransformer::ROUND_HALF_DOWN`` Round towards the
62+
"nearest neighbor". If both neighbors are equidistant, round down.
63+
64+
* ``IntegerToLocalizedStringTransformer::ROUND_HALF_EVEN`` Round towards the
65+
"nearest neighbor". If both neighbors are equidistant, round towards the
66+
even neighbor.
67+
68+
* ``IntegerToLocalizedStringTransformer::ROUND_HALF_UP`` Round towards the
69+
"nearest neighbor". If both neighbors are equidistant, round up.
6270

6371
.. include:: /reference/forms/types/options/grouping.rst.inc
6472

reference/forms/types/number.rst

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -38,35 +38,31 @@ Field Options
3838
rounding_mode
3939
~~~~~~~~~~~~~
4040

41-
**type**: ``integer`` **default**: ``IntegerToLocalizedStringTransformer::ROUND_HALFUP``
41+
**type**: ``integer`` **default**: ``NumberToLocalizedStringTransformer::ROUND_HALFUP``
4242

4343
If a submitted number needs to be rounded (based on the ``precision``
4444
option), you have several configurable options for that rounding. Each
45-
option is a constant on the :class:`Symfony\\Component\\Form\\Extension\\Core\\DataTransformer\\IntegerToLocalizedStringTransformer`:
45+
option is a constant on the :class:`Symfony\\Component\\Form\\Extension\\Core\\DataTransformer\\NumberToLocalizedStringTransformer`:
4646

47-
* ``IntegerToLocalizedStringTransformer::ROUND_DOWN`` Rounding mode to
48-
round towards zero.
47+
* ``NumberToLocalizedStringTransformer::ROUND_DOWN`` Round towards zero.
4948

50-
* ``IntegerToLocalizedStringTransformer::ROUND_FLOOR`` Rounding mode to
51-
round towards negative infinity.
49+
* ``NumberToLocalizedStringTransformer::ROUND_FLOOR`` Round towards negative
50+
infinity.
5251

53-
* ``IntegerToLocalizedStringTransformer::ROUND_UP`` Rounding mode to round
54-
away from zero.
52+
* ``NumberToLocalizedStringTransformer::ROUND_UP`` Round away from zero.
5553

56-
* ``IntegerToLocalizedStringTransformer::ROUND_CEILING`` Rounding mode
57-
to round towards positive infinity.
54+
* ``NumberToLocalizedStringTransformer::ROUND_CEILING`` Round towards
55+
positive infinity.
5856

59-
* ``IntegerToLocalizedStringTransformer::ROUND_HALFDOWN`` Rounding mode
60-
to round towards "nearest neighbor" unless both neighbors are equidistant,
61-
in which case round down.
57+
* ``NumberToLocalizedStringTransformer::ROUND_HALF_DOWN`` Round towards the
58+
"nearest neighbor". If both neighbors are equidistant, round down.
6259

63-
* ``IntegerToLocalizedStringTransformer::ROUND_HALFEVEN`` Rounding mode
64-
to round towards the "nearest neighbor" unless both neighbors are equidistant,
65-
in which case, round towards the even neighbor.
60+
* ``NumberToLocalizedStringTransformer::ROUND_HALF_EVEN`` Round towards the
61+
"nearest neighbor". If both neighbors are equidistant, round towards the
62+
even neighbor.
6663

67-
* ``IntegerToLocalizedStringTransformer::ROUND_HALFUP`` Rounding mode to
68-
round towards "nearest neighbor" unless both neighbors are equidistant,
69-
in which case round up.
64+
* ``NumberToLocalizedStringTransformer::ROUND_HALF_UP`` Round towards the
65+
"nearest neighbor". If both neighbors are equidistant, round up.
7066

7167
.. include:: /reference/forms/types/options/grouping.rst.inc
7268

0 commit comments

Comments
 (0)