Skip to content

Commit d310abb

Browse files
committed
Allow NumberToLocalizedStringTransformer empty values
1 parent c1d73b1 commit d310abb

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
@@ -48,7 +48,7 @@ public function __construct(
4848
*/
4949
public function transform(mixed $value): string
5050
{
51-
if (null === $value) {
51+
if (null === $value || '' === $value) {
5252
return '';
5353
}
5454

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