Skip to content

Commit

Permalink
Enable DateTimeImmutable
Browse files Browse the repository at this point in the history
  • Loading branch information
kylekatarnls committed Dec 7, 2018
1 parent c992816 commit c4d0971
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 19 deletions.
4 changes: 2 additions & 2 deletions src/OpeningHours.php
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ public function isClosed(): bool
return $this->isClosedAt(new DateTime());
}

public function nextOpen(DateTimeInterface $dateTime): DateTime
public function nextOpen(DateTimeInterface $dateTime): DateTimeInterface
{
if (! ($dateTime instanceof DateTimeImmutable)) {
$dateTime = clone $dateTime;
Expand All @@ -235,7 +235,7 @@ public function nextOpen(DateTimeInterface $dateTime): DateTime
return $dateTime;
}

public function nextClose(DateTimeInterface $dateTime): DateTime
public function nextClose(DateTimeInterface $dateTime): DateTimeInterface
{
if (! ($dateTime instanceof DateTimeImmutable)) {
$dateTime = clone $dateTime;
Expand Down
2 changes: 1 addition & 1 deletion src/Time.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public function diff(self $time): \DateInterval
return $this->toDateTime()->diff($time->toDateTime());
}

public function toDateTime(DateTime $date = null): DateTime
public function toDateTime(DateTimeInterface $date = null): DateTimeInterface
{
if (! $date) {
$date = new DateTime('1970-01-01 00:00:00');
Expand Down
14 changes: 0 additions & 14 deletions tests/OpeningHoursTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,6 @@ public function it_can_determine_next_open_hours_from_non_working_date_time()
/** @test */
public function it_can_determine_next_open_hours_from_non_working_date_time_immutable()
{
$this->markTestIncomplete('Not supported in v1.x');

$openingHours = OpeningHours::create([
'monday' => ['09:00-11:00', '13:00-19:00'],
]);
Expand Down Expand Up @@ -313,8 +311,6 @@ public function it_can_determine_next_close_hours_from_non_working_date_time()
/** @test */
public function it_can_determine_next_close_hours_from_non_working_date_time_immutable()
{
$this->markTestIncomplete('Not supported in v1.x');

$openingHours = OpeningHours::create([
'monday' => ['09:00-11:00', '13:00-19:00'],
]);
Expand Down Expand Up @@ -342,8 +338,6 @@ public function it_can_determine_next_open_hours_from_working_date_time()
/** @test */
public function it_can_determine_next_open_hours_from_working_date_time_immutable()
{
$this->markTestIncomplete('Not supported in v1.x');

$openingHours = OpeningHours::create([
'monday' => ['09:00-11:00', '13:00-19:00'],
'tuesday' => ['10:00-11:00', '14:00-19:00'],
Expand Down Expand Up @@ -372,8 +366,6 @@ public function it_can_determine_next_close_hours_from_working_date_time()
/** @test */
public function it_can_determine_next_close_hours_from_working_date_time_immutable()
{
$this->markTestIncomplete('Not supported in v1.x');

$openingHours = OpeningHours::create([
'monday' => ['09:00-11:00', '13:00-19:00'],
'tuesday' => ['10:00-11:00', '14:00-19:00'],
Expand Down Expand Up @@ -405,8 +397,6 @@ public function it_can_determine_next_open_hours_from_early_morning()
/** @test */
public function it_can_determine_next_open_hours_from_early_morning_immutable()
{
$this->markTestIncomplete('Not supported in v1.x');

$openingHours = OpeningHours::create([
'monday' => ['09:00-11:00', '13:00-19:00'],
'tuesday' => ['10:00-11:00', '14:00-19:00'],
Expand Down Expand Up @@ -441,8 +431,6 @@ public function it_can_determine_next_close_hours_from_early_morning()
/** @test */
public function it_can_determine_next_close_hours_from_early_morning_immutable()
{
$this->markTestIncomplete('Not supported in v1.x');

$openingHours = OpeningHours::create([
'monday' => ['09:00-11:00', '13:00-19:00'],
'tuesday' => ['10:00-11:00', '14:00-19:00'],
Expand Down Expand Up @@ -593,8 +581,6 @@ public function it_works_when_starting_at_midnight()
/** @test */
public function it_works_when_starting_at_midnight_immutable()
{
$this->markTestIncomplete('Not supported in v1.x');

$openingHours = OpeningHours::create([
'monday' => ['00:00-16:00'],
]);
Expand Down
2 changes: 0 additions & 2 deletions tests/TimeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,6 @@ public function it_should_not_mutate_passed_datetime()
/** @test */
public function it_should_not_mutate_passed_datetime_immutable()
{
$this->markTestIncomplete('Not supported in v1.x');

$dateTime = new DateTimeImmutable('2016-09-27 12:00:00');
$time = Time::fromString('15:00');
$this->assertEquals('2016-09-27 15:00:00', $time->toDateTime($dateTime)->format('Y-m-d H:i:s'));
Expand Down

0 comments on commit c4d0971

Please sign in to comment.