[Form] removed precision option

This commit is contained in:
Fabien Potencier 2015-10-01 10:11:41 +02:00
parent 17cedd3435
commit bfba6caebf
4 changed files with 4 additions and 48 deletions

View File

@ -37,19 +37,9 @@ class IntegerType extends AbstractType
*/
public function configureOptions(OptionsResolver $resolver)
{
$scale = function (Options $options) {
if (null !== $options['precision']) {
@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);
}
return $options['precision'];
};
$resolver->setDefaults(array(
// deprecated as of Symfony 2.7, to be removed in Symfony 3.0.
'precision' => null,
// default scale is locale specific (usually around 3)
'scale' => $scale,
'scale' => null,
'grouping' => false,
// Integer cast rounds towards 0, so do the same when displaying fractions
'rounding_mode' => IntegerToLocalizedStringTransformer::ROUND_DOWN,

View File

@ -51,20 +51,8 @@ class MoneyType extends AbstractType
*/
public function configureOptions(OptionsResolver $resolver)
{
$scale = function (Options $options) {
if (null !== $options['precision']) {
@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);
return $options['precision'];
}
return 2;
};
$resolver->setDefaults(array(
// deprecated as of Symfony 2.7, to be removed in Symfony 3.0
'precision' => null,
'scale' => $scale,
'scale' => 2,
'grouping' => false,
'divisor' => 1,
'currency' => 'EUR',

View File

@ -36,19 +36,9 @@ class NumberType extends AbstractType
*/
public function configureOptions(OptionsResolver $resolver)
{
$scale = function (Options $options) {
if (null !== $options['precision']) {
@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);
}
return $options['precision'];
};
$resolver->setDefaults(array(
// deprecated as of Symfony 2.7, to be removed in Symfony 3.0
'precision' => null,
// default scale is locale specific (usually around 3)
'scale' => $scale,
'scale' => null,
'grouping' => false,
'rounding_mode' => NumberToLocalizedStringTransformer::ROUND_HALF_UP,
'compound' => false,

View File

@ -32,20 +32,8 @@ class PercentType extends AbstractType
*/
public function configureOptions(OptionsResolver $resolver)
{
$scale = function (Options $options) {
if (null !== $options['precision']) {
@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);
return $options['precision'];
}
return 0;
};
$resolver->setDefaults(array(
// deprecated as of Symfony 2.7, to be removed in Symfony 3.0.
'precision' => null,
'scale' => $scale,
'scale' => 0,
'type' => 'fractional',
'compound' => false,
));