8000 [Form] only use PropertyPath if not already callable · symfony/symfony@470b140 · GitHub
[go: up one dir, main page]

Skip to content

Commit 470b140

Browse files
committed
[Form] only use PropertyPath if not already callable
1 parent f79c487 commit 470b140

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/Symfony/Component/Form/ChoiceList/Factory/PropertyAccessDecorator.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public function getDecoratedFactory()
8484
*/
8585
public function createListFromChoices($choices, $value = null)
8686
{
87-
if (is_string($value)) {
87+
if (is_string($value) && !is_callable($value)) {
8888
$value = new PropertyPath($value);
8989
}
9090

@@ -134,7 +134,7 @@ public function createListFromFlippedChoices($choices, $value = null)
134134
*/
135135
public function createListFromLoader(ChoiceLoaderInterface< 10000 /span> $loader, $value = null)
136136
{
137-
if (is_string($value)) {
137+
if (is_string($value) && !is_callable($value)) {
138138
$value = new PropertyPath($value);
139139
}
140140

@@ -164,7 +164,7 @@ public function createView(ChoiceListInterface $list, $preferredChoices = null,
164164
{
165165
$accessor = $this->propertyAccessor;
166166

167-
if (is_string($label)) {
167+
if (is_string($label) && !is_callable($label)) {
168168
$label = new PropertyPath($label);
169169
}
170170

@@ -174,7 +174,7 @@ public function createView(ChoiceListInterface $list, $preferredChoices = null,
174174
};
175175
}
176176

177-
if (is_string($preferredChoices)) {
177+
if (is_string($preferredChoices) && !is_callable($preferredChoices)) {
178178
$preferredChoices = new PropertyPath($preferredChoices);
179179
}
180180

@@ -189,7 +189,7 @@ public function createView(ChoiceListInterface $list, $preferredChoices = null,
189189
};
190190
}
191191

192-
if (is_string($index)) {
192+
if (is_string($index) && !is_callable($index)) {
193193
$index = new PropertyPath($index);
194194
}
195195

@@ -199,7 +199,7 @@ public function createView(ChoiceListInterface $list, $preferredChoices = null,
199199
};
200200
}
201201

202-
if (is_string($groupBy)) {
202+
if (is_string($groupBy) && !is_callable($groupBy)) {
203203
$groupBy = new PropertyPath($groupBy);
204204
}
205205

@@ -213,7 +213,7 @@ public function createView(ChoiceListInterface $list, $preferredChoices = null,
213213
};
214214
}
215215

216-
if (is_string($attr)) {
216+
if (is_string($attr) && !is_callable($attr)) {
217217
$attr = new PropertyPath($attr);
218218
}
219219

0 commit comments

Comments
 (0)
0