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 868410f

Browse filesBrowse files
[Form] fix some type annotations
1 parent ba7e97d commit 868410f
Copy full SHA for 868410f

File tree

Expand file treeCollapse file tree

7 files changed

+39
-106
lines changed
Filter options
Expand file treeCollapse file tree

7 files changed

+39
-106
lines changed

‎src/Symfony/Component/Form/Button.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/Button.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -371,8 +371,8 @@ public function handleRequest($request = null)
371371
/**
372372
* Submits data to the button.
373373
*
374-
* @param string|null $submittedData Not used
375-
* @param bool $clearMissing Not used
374+
* @param array|string|null $submittedData Not used
375+
* @param bool $clearMissing Not used
376376
*
377377
* @return $this
378378
*

‎src/Symfony/Component/Form/ButtonBuilder.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/ButtonBuilder.php
-78Lines changed: 0 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,6 @@ public function create($name, $type = null, array $options = [])
101101
/**
102102
* Unsupported method.
103103
*
104-
* This method should not be invoked.
105-
*
106-
* @param string $name
107-
*
108104
* @throws BadMethodCallException
109105
*/
110106
public function get($name)
@@ -115,10 +111,6 @@ public function get($name)
115111
/**
116112
* Unsupported method.
117113
*
118-
* This method should not be invoked.
119-
*
120-
* @param string $name
121-
*
122114
* @throws BadMethodCallException
123115
*/
124116
public function remove($name)
@@ -129,8 +121,6 @@ public function remove($name)
129121
/**
130122
* Unsupported method.
131123
*
132-
* @param string $name
133-
*
134124
* @return bool Always returns false
135125
*/
136126
public function has($name)
@@ -161,12 +151,6 @@ public function getForm()
161151
/**
162152
* Unsupported method.
163153
*
164-
* This method should not be invoked.
165-
*
166-
* @param string $eventName
167-
* @param callable $listener
168-
* @param int $priority
169-
*
170154
* @throws BadMethodCallException
171155
*/
172156
public function addEventListener($eventName, $listener, $priority = 0)
@@ -177,8 +161,6 @@ public function addEventListener($eventName, $listener, $priority = 0)
177161
/**
178162
* Unsupported method.
179163
*
180-
* This method should not be invoked.
181-
*
182164
* @throws BadMethodCallException
183165
*/
184166
public function addEventSubscriber(EventSubscriberInterface $subscriber)
@@ -189,10 +171,6 @@ public function addEventSubscriber(EventSubscriberInterface $subscriber)
189171
/**
190172
* Unsupported method.
191173
*
192-
* This method should not be invoked.
193-
*
194-
* @param bool $forcePrepend
195-
*
196174
* @throws BadMethodCallException
197175
*/
198176
public function addViewTransformer(DataTransformerInterface $viewTransformer, $forcePrepend = false)
@@ -203,8 +181,6 @@ public function addViewTransformer(DataTransformerInterface $viewTransformer, $f
203181
/**
204182
* Unsupported method.
205183
*
206-
* This method should not be invoked.
207-
*
208184
* @throws BadMethodCallException
209185
*/
210186
public function resetViewTransformers()
@@ -215,10 +191,6 @@ public function resetViewTransformers()
215191
/**
216192
* Unsupported method.
217193
*
218-
* This method should not be invoked.
219-
*
220-
* @param bool $forceAppend
221-
*
222194
* @throws BadMethodCallException
223195
*/
224196
public function addModelTransformer(DataTransformerInterface $modelTransformer, $forceAppend = false)
@@ -229,8 +201,6 @@ public function addModelTransformer(DataTransformerInterface $modelTransformer,
229201
/**
230202
* Unsupported method.
231203
*
232-
* This method should not be invoked.
233-
*
234204
* @throws BadMethodCallException
235205
*/
236206
public function resetModelTransformers()
@@ -261,8 +231,6 @@ public function setAttributes(array $attributes)
261231
/**
262232
* Unsupported method.
263233
*
264-
* This method should not be invoked.
265-
*
266234
* @throws BadMethodCallException
267235
*/
268236
public function setDataMapper(DataMapperInterface $dataMapper = null)
@@ -287,10 +255,6 @@ public function setDisabled($disabled)
287255
/**
288256
* Unsupported method.
289257
*
290-
* This method should not be invoked.
291-
*
292-
* @param mixed $emptyData
293-
*
294258
* @throws BadMethodCallException
295259
*/
296260
public function setEmptyData($emptyData)
@@ -301,10 +265,6 @@ public function setEmptyData($emptyData)
301265
/**
302266
* Unsupported method.
303267
*
304-
* This method should not be invoked.
305-
*
306-
* @param bool $errorBubbling
307-
*
308268
* @throws BadMethodCallException
309269
*/
310270
public function setErrorBubbling($errorBubbling)
@@ -315,10 +275,6 @@ public function setErrorBubbling($errorBubbling)
315275
/**
316276
* Unsupported method.
317277
*
318-
* This method should not be invoked.
319-
*
320-
* @param bool $required
321-
*
322278
* @throws BadMethodCallException
323279
*/
324280
public function setRequired($required)
@@ -329,10 +285,6 @@ public function setRequired($required)
329285
/**
330286
* Unsupported method.
331287
*
332-
* This method should not be invoked.
333-
*
334-
* @param null $propertyPath
335-
*
336288
* @throws BadMethodCallException
337289
*/
338290
public function setPropertyPath($propertyPath)
@@ -343,10 +295,6 @@ public function setPropertyPath($propertyPath)
343295
/**
344296
* Unsupported method.
345297
*
346-
* This method should not be invoked.
347-
*
348-
* @param bool $mapped
349-
*
350298
* @throws BadMethodCallException
351299
*/
352300
public function setMapped($mapped)
@@ -357,10 +305,6 @@ public function setMapped($mapped)
357305
/**
358306
* Unsupported method.
359307
*
360-
* This method should not be invoked.
361-
*
362-
* @param bool $byReference
363-
*
364308
* @throws BadMethodCallException
365309
*/
366310
public function setByReference($byReference)
@@ -371,10 +315,6 @@ public function setByReference($byReference)
371315
/**
372316
* Unsupported method.
373317
*
374-
* This method should not be invoked.
375-
*
376-
* @param bool $compound
377-
*
378318
* @throws BadMethodCallException
379319
*/
380320
public function setCompound($compound)
@@ -397,10 +337,6 @@ public function setType(ResolvedFormTypeInterface $type)
397337
/**
398338
* Unsupported method.
399339
*
400-
* This method should not be invoked.
401-
*
402-
* @param mixed $data
403-
*
404340
* @throws BadMethodCallException
405341
*/
406342
public function setData($data)
@@ -411,10 +347,6 @@ public function setData($data)
411347
/**
412348
* Unsupported method.
413349
*
414-
* This method should not be invoked.
415-
*
416-
* @param bool $locked
417-
*
418350
* @throws BadMethodCallException
419351
*/
420352
public function setDataLocked($locked)
@@ -425,8 +357,6 @@ public function setDataLocked($locked)
425357
/**
426358
* Unsupported method.
427359
*
428-
* This method should not be invoked.
429-
*
430360
* @throws BadMethodCallException
431361
*/
432362
public function setFormFactory(FormFactoryInterface $formFactory)
@@ -437,8 +367,6 @@ public function setFormFactory(FormFactoryInterface $formFactory)
437367
/**
438368
* Unsupported method.
439369
*
440-
* @param string $action
441-
*
442370
* @throws BadMethodCallException
443371
*/
444372
public function setAction($action)
@@ -449,8 +377,6 @@ public function setAction($action)
449377
/**
450378
* Unsupported method.
451379
*
452-
* @param string $method
453-
*
454380
* @throws BadMethodCallException
455381
*/
456382
public function setMethod($method)
@@ -471,8 +397,6 @@ public function setRequestHandler(RequestHandlerInterface $requestHandler)
471397
/**
472398
* Unsupported method.
473399
*
474-
* @param bool $initialize
475-
*
476400
* @return $this
477401
*
478402
* @throws BadMethodCallException
@@ -489,8 +413,6 @@ public function setAutoInitialize($initialize)
489413
/**
490414
* Unsupported method.
491415
*
492-
* @param bool $inheritData
493-
*
494416
* @throws BadMethodCallException
495417
*/
496418
public function setInheritData($inheritData)

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/ChoiceList/Factory/PropertyAccessDecorator.php
+19-20Lines changed: 19 additions & 20 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,19 +60,18 @@ 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
64+
* @param mixed $value
6565
*
66-
* @return ChoiceListInterface The choice list
66+
* @return ChoiceListInterface
6767
*/
6868
public function createListFromChoices($choices, $value = null)
6969
{
7070
if (\is_string($value)) {
7171
$value = new PropertyPath($value);
7272
}
7373

74-
if ($value instanceof PropertyPath) {
74+
if ($value instanceof PropertyPathInterface) {
7575
$accessor = $this->propertyAccessor;
7676
$value = function ($choice) use ($accessor, $value) {
7777
// The callable may be invoked with a non-object/array value
@@ -88,18 +88,17 @@ public function createListFromChoices($choices, $value = null)
8888
/**
8989
* {@inheritdoc}
9090
*
91-
* @param callable|string|PropertyPath|null $value The callable or path for
92-
* generating the choice values
91+
* @param mixed $value
9392
*
94-
* @return ChoiceListInterface The choice list
93+
* @return ChoiceListInterface
9594
*/
9695
public function createListFromLoader(ChoiceLoaderInterface $loader, $value = null)
9796
{
9897
if (\is_string($value)) {
9998
$value = new PropertyPath($value);
10099
}
101100

102-
if ($value instanceof PropertyPath) {
101+
if ($value instanceof PropertyPathInterface) {
103102
$accessor = $this->propertyAccessor;
104103
$value = function ($choice) use ($accessor, $value) {
105104
// The callable may be invoked with a non-object/array value
@@ -116,13 +115,13 @@ public function createListFromLoader(ChoiceLoaderInterface $loader, $value = nul
116115
/**
117116
* {@inheritdoc}
118117
*
119-
* @param array|callable|string|PropertyPath|null $preferredChoices The preferred choices
120-
* @param callable|string|PropertyPath|null $label The callable or path generating the choice labels
121-
* @param callable|string|PropertyPath|null $index The callable or path generating the view indices
122-
* @param callable|string|PropertyPath|null $groupBy The callable or path generating the group names
123-
* @param array|callable|string|PropertyPath|null $attr The callable or path generating the HTML attributes
118+
* @param mixed $preferredChoices
119+
* @param mixed $label
120+
* @param mixed $index
121+
* @param mixed $groupBy
122+
* @param mixed $attr
124123
*
125-
* @return ChoiceListView The choice list view
124+
* @return ChoiceListView
126125
*/
127126
public function createView(ChoiceListInterface $list, $preferredChoices = null, $label = null, $index = null, $groupBy = null, $attr = null)
128127
{
@@ -132,7 +131,7 @@ public function createView(ChoiceListInterface $list, $preferredChoices = null,
132131
$label = new PropertyPath($label);
133132
}
134133

135-
if ($label instanceof PropertyPath) {
134+
if ($label instanceof PropertyPathInterface) {
136135
$label = function ($choice) use ($accessor, $label) {
137136
return $accessor->getValue($choice, $label);
138137
};
@@ -142,7 +141,7 @@ public function createView(ChoiceListInterface $list, $preferredChoices = null,
142141
$preferredChoices = new PropertyPath($preferredChoices);
143142
}
144143

145-
if ($preferredChoices instanceof PropertyPath) {
144+
if ($preferredChoices instanceof PropertyPathInterface) {
146145
$preferredChoices = function ($choice) use ($accessor, $preferredChoices) {
147146
try {
148147
return $accessor->getValue($choice, $preferredChoices);
@@ -157,7 +156,7 @@ public function createView(ChoiceListInterface $list, $preferredChoices = null,
157156
$index = new PropertyPath($index);
158157
}
159158

160-
if ($index instanceof PropertyPath) {
159+
if ($index instanceof PropertyPathInterface) {
161160
$index = function ($choice) use ($accessor, $index) {
162161
return $accessor->getValue($choice, $index);
163162
};
@@ -167,7 +166,7 @@ public function createView(ChoiceListInterface $list, $preferredChoices = null,
167166
$groupBy = new PropertyPath($groupBy);
168167
}
169168

170-
if ($groupBy instanceof PropertyPath) {
169+
if ($groupBy instanceof PropertyPathInterface) {
171170
$groupBy = function ($choice) use ($accessor, $groupBy) {
172171
try {
173172
return $accessor->getValue($choice, $groupBy);
@@ -182,7 +181,7 @@ public function createView(ChoiceListInterface $list, $preferredChoices = null,
182181
$attr = new PropertyPath($attr);
183182
}
184183

185-
if ($attr instanceof PropertyPath) {
184+
if ($attr instanceof PropertyPathInterface) {
186185
$attr = function ($choice) use ($accessor, $attr) {
187186
return $accessor->getValue($choice, $attr);
188187
};

‎src/Symfony/Component/Form/Extension/Validator/Constraints/FormValidator.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/Extension/Validator/Constraints/FormValidator.php
+10-2Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,8 +260,16 @@ private static function resolveValidationGroups($groups, FormInterface $form)
260260

261261
private static function getConstraintsInGroups($constraints, $group)
262262
{
263-
return array_filter($constraints, static function (Constraint $constraint) use ($group) {
264-
return \in_array($group, $constraint->groups, true);
263+
$groups = (array) $group;
264+
265+
return array_filter($constraints, static function (Constraint $constraint) use ($groups) {
266+
foreach ($groups as $group) {
267+
if (\in_array($group, $constraint->groups, true)) {
268+
return true;
269+
}
270+
}
271+
272+
return false;
265273
});
266274
}
267275
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.