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 df57d08

Browse filesBrowse files
committed
Fix inconsistencies
1 parent 926246b commit df57d08
Copy full SHA for df57d08

File tree

3 files changed

+29
-30
lines changed
Filter options

3 files changed

+29
-30
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/PropertyAccessDecorator.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/ChoiceList/Factory/PropertyAccessDecorator.php
+18-19Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
use Symfony\Component\PropertyAccess\PropertyAccess;
1919
use Symfony\Component\PropertyAccess\PropertyAccessorInterface;
2020
use Symfony\Component\PropertyAccess\PropertyPath;
21+
use Symfony\Component\PropertyAccess\PropertyPathInterface;
2122

2223
/**
2324
* Adds property path support to a choice list factory.
@@ -59,9 +60,8 @@ public function getDecoratedFactory()
5960
/**
6061
* {@inheritdoc}
6162
*
62-
* @param iterable $choices The choices
63-
* @param callable|string|PropertyPath|null $value The callable or path for
64-
* generating the choice values
63+
* @param iterable $choices The choices
64+
* @param callable|string|PropertyPathInterface|null $value The callable or path for generating the choice values
6565
*
6666
* @return ChoiceListInterface The choice list
6767
*/
@@ -73,7 +73,7 @@ public function createListFromChoices($choices, $value = null)
7373
@trigger_error('Passing callable strings is deprecated since Symfony 3.1 and PropertyAccessDecorator will treat them as property paths in 4.0. You should use a "\Closure" instead.', E_USER_DEPRECATED);
7474
}
7575

76-
if ($value instanceof PropertyPath) {
76+
if ($value instanceof PropertyPathInterface) {
7777
$accessor = $this->propertyAccessor;
7878
$value = function ($choice) use ($accessor, $value) {
7979
// The callable may be invoked with a non-object/array value
@@ -92,9 +92,8 @@ public function createListFromChoices($choices, $value = null)
9292
/**
9393
* {@inheritdoc}
9494
*
95-
* @param ChoiceLoaderInterface $loader The choice loader
96-
* @param callable|string|PropertyPath|null $value The callable or path for
97-
* generating the choice values
95+
* @param ChoiceLoaderInterface $loader The choice loader
96+
* @param callable|string|PropertyPathInterface|null $value The callable or path for generating the choice values
9897
*
9998
* @return ChoiceListInterface The choice list
10099
*/
@@ -106,7 +105,7 @@ public function createListFromLoader(ChoiceLoaderInterface $loader, $value = nul
106105
@trigger_error('Passing callable strings is deprecated since Symfony 3.1 and PropertyAccessDecorator will treat them as property paths in 4.0. You should use a "\Closure" instead.', E_USER_DEPRECATED);
107106
}
108107

109-
if ($value instanceof PropertyPath) {
108+
if ($value instanceof PropertyPathInterface) {
110109
$accessor = $this->propertyAccessor;
111110
$value = function ($choice) use ($accessor, $value) {
112111
// The callable may be invoked with a non-object/array value
@@ -125,12 +124,12 @@ public function createListFromLoader(ChoiceLoaderInterface $loader, $value = nul
125124
/**
126125
* {@inheritdoc}
127126
*
128-
* @param ChoiceListInterface $list The choice list
129-
* @param array|callable|string|PropertyPath|null $preferredChoices The preferred choices
130-
* @param callable|string|PropertyPath|null $label The callable or path generating the choice labels
131-
* @param callable|string|PropertyPath|null $index The callable or path generating the view indices
132-
* @param callable|string|PropertyPath|null $groupBy The callable or path generating the group names
133-
* @param array|callable|string|PropertyPath|null $attr The callable or path generating the HTML attributes
127+
* @param ChoiceListInterface $list The choice list
128+
* @param array|callable|string|PropertyPathInterface|null $preferredChoices The preferred choices
129+
* @param callable|string|PropertyPathInterface|null $label The callable or path generating the choice labels
130+
* @param callable|string|PropertyPathInterface|null $index The callable or path generating the view indices
131+
* @param callable|string|PropertyPathInterface|null $groupBy The callable or path generating the group names
132+
* @param array|callable|string|PropertyPathInterface|null $attr The callable or path generating the HTML attributes
134133
*
135134
* @return ChoiceListView The choice list view
136135
*/
@@ -144,7 +143,7 @@ public function createView(ChoiceListInterface $list, $preferredChoices = null,
144143
@trigger_error('Passing callable strings is deprecated since Symfony 3.1 and PropertyAccessDecorator will treat them as property paths in 4.0. You should use a "\Closure" instead.', E_USER_DEPRECATED);
145144
}
146145

147-
if ($label instanceof PropertyPath) {
146+
if ($label instanceof PropertyPathInterface) {
148147
$label = function ($choice) use ($accessor, $label) {
149148
return $accessor->getValue($choice, $label);
150149
};
@@ -156,7 +155,7 @@ public function createView(ChoiceListInterface $list, $preferredChoices = null,
156155
@trigger_error('Passing callable strings is deprecated since Symfony 3.1 and PropertyAccessDecorator will treat them as property paths in 4.0. You should use a "\Closure" instead.', E_USER_DEPRECATED);
157156
}
158157

159-
if ($preferredChoices instanceof PropertyPath) {
158+
if ($preferredChoices instanceof PropertyPathInterface) {
160159
$preferredChoices = function ($choice) use ($accessor, $preferredChoices) {
161160
try {
162161
return $accessor->getValue($choice, $preferredChoices);
@@ -173,7 +172,7 @@ public function createView(ChoiceListInterface $list, $preferredChoices = null,
173172
@trigger_error('Passing callable strings is deprecated since Symfony 3.1 and PropertyAccessDecorator will treat them as property paths in 4.0. You should use a "\Closure" instead.', E_USER_DEPRECATED);
174173
}
175174

176-
if ($index instanceof PropertyPath) {
175+
if ($index instanceof PropertyPathInterface) {
177176
$index = function ($choice) use ($accessor, $index) {
178177
return $accessor->getValue($choice, $index);
179178
};
@@ -185,7 +184,7 @@ public function createView(ChoiceListInterface $list, $preferredChoices = null,
185184
@trigger_error('Passing callable strings is deprecated since Symfony 3.1 and PropertyAccessDecorator will treat them as property paths in 4.0. You should use a "\Closure" instead.', E_USER_DEPRECATED);
186185
}
187186

188-
if ($groupBy instanceof PropertyPath) {
187+
if ($groupBy instanceof PropertyPathInterface) {
189188
$groupBy = function ($choice) use ($accessor, $groupBy) {
190189
try {
191190
return $accessor->getValue($choice, $groupBy);
@@ -201,7 +200,7 @@ public function createView(ChoiceListInterface $list, $preferredChoices = null,
201200
@trigger_error('Passing callable strings is deprecated since Symfony 3.1 and PropertyAccessDecorator will treat them as property paths in 4.0. You should use a "\Closure" instead.', E_USER_DEPRECATED);
202201
}
203202

204-
if ($attr instanceof PropertyPath) {
203+
if ($attr instanceof PropertyPathInterface) {
205204
$attr = function ($choice) use ($accessor, $attr) {
206205
return $accessor->getValue($choice, $attr);
207206
};

‎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|bool $label The label displayed to humans
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.