You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
bug #36578 [Form] deprecate not using a rounding mode (xabbuh)
This PR was merged into the 5.1-dev branch.
Discussion
----------
[Form] deprecate not using a rounding mode
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | no
| Deprecations? | yes
| Tickets |
| License | MIT
| Doc PR |
Commits
-------
25ba1a2 deprecate not using a rounding mode
Copy file name to clipboardExpand all lines: UPGRADE-5.1.md
+2Lines changed: 2 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -39,6 +39,8 @@ EventDispatcher
39
39
Form
40
40
----
41
41
42
+
* Not configuring the `rounding_mode` option of the `PercentType` is deprecated. It will default to `PercentToLocalizedStringTransformer::ROUND_HALF_UP` in Symfony 6.
43
+
* Not passing a rounding mode to the constructor of `PercentToLocalizedStringTransformer` is deprecated. It will default to `ROUND_HALF_UP` in Symfony 6.
42
44
* Implementing the `FormConfigInterface` without implementing the `getIsEmptyCallback()` method
43
45
is deprecated. The method will be added to the interface in 6.0.
44
46
* Implementing the `FormConfigBuilderInterface` without implementing the `setIsEmptyCallback()` method
Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/CHANGELOG.md
+2Lines changed: 2 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -4,6 +4,8 @@ CHANGELOG
4
4
5.1.0
5
5
-----
6
6
7
+
* Deprecated not configuring the `rounding_mode` option of the `PercentType`. It will default to `PercentToLocalizedStringTransformer::ROUND_HALF_UP` in Symfony 6.
8
+
* Deprecated not passing a rounding mode to the constructor of `PercentToLocalizedStringTransformer`. It will default to `ROUND_HALF_UP` in Symfony 6.
7
9
* Added `collection_entry` block prefix to `CollectionType` entries
8
10
* Added a `choice_filter` option to `ChoiceType`
9
11
* Added argument `callable|null $filter` to `ChoiceListFactoryInterface::createListFromChoices()` and `createListFromLoader()` - not defining them is deprecated.
trigger_deprecation('symfony/form', '5.1', sprintf('Not passing a rounding mode to %s() is deprecated. Starting with Symfony 6.0 it will default to "%s::ROUND_HALF_UP".', __METHOD__, __CLASS__));
108
107
}
109
108
110
109
if (!\in_array($type, self::$types, true)) {
@@ -235,7 +234,10 @@ protected function getNumberFormatter()
235
234
$formatter = new \NumberFormatter(\Locale::getDefault(), \NumberFormatter::DECIMAL);
trigger_deprecation('symfony/form', '5.1', sprintf('Not configuring the "rounding_mode" option is deprecated. It will default to "%s::ROUND_HALF_UP" in Symfony 6.0.', PercentToLocalizedStringTransformer::class));
54
+
55
+
returnnull;
56
+
},
52
57
'symbol' => '%',
53
58
'type' => 'fractional',
54
59
'compound' => false,
@@ -59,16 +64,24 @@ public function configureOptions(OptionsResolver $resolver)
$resolver->setDeprecated('rounding_mode', 'symfony/form', '5.1', function (Options$options, $roundingMode) {
79
+
if (null === $roundingMode) {
80
+
returnsprintf('Not configuring the "rounding_mode" option is deprecated. It will default to "%s::ROUND_HALF_UP" in Symfony 6.0.', PercentToLocalizedStringTransformer::class);
Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/PercentToLocalizedStringTransformerTest.php
$this->expect
10000
Deprecation('Since symfony/form 5.1: Not passing a rounding mode to Symfony\Component\Form\Extension\Core\DataTransformer\PercentToLocalizedStringTransformer::__construct() is deprecated. Starting with Symfony 6.0 it will default to Symfony\Component\Form\Extension\Core\DataTransformer\PercentToLocalizedStringTransformer::ROUND_HALF_UP.');
0 commit comments