Skip to content

Commit bfba6ca

Browse files
committed
[Form] removed precision option
1 parent 17cedd3 commit bfba6ca

File tree

4 files changed

+4
-48
lines changed

4 files changed

+4
-48
lines changed

src/Symfony/Component/Form/Extension/Core/Type/IntegerType.php

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -37,19 +37,9 @@ public function buildForm(FormBuilderInterface $builder, array $options)
3737
*/
3838
public function configureOptions(OptionsResolver $resolver)
3939
{
40-
$scale = function (Options $options) {
41-
if (null !== $options['precision']) {
42-
@trigger_error('The form option "precision" is deprecated since version 2.7 and will be removed in 3.0. Use "scale" instead.', E_USER_DEPRECATED);
43-
}
44-
45-
return $options['precision'];
46-
};
47-
4840
$resolver->setDefaults(array(
49-
// deprecated as of Symfony 2.7, to be removed in Symfony 3.0.
50-
'precision' => null,
5141
// default scale is locale specific (usually around 3)
52-
'scale' => $scale,
42+
'scale' => null,
5343
'grouping' => false,
5444
// Integer cast rounds towards 0, so do the same when displaying fractions
5545
'rounding_mode' => IntegerToLocalizedStringTransformer::ROUND_DOWN,

src/Symfony/Component/Form/Extension/Core/Type/MoneyType.php

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -51,20 +51,8 @@ public function buildView(FormView $view, FormInterface $form, array $options)
5151
*/
5252
public function configureOptions(OptionsResolver $resolver)
5353
{
54-
$scale = function (Options $options) {
55-
if (null !== $options['precision']) {
56-
@trigger_error('The form option "precision" is deprecated since version 2.7 and will be removed in 3.0. Use "scale" instead.', E_USER_DEPRECATED);
57-
58-
return $options['precision'];
59-
}
60-
61-
return 2;
62-
};
63-
6454
$resolver->setDefaults(array(
65-
// deprecated as of Symfony 2.7, to be removed in Symfony 3.0
66-
'precision' => null,
67-
'scale' => $scale,
55+
'scale' => 2,
6856
'grouping' => false,
6957
'divisor' => 1,
7058
'currency' => 'EUR',

src/Symfony/Component/Form/Extension/Core/Type/NumberType.php

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,9 @@ public function buildForm(FormBuilderInterface $builder, array $options)
3636
*/
3737
public function configureOptions(OptionsResolver $resolver)
3838
{
39-
$scale = function (Options $options) {
40-
if (null !== $options['precision']) {
41-
@trigger_error('The form option "precision" is deprecated since version 2.7 and will be removed in 3.0. Use "scale" instead.', E_USER_DEPRECATED);
42-
}
43-
44-
return $options['precision'];
45-
};
46-
4739
$resolver->setDefaults(array(
48-
// deprecated as of Symfony 2.7, to be removed in Symfony 3.0
49-
'precision' => null,
5040
// default scale is locale specific (usually around 3)
51-
'scale' => $scale,
41+
'scale' => null,
5242
'grouping' => false,
5343
'rounding_mode' => NumberToLocalizedStringTransformer::ROUND_HALF_UP,
5444
'compound' => false,

src/Symfony/Component/Form/Extension/Core/Type/PercentType.php

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -32,20 +32,8 @@ public function buildForm(FormBuilderInterface $builder, array $options)
3232
*/
3333
public function configureOptions(OptionsResolver $resolver)
3434
{
35-
$scale = function (Options $options) {
36-
if (null !== $options['precision']) {
37-
@trigger_error('The form option "precision" is deprecated since version 2.7 and will be removed in 3.0. Use "scale" instead.', E_USER_DEPRECATED);
38-
39-
return $options['precision'];
40-
}
41-
42-
return 0;
43-
};
44-
4535
$resolver->setDefaults(array(
46-
// deprecated as of Symfony 2.7, to be removed in Symfony 3.0.
47-
'precision' => null,
48-
'scale' => $scale,
36+
'scale' => 0,
4937
'type' => 'fractional',
5038
'compound' => false,
5139
));

0 commit comments

Comments
 (0)