-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[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
Conversation
@@ -205,7 +205,7 @@ public function hasChildren() | |||
/** | |||
* Alias of {@link current()}. | |||
* | |||
* @return self | |||
* @return FormError|self |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
… 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
… 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
3c578b1 added
self
return type toFormErrorIterator::getChildren()
.However, from the constructor I assume that this method can return either
self
or an instance ofFormError
.