Fix After/Before expanders error message when date/time is equal to boundary #478
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Change Log
Added
Fixed
Changed
Removed
Deprecated
Security
Description
Hi,
I encountered a bug trying to use the after/before expanders when it wouldn't match because the value was equals to the boundary.
No error was set by the expander, which would result to a type error in DateMatcher line 54 (matcherFailed method expected a string as its 4th parameter and null was given)
While trying to fix it I saw that the explicit handling of Time was never reached because in the constructor it first checks if the boundary is a DateTime and any Time will be a valid DateTime as we can see in the Time::fromString method
I added tests to increase the coverage of the expanders and removed any explicit handling of Time.
Finally, given how similar the expanders were I created an abstract class to remove the code duplication I hope that's fine by you.
Please tell me if I missed something and thank you for this much needed library!