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 6dfeeb5

Browse filesBrowse 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 #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 ------- 360711c [Form] Fix inconsistencies
2 parents b131278 + 360711c commit 6dfeeb5
Copy full SHA for 6dfeeb5

File tree

Expand file treeCollapse file tree

3 files changed

+13
-17
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+13
-17
lines changed

‎src/Symfony/Component/Form/ChoiceList/ArrayChoiceList.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/ChoiceList/ArrayChoiceList.php
+7-7Lines 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
*/

‎src/Symfony/Component/Form/ChoiceList/Factory/ChoiceListFactoryInterface.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/ChoiceList/Factory/ChoiceListFactoryInterface.php
+2-6Lines 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

‎src/Symfony/Component/Form/ChoiceList/View/ChoiceView.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/ChoiceList/View/ChoiceView.php
+4-4Lines 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)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.