8000 minor #32935 [Form] Fix inconsistencies (vudaltsov) · symfony/form@dc8c267 · GitHub
[go: up one dir, main page]

Skip to content

Commit dc8c267

Browse files
minor #32935 [Form] Fix inconsistencies (vudaltsov)
This PR was squashed before being merged into the 3.4 branch (closes #32935). Discussion ---------- [Form] Fix inconsistencies | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | n/a | License | MIT | Doc PR | n/a - ~~Use `@inheritdoc` in `Button` and `ButtonBuilder` where the method does satisfy the contract.~~ - ~~Add `This method should not be invoked` in all unsupported methods in `Button` and `ButtonBuilder` for consistency.~~ - ~~Fix the misused `idempotent` term in implementations of the `getFormConfig` method. It is wrong in the sense that the method does not always return the same result. You can `setAttribute` for instance and `getFormConfig` will return a different config object.~~ - ~~Add `if ($this->locked)` checks in the supported mutators.~~ - ~~Fix the arguments contract in the `ChoiceListFactoryInterface` — now it supports `PropertyPathInterface` explicitly. The downside of it — breaking LSP in the `DefaultChoiceListFactory`.~~ - Fix the `$label` phpdoc of the `ChoiceView` (arised in symfony/symfony#32237). - Use `PropertyPathInterface` instead of `PropertyPath` in `PropertyAccessDecorator` of the choice factory. - Fix `ArrayChoiceList::flatten` type hints. These changes are debatable, so feel free to correct me if I am wrong at some point. Ping @xabbuh , @HeahDude , @yceruto , @nicolas-grekas Commits ------- 360711ce4e [Form] Fix inconsistencies
2 parents 9047acd + 5a5ade8 commit dc8c267

File tree

3 files changed

+13
-17
lines changed

3 files changed

+13
-17
lines changed

ChoiceList/ArrayChoiceList.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -172,13 +172,13 @@ public function getValuesForChoices(array $choices)
172172
/**
173173
* Flattens an array into the given output variables.
174174
*
175-
* @param array $choices The array to flatten
176-
* @param callable $value The callable for generating choice values
177-
* @param array $choicesByValues The flattened choices indexed by the
178-
* corresponding values
179-
* @param array $keysByValues The original keys indexed by the
180-
* corresponding values
181-
* @param array $structuredValues The values indexed by the original keys
175+
* @param array $choices The array to flatten
176+
* @param callable $value The callable for generating choice values
177+
* @param array|null $choicesByValues The flattened choices indexed by the
178+
* corresponding values
179+
* @param array|null $keysByValues The original keys indexed by the
180+
* corresponding values
181+
* @param array|null $structuredValues The values indexed by the original keys
182182
*
183183
* @internal
184184
*/

ChoiceList/Factory/ChoiceListFactoryInterface.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ interface ChoiceListFactoryInterface
3232
* Null may be passed when the choice list contains the empty value.
3333
*
3434
* @param iterable $choices The choices
35-
* @param callable|null $value The callable generating the choice
36-
* values
35+
* @param callable|null $value The callable generating the choice values
3736
*
3837
* @return ChoiceListInterface The choice list
3938
*/
@@ -46,9 +45,7 @@ public function createListFromChoices($choices, $value = null);
4645
* The callable receives the choice as only argument.
4746
* Null may be passed when the choice list contains the empty value.
4847
*
49-
* @param ChoiceLoaderInterface $loader The choice loader
50-
* @param callable|null $value The callable generating the choice
51-
* values
48+
* @param callable|null $value The callable generating the choice values
5249
*
5350
* @return ChoiceListInterface The choice list
5451
*/
@@ -80,7 +77,6 @@ public function createListFromLoader(ChoiceLoaderInterface $loader, $value = nul
8077
* match the keys of the choices. The values should be arrays of HTML
8178
* attributes that should be added to the respective choice.
8279
*
83-
* @param ChoiceListInterface $list The choice list
8480
* @param array|callable|null $preferredChoices The preferred choices
8581
* @param callable|null $label The callable generating the
8682
* choice labels

ChoiceList/View/ChoiceView.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ class ChoiceView
3030
/**
3131
* Creates a new choice view.
3232
*
33-
* @param mixed $data The original choice
34-
* @param string $value The view representation of the choice
35-
* @param string $label The label displayed to humans
36-
* @param array $attr Additional attributes for the HTML tag
33+
* @param mixed $data The original choice
34+
* @param string $value The view representation of the choice
35+
* @param string|false $label The label displayed to humans; pass false to discard the label
36+
* @param array $attr Additional attributes for the HTML tag
3737
*/
3838
public function __construct($data, $value, $label, array $attr = [])
3939
{

0 commit comments

Comments
 (0)
0