Skip to content

Commit 353d83f

Browse files
authored
Merge pull request #52 from lcobucci/require-timezone-object-on-constructor
Always require a timezone to create the SystemClock
2 parents 65091bb + db5433a commit 353d83f

File tree

2 files changed

+2
-12
lines changed

2 files changed

+2
-12
lines changed

src/SystemClock.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ final class SystemClock implements Clock
1212
{
1313
private DateTimeZone $timezone;
1414

15-
public function __construct(?DateTimeZone $timezone = null)
15+
public function __construct(DateTimeZone $timezone)
1616
{
17-
$this->timezone = $timezone ?? new DateTimeZone(date_default_timezone_get());
17+
$this->timezone = $timezone;
1818
}
1919

2020
public static function fromUTC(): self

test/SystemClockTest.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,6 @@
1212
/** @coversDefaultClass \Lcobucci\Clock\SystemClock */
1313
final class SystemClockTest extends TestCase
1414
{
15-
/**
16-
* @test
17-
*
18-
* @covers ::__construct
19-
*/
20-
public function constructShouldUseSystemDefaultTimezoneIfNoneWasProvided(): void
21-
{
22-
self::assertEquals(new SystemClock(new DateTimeZone(date_default_timezone_get())), new SystemClock());
23-
}
24-
2515
/**
2616
* @test
2717
*

0 commit comments

Comments
 (0)