8000 Remove the scale argument of the IntegerToLocalizedStringTransformer · symfony/symfony@17028df · GitHub
[go: up one dir, main page]

Skip to content

Commit 17028df

Browse files
committed
Remove the scale argument of the IntegerToLocalizedStringTransformer
1 parent bb9cf60 commit 17028df

File tree

3 files changed

+2
-51
lines changed

3 files changed

+2
-51
lines changed

src/Symfony/Component/Form/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ CHANGELOG
77
* removed the `ChoiceLoaderInterface` implementation in `CountryType`, `LanguageType`, `LocaleType` and `CurrencyType`
88
* removed `getExtendedType()` method of the `FormTypeExtensionInterface`
99
* added static `getExtendedTypes()` method to the `FormTypeExtensionInterface`
10+
* removed the `$scale` argument of the `IntegerToLocalizedStringTransformer`
1011

1112
4.3.0
1213
-----

src/Symfony/Component/Form/Extension/Core/DataTransformer/IntegerToLocalizedStringTransformer.php

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,8 @@ class IntegerToLocalizedStringTransformer extends NumberToLocalizedStringTransfo
2727
* @param bool $grouping Whether thousands should be grouped
2828
* @param int $roundingMode One of the ROUND_ constants in this class
2929
*/
30-
public function __construct($grouping = false, $roundingMode = self::ROUND_DOWN)
30+
public function __construct(?bool $grouping = false, ?int $roundingMode = self::ROUND_DOWN)
3131
{
32-
if (\is_int($grouping) || \is_bool($roundingMode) || 2 < \func_num_args()) {
33-
@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);
34-
35-
$grouping = $roundingMode;
36-
$roundingMode = 2 < \func_num_args() ? func_get_arg(2) : self::ROUND_DOWN;
37-
}
38-
3932
parent::__construct(0, $grouping, $roundingMode);
4033
}
4134

src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/IntegerToLocalizedStringTransformerTest.php

Lines changed: 0 additions & 43 deletions
< 8000 /div>
Original file line numberDiff line numberDiff line change
@@ -91,18 +91,6 @@ public function testTransformWithRounding($input, $output, $roundingMode)
9191
$this->assertEquals($output, $transformer->transform($input));
9292
}
9393

94-
/**
95-
* @group legacy
96-
* @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.
97-
* @dataProvider transformWithRoundingProvider
98-
*/
99-
public function testTransformWithRoundingUsingLegacyConstructorSignature($input, $output, $roundingMode)
100-
{
101-
$transformer = new IntegerToLocalizedStringTransformer(null, null, $roundingMode);
102-
103-
$this->assertEquals($output, $transformer->transform($input));
104-
}
105-
10694
public function testReverseTransform()
10795
{
10896
// Since we test against "de_AT", we need the full implementation
@@ -138,25 +126,6 @@ public function testReverseTransformWithGrouping()
138126
$this->assertEquals(12345, $transformer->reverseTransform('12345'));
139127
}
140128

141-
/**
142-
* @group legacy
143-
* @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.
144-
*/
145-
public function testReverseTransformWithGroupingUsingLegacyConstructorSignature()
146-
{
147-
// Since we test against "de_DE", we need the full implementation
148-
IntlTestHelper::requireFullIntl($this, false);
149-
150-
\Locale::setDefault('de_DE');
151-
152-
$transformer = new IntegerToLocalizedStringTransformer(null, true);
153-
154-
$this->assertEquals(1234, $transformer->reverseTransform('1.234'));
155-
$this->assertEquals(12345, $transformer->reverseTransform('12.345'));
156-
$this->assertEquals(1234, $transformer->reverseTransform('1234'));
157-
$this->assertEquals(12345, $transformer->reverseTransform('12345'));
158-
}
159-
160129
public function reverseTransformWithRoundingProvider()
161130
{
162131
return [
@@ -218,18 +187,6 @@ public function testReverseTransformWithRounding($input, $output, $roundingMode)
218187
$this->assertEquals($output, $transformer->reverseTransform($input));
219188
}
220189

221-
/**
222-
* @group legacy
223-
* @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.
224-
* @dataProvider reverseTransformWithRoundingProvider
225-
*/
226-
public function testReverseTransformWithRoundingUsingLegacyConstructorSignature($input, $output, $roundingMode)
227-
{
228-
$transformer = new IntegerToLocalizedStringTransformer(null, null, $roundingMode);
229-
230-
$this->assertEquals($output, $transformer->reverseTransform($input));
231-
}
232-
233190
/**
234191
* @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
235192
*/

0 commit comments

Comments
 (0)
0