From 2cef8a2a2a44a71b51772d1fdd78fd5817084d7f Mon Sep 17 00:00:00 2001 From: Yonel Ceruto Date: Wed, 29 May 2019 15:02:23 -0400 Subject: [PATCH] Remove the scale argument of the IntegerToLocalizedStringTransformer --- src/Symfony/Component/Form/CHANGELOG.md | 1 + .../IntegerToLocalizedStringTransformer.php | 9 +--- ...ntegerToLocalizedStringTransformerTest.php | 43 ------------------- 3 files changed, 2 insertions(+), 51 deletions(-) diff --git a/src/Symfony/Component/Form/CHANGELOG.md b/src/Symfony/Component/Form/CHANGELOG.md index 91b30426e4ffb..34d3d196d439d 100644 --- a/src/Symfony/Component/Form/CHANGELOG.md +++ b/src/Symfony/Component/Form/CHANGELOG.md @@ -11,6 +11,7 @@ CHANGELOG * added static `getExtendedTypes()` method to the `FormTypeExtensionInterface` * calling to `FormRenderer::searchAndRenderBlock()` method for fields which were already rendered throw a `BadMethodCallException` * removed the `regions` option of the `TimezoneType` + * removed the `$scale` argument of the `IntegerToLocalizedStringTransformer` 4.3.0 ----- diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/IntegerToLocalizedStringTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/IntegerToLocalizedStringTransformer.php index 392aa49e51a19..68ba2c0227da4 100644 --- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/IntegerToLocalizedStringTransformer.php +++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/IntegerToLocalizedStringTransformer.php @@ -27,15 +27,8 @@ class IntegerToLocalizedStringTransformer extends NumberToLocalizedStringTransfo * @param bool $grouping Whether thousands should be grouped * @param int $roundingMode One of the ROUND_ constants in this class */ - public function __construct($grouping = false, $roundingMode = self::ROUND_DOWN) + public function __construct(?bool $grouping = false, ?int $roundingMode = self::ROUND_DOWN) { - if (\is_int($grouping) || \is_bool($roundingMode) || 2 < \func_num_args()) { - @trigger_error(sprintf('Passing a precision as the first value to %s::__construct() is deprecated since Symfony 4.2 and support for it will be dropped in 5.0.', __CLASS__), E_USER_DEPRECATED); - - $grouping = $roundingMode; - $roundingMode = 2 < \func_num_args() ? func_get_arg(2) : self::ROUND_DOWN; - } - parent::__construct(0, $grouping, $roundingMode); } diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/IntegerToLocalizedStringTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/IntegerToLocalizedStringTransformerTest.php index 691efc6e830b3..adfc0dd63cee4 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/IntegerToLocalizedStringTransformerTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/IntegerToLocalizedStringTransformerTest.php @@ -91,18 +91,6 @@ public function testTransformWithRounding($input, $output, $roundingMode) $this->assertEquals($output, $transformer->transform($input)); } - /** - * @group legacy - * @expectedDeprecation Passing a precision as the first value to %s::__construct() is deprecated since Symfony 4.2 and support for it will be dropped in 5.0. - * @dataProvider transformWithRoundingProvider - */ - public function testTransformWithRoundingUsingLegacyConstructorSignature($input, $output, $roundingMode) - { - $transformer = new IntegerToLocalizedStringTransformer(null, null, $roundingMode); - - $this->assertEquals($output, $transformer->transform($input)); - } - public function testReverseTransform() { // Since we test against "de_AT", we need the full implementation @@ -138,25 +126,6 @@ public function testReverseTransformWithGrouping() $this->assertEquals(12345, $transformer->reverseTransform('12345')); } - /** - * @group legacy - * @expectedDeprecation Passing a precision as the first value to %s::__construct() is deprecated since Symfony 4.2 and support for it will be dropped in 5.0. - */ - public function testReverseTransformWithGroupingUsingLegacyConstructorSignature() - { - // Since we test against "de_DE", we need the full implementation - IntlTestHelper::requireFullIntl($this, false); - - \Locale::setDefault('de_DE'); - - $transformer = new IntegerToLocalizedStringTransformer(null, true); - - $this->assertEquals(1234, $transformer->reverseTransform('1.234')); - $this->assertEquals(12345, $transformer->reverseTransform('12.345')); - $this->assertEquals(1234, $transformer->reverseTransform('1234')); - $this->assertEquals(12345, $transformer->reverseTransform('12345')); - } - public function reverseTransformWithRoundingProvider() { return [ @@ -218,18 +187,6 @@ public function testReverseTransformWithRounding($input, $output, $roundingMode) $this->assertEquals($output, $transformer->reverseTransform($input)); } - /** - * @group legacy - * @expectedDeprecation Passing a precision as the first value to %s::__construct() is deprecated since Symfony 4.2 and support for it will be dropped in 5.0. - * @dataProvider reverseTransformWithRoundingProvider - */ - public function testReverseTransformWithRoundingUsingLegacyConstructorSignature($input, $output, $roundingMode) - { - $transformer = new IntegerToLocalizedStringTransformer(null, null, $roundingMode); - - $this->assertEquals($output, $transformer->reverseTransform($input)); - } - /** * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException */