Skip to content

[Validator] removed deprecated features in Validator and Form #16024

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Oct 1, 2015
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[Form] removed precision option
  • Loading branch information
fabpot committed Oct 1, 2015
commit bfba6caebfc1211af785b08046e6f33c4916a5cc
12 changes: 1 addition & 11 deletions src/Symfony/Component/Form/Extension/Core/Type/IntegerType.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,9 @@ public function buildForm(FormBuilderInterface $builder, array $options)
*/
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,
Expand Down
14 changes: 1 addition & 13 deletions src/Symfony/Component/Form/Extension/Core/Type/MoneyType.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,20 +51,8 @@ public function buildView(FormView $view, FormInterface $form, array $options)
*/
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',
Expand Down
12 changes: 1 addition & 11 deletions src/Symfony/Component/Form/Extension/Core/Type/NumberType.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,9 @@ public function buildForm(FormBuilderInterface $builder, array $options)
*/
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,
Expand Down
14 changes: 1 addition & 13 deletions src/Symfony/Component/Form/Extension/Core/Type/PercentType.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,8 @@ public function buildForm(FormBuilderInterface $builder, array $options)
*/
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,
));
Expand Down