Skip to content

[Form] Fix return type of FormErrorIterator::getChildren() #42301

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

W0rma
Copy link
Contributor

@W0rma W0rma commented Jul 28, 2021

Q A
Branch? 4.4
Bug fix? yes
New feature? no
Deprecations? no
Tickets
License MIT
Doc PR

3c578b1 added self return type to FormErrorIterator::getChildren().

However, from the constructor I assume that this method can return either self or an instance of FormError.

@@ -205,7 +205,7 @@ public function hasChildren()
/**
* Alias of {@link current()}.
*
* @return self
* @return FormError|self
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO self is correct as logically one should only call getChildren() when there are actual child nodes (which in the method above is a check for the current element being an instance of FormErrorIterator.

Maybe the method should throw if the current item is not iterable.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe the method should throw if the current item is not iterable.

Makes sense. Should this be considered a BC break or rather a bugfix?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would vote for triggering a deprecation in 5.4 and add the exception in 6.0.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I will open MRs for 5.4 and 6.0 soon

@derrabus derrabus added this to the 4.4 milestone Jul 29, 2021
@W0rma W0rma changed the base branch from 5.4 to 4.4 July 30, 2021 08:25
@W0rma W0rma closed this Jul 30, 2021
fabpot added a commit that referenced this pull request Aug 15, 2021
… if the current element is not iterable (W0rma)

This PR was merged into the 5.4 branch.

Discussion
----------

[Form] Deprecate calling FormErrorIterator::children() if the current element is not iterable

| Q             | A
| ------------- | ---
| Branch?       | 5.4 for features
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | yes
| Tickets       | #42301 (comment)
| License       | MIT
| Doc PR        |

Commits
-------

d8e74fc * Deprecated calling `FormErrorIterator::children()` if the current element is not iterable
symfony-splitter pushed a commit to symfony/form that referenced this pull request Aug 15, 2021
… if the current element is not iterable (W0rma)

This PR was merged into the 5.4 branch.

Discussion
----------

[Form] Deprecate calling FormErrorIterator::children() if the current element is not iterable

| Q             | A
| ------------- | ---
| Branch?       | 5.4 for features
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | yes
| Tickets       | symfony/symfony#42301 (comment)
| License       | MIT
| Doc PR        |

Commits
-------

d8e74fc8df * Deprecated calling `FormErrorIterator::children()` if the current element is not iterable
@W0rma W0rma deleted the fix-return-type-form-error-iterator branch November 7, 2021 10:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants