Skip to content

Commit

Permalink
Merge pull request #52 from lcobucci/require-timezone-object-on-const…
Browse files Browse the repository at this point in the history
…ructor

Always require a timezone to create the SystemClock
  • Loading branch information
lcobucci committed Aug 27, 2020
2 parents 65091bb + db5433a commit 353d83f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/SystemClock.php
Expand Up @@ -12,9 +12,9 @@ final class SystemClock implements Clock
{
private DateTimeZone $timezone;

public function __construct(?DateTimeZone $timezone = null)
public function __construct(DateTimeZone $timezone)
{
$this->timezone = $timezone ?? new DateTimeZone(date_default_timezone_get());
$this->timezone = $timezone;
}

public static function fromUTC(): self
Expand Down
10 changes: 0 additions & 10 deletions test/SystemClockTest.php
Expand Up @@ -12,16 +12,6 @@
/** @coversDefaultClass \Lcobucci\Clock\SystemClock */
final class SystemClockTest extends TestCase
{
/**
* @test
*
* @covers ::__construct
*/
public function constructShouldUseSystemDefaultTimezoneIfNoneWasProvided(): void
{
self::assertEquals(new SystemClock(new DateTimeZone(date_default_timezone_get())), new SystemClock());
}

/**
* @test
*
Expand Down

0 comments on commit 353d83f

Please sign in to comment.