You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feature #39317 [Form] Changed DataMapperInterface $forms parameter type to \Traversable (vudaltsov)
This PR was squashed before being merged into the 5.3-dev branch.
Discussion
----------
[Form] Changed DataMapperInterface $forms parameter type to \Traversable
| Q | A
| ------------- | ---
| Branch? | 5.x
| Bug fix? | no
| New feature? | no
| Deprecations? | yes
| Tickets | Fix#39311
| License | MIT
| Doc PR | no
Didn't touch `PropertyPathMapper` because it's deprecated anyway.
Commits
-------
ce77be2 [Form] Changed DataMapperInterface $forms parameter type to \Traversable
Copy file name to clipboardExpand all lines: UPGRADE-6.0.md
+6Lines changed: 6 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -49,6 +49,12 @@ Form
49
49
* The `Symfony\Component\Form\Extension\Validator\Util\ServerParams` class has been removed, use its parent `Symfony\Component\Form\Util\ServerParams` instead.
50
50
* The `NumberToLocalizedStringTransformer::ROUND_*` constants have been removed, use `\NumberFormatter::ROUND_*` instead.
51
51
* Removed `PropertyPathMapper` in favor of `DataMapper` and `PropertyPathAccessor`.
52
+
* Changed `$forms` parameter type of the `DataMapper::mapDataToForms()` method from `iterable` to `\Traversable`.
53
+
* Changed `$forms` parameter type of the `DataMapper::mapFormsToData()` method from `iterable` to `\Traversable`.
54
+
* Changed `$checkboxes` parameter type of the `CheckboxListMapper::mapDataToForms()` method from `iterable` to `\Traversable`.
55
+
* Changed `$checkboxes` parameter type of the `CheckboxListMapper::mapFormsToData()` method from `iterable` to `\Traversable`.
56
+
* Changed `$radios` parameter type of the `RadioListMapper::mapDataToForms()` method from `iterable` to `\Traversable`.
57
+
* Changed `$radios` parameter type of the `RadioListMapper::mapFormsToData()` method from `iterable` to `\Traversable`.
trigger_deprecation('symfony/form', '5.3', 'Passing an array as the second argument of the "%s()" method is deprecated, pass "\Traversable" instead.', __METHOD__);
35
+
}
36
+
33
37
if (null === $choices) {
34
38
$choices = [];
35
39
}
@@ -49,6 +53,10 @@ public function mapDataToForms($choices, iterable $checkboxes)
trigger_deprecation('symfony/form', '5.3', 'Passing an array as the first argument of the "%s()" method is deprecated, pass "\Traversable" instead.', __METHOD__);
trigger_deprecation('symfony/form', '5.3', 'Passing an array as the second argument of the "%s()" method is deprecated, pass "\Traversable" instead.', __METHOD__);
45
+
}
46
+
43
47
$empty = null === $data || [] === $data;
44
48
45
49
if (!$empty && !\is_array($data) && !\is_object($data)) {
@@ -62,6 +66,10 @@ public function mapDataToForms($data, iterable $forms): void
trigger_deprecation('symfony/form', '5.3', 'Passing an array as the first argument of the "%s()" method is deprecated, pass "\Traversable" instead.', __METHOD__);
trigger_deprecation('symfony/form', '5.3', 'Passing an array as the second argument of the "%s()" method is deprecated, pass "\Traversable" instead.', __METHOD__);
trigger_deprecation('symfony/form', '5.3', 'Passing an array as the first argument of the "%s()" method is deprecated, pass "\Traversable" instead.', __METHOD__);
54
+
}
55
+
48
56
if (null !== $choice && !\is_string($choice)) {
49
57
thrownewUnexpectedTypeException($choice, 'null or string');
0 commit comments