Skip to content

Commit 9bf812e

Browse files
committed
Allow NumberToLocalizedStringTransformer empty values
1 parent 17fa1fd commit 9bf812e

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function __construct(?int $scale = null, ?bool $grouping = false, ?int $r
5050
*/
5151
public function transform(mixed $value): string
5252
{
53-
if (null === $value) {
53+
if (null === $value || '' === $value) {
5454
return '';
5555
}
5656

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ public static function provideTransformations()
4949
{
5050
return [
5151
[null, '', 'de_AT'],
52-
[1, '1', 'de_AT'],
52+
['', '', 'de_AT'],
53+
[1, '1', 'de_AT'],
5354
[1.5, '1,5', 'de_AT'],
5455
[1234.5, '1234,5', 'de_AT'],
5556
[12345.912, '12345,912', 'de_AT'],

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy