Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 884f74f

Browse filesBrowse files
committed
IntegerType: Always use en for IntegerToLocalizedStringTransformer
Fixes #40456
1 parent 5dd56a6 commit 884f74f
Copy full SHA for 884f74f

File tree

Expand file treeCollapse file tree

2 files changed

+12
-6
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+12
-6
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/Extension/Core/DataTransformer/IntegerToLocalizedStringTransformer.php
+9-5Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,23 @@ class IntegerToLocalizedStringTransformer extends NumberToLocalizedStringTransfo
2424
/**
2525
* Constructs a transformer.
2626
*
27-
* @param bool $grouping Whether thousands should be grouped
28-
* @param int $roundingMode One of the ROUND_ constants in this class
27+
* @param bool $grouping Whether thousands should be grouped
28+
* @param int $roundingMode One of the ROUND_ constants in this class
29+
* @param string|null $locale locale used for transforming.
2930
*/
30-
public function __construct($grouping = false, $roundingMode = self::ROUND_DOWN)
31+
public function __construct($grouping = false, $roundingMode = self::ROUND_DOWN, $locale = null)
3132
{
3233
if (\is_int($grouping) || \is_bool($roundingMode) || 2 < \func_num_args()) {
3334
@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);
3435

3536
$grouping = $roundingMode;
3637
$roundingMode = 2 < \func_num_args() ? func_get_arg(2) : self::ROUND_DOWN;
3738
}
38-
39-
parent::__construct(0, $grouping, $roundingMode);
39+
if ($locale === null) {
40+
parent::__construct(0, $grouping, $roundingMode);
41+
} else {
42+
parent::__construct(0, $grouping, $roundingMode, $locale);
43+
}
4044
}
4145

4246
/**

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/Extension/Core/Type/IntegerType.php
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ class IntegerType extends AbstractType
2525
*/
2626
public function buildForm(FormBuilderInterface $builder, array $options)
2727
{
28-
$builder->addViewTransformer(new IntegerToLocalizedStringTransformer($options['grouping'], $options['rounding_mode']));
28+
$builder->addViewTransformer(
29+
new IntegerToLocalizedStringTransformer($options['grouping'], $options['rounding_mode'], 'en')
30+
);
2931
}
3032

3133
/**

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.