-
Notifications
You must be signed in to change notification settings - Fork 116
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
Add data support for next open hours #89
Conversation
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.
This particular case is not documented, so I first need to check it's relevant to have it too and would create no conflict.
src/OpeningHoursForDay.php
Outdated
@@ -93,7 +93,11 @@ public function nextClose(Time $time) | |||
|
|||
protected function findNextOpenInWorkingHours(Time $time, TimeRange $timeRange) | |||
{ | |||
if ($timeRange->containsTime($time) && next($timeRange) !== $timeRange) { | |||
if ($timeRange->containsTime($time) && $next = next($timeRange) !== $timeRange) { |
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.
Due to operators precedence, $next
will always be a boolean (in this case, false
), so ! $next instanceof Time
will always be true
. We are just always skipping a value here as far as I understand. I will try to create a unit test to confirm it.
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, you are right.. the strangest thing is that if you just return false from this method all tests will still pass.
protected function findNextOpenInWorkingHours(Time $time, TimeRange $timeRange)
{
return false;
}
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.
So we probably need more cases for our unit tests.
Thanks for your proposal. We will check it and get back in touch soon. |
Thanks, with new changes, no this pass without error. Please try to update to |
Yes, |
This PR fixes
Call to a member function toDateTime() on array
error when trying to callnextOpen
method with: