-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[DEPRECATION] : deprecated support for Traversable in method ResizeFormListener::PreSubmit #17732
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
ybensacq
commented
Feb 8, 2016
Q | A |
---|---|
Bug fix? | no |
New feature? | no |
BC breaks? | no |
Deprecations? | yes |
Tests pass? | yes |
Fixed tickets | #17701 |
License | MIT |
@@ -5,6 +5,7 @@ CHANGELOG | |||
----- | |||
|
|||
* deprecated the "choices_as_values" option of ChoiceType | |||
* deprecated support for Traversable in `ResizeFormListener::PreSubmit` method |
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.
the method is called preSubmit
without the uppercase.
9fffd39
to
188e780
Compare
@@ -102,11 +102,15 @@ public function preSubmit(FormEvent $event) | |||
$form = $event->getForm(); | |||
$data = $event->getData(); | |||
|
|||
if ($data instanceof \Traversable){ |
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.
Missing space before the curly brace and IMO this should be $data instanceof \Traversable && $data instanceof \ArrayAccess
because if someone pass an object that implements Traversable
but not ArrayAccess
the deprecation will be thrown but the $data
will be reseted to an empty array.
@@ -102,6 +102,10 @@ public function preSubmit(FormEvent $event) | |||
$form = $event->getForm(); | |||
$data = $event->getData(); | |||
|
|||
if ($data instanceof \Traversable) { |
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.
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.
@HeahDude it's ok in my last commit :
ybensacq@554307c
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.
you updated only one of the two places in that commit
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.
Yes, tthe condition should be:
if ($data instanceof \Traversable && $data instanceof \ArrayAccess) {
@trigger_error('Support for Traversable is deprecated since version 3.1 and will be removed in 4.0. You should not use it anymore.', E_USER_DEPRECATED);
}
Thanks Yannick :) |
should also be documented in the upgrade files |
@HeahDude I think that do not worth it because at the moment of remove deprecated features I search for "trigger_error" or "E_USER_DEPRECATED" for example. |
Ok thanks, all is ok now. |
@dosten yes and then you have to search the code to remove or edit, so maybe a comment can be useful at this time. Besides that 👍 |
@@ -102,6 +102,10 @@ public function preSubmit(FormEvent $event) | |||
$form = $event->getForm(); | |||
$data = $event->getData(); | |||
|
|||
if ($data instanceof \Traversable && $data instanceof \ArrayAccess) { | |||
@trigger_error('Support for objects implementing both \Traversable and \ArrayAccess is deprecated since version 3.1 and will be removed in 4.0.Use an array instead.', E_USER_DEPRECATED); |
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.
Missing space after the dot: will be removed in 4.0.Use an array
👍 Status: Reviewed |
Thank you @ybensacq. |
…method ResizeFormListener::PreSubmit (ybensacq) This PR was squashed before being merged into the 3.1-dev branch (closes #17732). Discussion ---------- [DEPRECATION] : deprecated support for Traversable in method ResizeFormListener::PreSubmit | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | yes | Tests pass? | yes | Fixed tickets | #17701 | License | MIT Commits ------- 68c9305 [DEPRECATION] : deprecated support for Traversable in method ResizeFormListener::PreSubmit