Skip to content

Commit f143c8f

Browse files
minor #41453 [Form] Document null support in NumberToLocalizedStringTransformer (mbabker)
This PR was merged into the 4.4 branch. Discussion ---------- [Form] Document null support in NumberToLocalizedStringTransformer | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | N/A | License | MIT | Doc PR | N/A `Symfony\Component\Form\Extension\Core\DataTransformer\NumberToLocalizedStringTransformer` explicitly checks for and returns nulls but these aren't documented in the class' doc blocks, which causes static analysis tools to report a false positive when checking for these null values elsewhere. This adds the missing null types to the doc blocks. Commits ------- 1fda3d0 Document null support in NumberToLocalizedStringTransformer
2 parents b439213 + 1fda3d0 commit f143c8f

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function __construct(?int $scale = 2, ?bool $grouping = true, ?int $round
4545
/**
4646
* Transforms a normalized format into a localized money string.
4747
*
48-
* @param int|float $value Normalized number
48+
* @param int|float|null $value Normalized number
4949
*
5050
* @return string Localized money string
5151
*
@@ -69,7 +69,7 @@ public function transform($value)
6969
*
7070
* @param string $value Localized money string
7171
*
72-
* @return int|float Normalized number
72+
* @return int|float|null Normalized number
7373
*
7474
* @throws TransformationFailedException if the given value is not a string
7575
* or if the value can not be transformed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public function __construct(int $scale = null, ?bool $grouping = false, ?int $ro
9898
/**
9999
* Transforms a number type into localized number.
100100
*
101-
* @param int|float $value Number value
101+
* @param int|float|null $value Number value
102102
*
103103
* @return string Localized value
104104
*
@@ -133,7 +133,7 @@ public function transform($value)
133133
*
134134
* @param string $value The localized value
135135
*
136-
* @return int|float The numeric value
136+
* @return int|float|null The numeric value
137137
*
138138
* @throws TransformationFailedException if the given value is not a string
139139
* or if the value can not be transformed

0 commit comments

Comments
 (0)