-
-
Notifications
You must be signed in to change notification settings - Fork 35
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
Refactor MonthSelect
removing inheritance and improving tests
#200
Conversation
Looks to me like expected input is, like you say, an associative array of varying lengths depending on the descendant class that should produce a formatted string. The filter requires that array members be specificly |
Cool. Does that apply to the other two that inherit from AbstractDateDropdown (DateSelect and DateTimeSelect), as they share a lot of the same behavior at the moment? |
I'd say all 4 classes, MonthSelect, Abstract, DateSelect & DateTimeSelect - Let's wait for @froschdesign to give us an opinion too 👍 |
Unfortunately, that won't work, because laminas-form uses these filters:
|
Thanks both. Does that bring us back to the questions about behavior in v3 or is there more to consider? |
OK, so I think that in all erroneous cases, the filter(s) should return the unprocessed input that will hopefully then fail subsequent validation - so, out of range, incorrect array shapes etc should not throw exceptions, but just silently pass through unchanged. I think we have to work on the premise that we're working with data that hasn't been validated. In typical usage with |
Based on the form elements from above: The validators |
6a43fa1
to
f9f1f77
Compare
I think this covers the desired behaviour. Let me know if there's anything not quite right, or any other test cases that would be useful. Once we've got the code doing what it should I'll look at adding some docs. Also, psalm isn't loving returning $value after |
Thanks. Still needs the suppression for the return statement, but the rest is looking a lot healthier |
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.
Thanks @ramchale - I figured out the reason for the InvalidReturnStatement
- Sorry to be pedantic 😬
No. Really appreciate the feedback and help. Thanks |
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.
Thanks @ramchale 👍
Is there anything else needed here or can I merge it? |
MonthSelect
removing inheritance and improving tests
I've got some accompanying documentation I can tidy up and add to the v2_to_v3.md and standard-filters.md this afternoon. So might want to hold off for that? |
Cool - I'll wait for the docs so they go in together 👍 |
Signed-off-by: ramchale <[email protected]>
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.
Thanks again @ramchale 👌
Description
Draft pull request to discuss desired behavior of MonthSelect in v3. Some of this will also be relevant to other classes extending AbstractDateDropdown.