From 3829669935261e12f950b987de5fd715492161af Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Sun, 17 Nov 2024 16:30:01 +0100 Subject: [PATCH 01/85] add workflow to automatically create releases --- .github/workflows/release.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..ce6cb4e --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,23 @@ +name: Create release + +on: + push: + tags: + - '*' + +permissions: + contents: write + +jobs: + release: + name: Create release + runs-on: ubuntu-22.04 + steps: + - name: Create release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + tag: ${{ github.ref_name }} + run: | + gh release create "$tag" \ + --repo="$GITHUB_REPOSITORY" \ + --generate-notes From 480296863796ebfb047dfee67e2bf0cc7ea24237 Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Sun, 17 Nov 2024 16:30:39 +0100 Subject: [PATCH 02/85] update actions versions --- .github/workflows/ci.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e20e778..8de919d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,7 +13,7 @@ jobs: name: 'PHPUnit' steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 with: @@ -21,12 +21,12 @@ jobs: extensions: mbstring, intl coverage: xdebug - name: Composer - uses: "ramsey/composer-install@v2" + uses: "ramsey/composer-install@v3" with: dependency-versions: ${{ matrix.dependencies }} - name: PHPUnit run: vendor/bin/phpunit --coverage-clover=coverage.clover - - uses: codecov/codecov-action@v1 + - uses: codecov/codecov-action@v4 with: token: ${{ secrets.CODECOV_TOKEN }} psalm: @@ -38,14 +38,14 @@ jobs: name: 'Psalm' steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php-version }} extensions: mbstring, intl - name: Composer - uses: "ramsey/composer-install@v2" + uses: "ramsey/composer-install@v3" with: dependency-versions: ${{ matrix.dependencies }} - name: Psalm @@ -58,13 +58,13 @@ jobs: name: 'CS' steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php-version }} extensions: mbstring, intl - name: Composer - uses: "ramsey/composer-install@v2" + uses: "ramsey/composer-install@v3" - name: CS run: vendor/bin/php-cs-fixer fix --diff --dry-run From 18f5c01257fac88054ac81d58cd486766994f5ab Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Sun, 17 Nov 2024 16:32:44 +0100 Subject: [PATCH 03/85] CS --- src/Earth/PointInTime/Now.php | 1 - tests/Earth/FrozenClockTest.php | 5 +---- tests/Earth/PointInTime/NowTest.php | 1 - 3 files changed, 1 insertion(+), 6 deletions(-) diff --git a/src/Earth/PointInTime/Now.php b/src/Earth/PointInTime/Now.php index 344aef4..b3844e2 100644 --- a/src/Earth/PointInTime/Now.php +++ b/src/Earth/PointInTime/Now.php @@ -10,7 +10,6 @@ Earth\ElapsedPeriod, ElapsedPeriod as ElapsedPeriodInterface, Period, - Timezone\Earth\UTC, Clock\Year, Clock\Month, Clock\Day, diff --git a/tests/Earth/FrozenClockTest.php b/tests/Earth/FrozenClockTest.php index 5123811..832da2b 100644 --- a/tests/Earth/FrozenClockTest.php +++ b/tests/Earth/FrozenClockTest.php @@ -11,10 +11,7 @@ }; use Fixtures\Innmind\TimeContinuum\Earth\PointInTime; use PHPUnit\Framework\TestCase; -use Innmind\BlackBox\{ - PHPUnit\BlackBox, - Set, -}; +use Innmind\BlackBox\PHPUnit\BlackBox; class FrozenClockTest extends TestCase { diff --git a/tests/Earth/PointInTime/NowTest.php b/tests/Earth/PointInTime/NowTest.php index deff649..da65de2 100644 --- a/tests/Earth/PointInTime/NowTest.php +++ b/tests/Earth/PointInTime/NowTest.php @@ -17,7 +17,6 @@ Clock\Second, Clock\Millisecond, Earth\Timezone\UTC, - Earth\Period\Composite, Earth\Period\Year, Earth\Period\Millisecond as MillisecondPeriod, }; From cd6b295ad38d052b54328d596e38ea711a5c5b22 Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Sun, 17 Nov 2024 16:36:56 +0100 Subject: [PATCH 04/85] fix psalm errors --- src/Earth/Timezone.php | 3 +++ src/Earth/Timezone/UTC.php | 5 +++++ src/Timezone.php | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/src/Earth/Timezone.php b/src/Earth/Timezone.php index 9d537f9..25309dd 100644 --- a/src/Earth/Timezone.php +++ b/src/Earth/Timezone.php @@ -13,6 +13,9 @@ abstract class Timezone implements TimezoneInterface private Timezone\UTC $utc; private bool $dst; + /** + * @param non-empty-string $zone + */ public function __construct(string $zone) { $zone = new \DateTimeZone($zone); diff --git a/src/Earth/Timezone/UTC.php b/src/Earth/Timezone/UTC.php index 35df196..7601715 100644 --- a/src/Earth/Timezone/UTC.php +++ b/src/Earth/Timezone/UTC.php @@ -16,6 +16,7 @@ final class UTC implements Timezone private int $hours; private int $minutes; private bool $dst = false; + /** @var non-empty-string */ private string $string; public function __construct(int $hours = 0, int $minutes = 0) @@ -79,12 +80,16 @@ public function toString(): string return $this->string; } + /** + * @return non-empty-string + */ private function format(int $hours, int $minutes): string { if ($hours === 0 && $minutes === 0) { return 'Z'; } + /** @var non-empty-string */ return \sprintf( '%s%02d:%02d', $hours > 0 ? '+' : '-', diff --git a/src/Timezone.php b/src/Timezone.php index 916c016..00a2779 100644 --- a/src/Timezone.php +++ b/src/Timezone.php @@ -11,5 +11,9 @@ interface Timezone public function hours(): int; public function minutes(): int; public function daylightSavingTimeApplied(): bool; + + /** + * @return non-empty-string + */ public function toString(): string; } From a77254cb2ea27c0c7a7f76cf3f9cb2e7dc6e2729 Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Sun, 17 Nov 2024 16:40:21 +0100 Subject: [PATCH 05/85] drop innmind/immutable 4 --- CHANGELOG.md | 6 ++++++ composer.json | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c3e739f..db20ba8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## [Unreleased] + +### Removed + +- Support for `innmind/immutable` `4` + ## 3.4.1 - 2023-09-17 ### Fixed diff --git a/composer.json b/composer.json index dae62a2..13cb8d7 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,7 @@ "require": { "php": "~8.2", "psr/log": "~3.0", - "innmind/immutable": "~4.0|~5.0" + "innmind/immutable": "~5.0" }, "autoload": { "psr-4": { From 4340961e2da59c044c86420990813455f2de2274 Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Sun, 17 Nov 2024 17:03:21 +0100 Subject: [PATCH 06/85] make Format a final class --- CHANGELOG.md | 5 + src/Earth/Format/Cookie.php | 17 ---- src/Earth/Format/ISO8601.php | 17 ---- src/Earth/Format/RFC1036.php | 17 ---- src/Earth/Format/RFC1123.php | 17 ---- src/Earth/Format/RFC2822.php | 17 ---- src/Earth/Format/RFC822.php | 17 ---- src/Earth/Format/RFC850.php | 17 ---- src/Earth/Format/RSS.php | 17 ---- src/Earth/Format/W3C.php | 17 ---- src/Format.php | 100 +++++++++++++++++++- src/Logger/Clock.php | 9 +- tests/Earth/ClockTest.php | 19 +--- tests/Earth/Format/CookieTest.php | 21 ---- tests/Earth/Format/ISO8601Test.php | 21 ---- tests/Earth/Format/RFC1036Test.php | 21 ---- tests/Earth/Format/RFC1123Test.php | 21 ---- tests/Earth/Format/RFC2822Test.php | 21 ---- tests/Earth/Format/RFC822Test.php | 21 ---- tests/Earth/Format/RFC850Test.php | 21 ---- tests/Earth/Format/RSSTest.php | 21 ---- tests/Earth/Format/W3CTest.php | 21 ---- tests/Earth/FrozenClockTest.php | 4 +- tests/Earth/Move/EndOfDayTest.php | 7 +- tests/Earth/Move/EndOfMonthTest.php | 7 +- tests/Earth/Move/EndOfYearTest.php | 7 +- tests/Earth/Move/MonthTest.php | 7 +- tests/Earth/Move/StartOfDayTest.php | 7 +- tests/Earth/Move/StartOfMonthTest.php | 7 +- tests/Earth/Move/StartOfYearTest.php | 7 +- tests/Earth/PointInTime/NowTest.php | 9 +- tests/Earth/PointInTime/PointInTimeTest.php | 32 +------ tests/Fixtures/Earth/PointInTimeTest.php | 6 +- tests/FormatTest.php | 32 +++++++ tests/Logger/ClockTest.php | 29 +++--- 35 files changed, 175 insertions(+), 461 deletions(-) delete mode 100644 src/Earth/Format/Cookie.php delete mode 100644 src/Earth/Format/ISO8601.php delete mode 100644 src/Earth/Format/RFC1036.php delete mode 100644 src/Earth/Format/RFC1123.php delete mode 100644 src/Earth/Format/RFC2822.php delete mode 100644 src/Earth/Format/RFC822.php delete mode 100644 src/Earth/Format/RFC850.php delete mode 100644 src/Earth/Format/RSS.php delete mode 100644 src/Earth/Format/W3C.php delete mode 100644 tests/Earth/Format/CookieTest.php delete mode 100644 tests/Earth/Format/ISO8601Test.php delete mode 100644 tests/Earth/Format/RFC1036Test.php delete mode 100644 tests/Earth/Format/RFC1123Test.php delete mode 100644 tests/Earth/Format/RFC2822Test.php delete mode 100644 tests/Earth/Format/RFC822Test.php delete mode 100644 tests/Earth/Format/RFC850Test.php delete mode 100644 tests/Earth/Format/RSSTest.php delete mode 100644 tests/Earth/Format/W3CTest.php create mode 100644 tests/FormatTest.php diff --git a/CHANGELOG.md b/CHANGELOG.md index db20ba8..888e4b3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,9 +2,14 @@ ## [Unreleased] +### Changed + +- `Innmind\TimeContinuum\Format` is now a `final class` + ### Removed - Support for `innmind/immutable` `4` +- Classes in the `Innmind\TimeContinuum\Earth\Format` namespaces are now named constructors of `Innmind\TimeContinuum\Format` ## 3.4.1 - 2023-09-17 diff --git a/src/Earth/Format/Cookie.php b/src/Earth/Format/Cookie.php deleted file mode 100644 index 278ef6f..0000000 --- a/src/Earth/Format/Cookie.php +++ /dev/null @@ -1,17 +0,0 @@ -value; + } } diff --git a/src/Logger/Clock.php b/src/Logger/Clock.php index c1180c0..d5bc2b2 100644 --- a/src/Logger/Clock.php +++ b/src/Logger/Clock.php @@ -7,7 +7,6 @@ Clock as ClockInterface, PointInTime, Format, - Earth\Format\ISO8601, }; use Innmind\Immutable\Maybe; use Psr\Log\LoggerInterface; @@ -27,7 +26,7 @@ public function now(): PointInTime { $now = $this->clock->now(); $this->logger->debug('Current time is {point}', [ - 'point' => $now->format(new ISO8601), + 'point' => $now->format(Format::iso8601()), ]); return $now; @@ -57,9 +56,7 @@ private function format(?Format $format): string return 'unknown'; } - $class = \get_class($format); - - return "{$class}({$format->toString()})"; + return $format->toString(); } private function log( @@ -75,7 +72,7 @@ private function log( $this->logger->debug('Asked time {date} ({format}) resolved to {point}', [ 'date' => $date, 'format' => $this->format($format), - 'point' => $point->format(new ISO8601), + 'point' => $point->format(Format::iso8601()), ]); return $point; diff --git a/tests/Earth/ClockTest.php b/tests/Earth/ClockTest.php index aee6c39..764e7b8 100644 --- a/tests/Earth/ClockTest.php +++ b/tests/Earth/ClockTest.php @@ -9,7 +9,6 @@ PointInTime, Format, Earth\Timezone\UTC, - Earth\Format\ISO8601, }; use PHPUnit\Framework\TestCase; use Innmind\BlackBox\{ @@ -85,12 +84,7 @@ public function testAtWithSpecificFormat() { $this->assertInstanceOf( PointInTime::class, - $point = (new Clock)->at('+02:00 2016-10-08 16:08:30', new class implements Format { - public function toString(): string - { - return 'P Y-m-d H:i:s'; - } - })->match( + $point = (new Clock)->at('+02:00 2016-10-08 16:08:30', Format::of('P Y-m-d H:i:s'))->match( static fn($point) => $point, static fn() => null, ), @@ -110,7 +104,7 @@ public function testAtWithDateNotOfExpectedFormat() ->then(function($date) { $clock = new Clock; - $this->assertNull($clock->at($date, new ISO8601)->match( + $this->assertNull($clock->at($date, Format::iso8601())->match( static fn($point) => $point, static fn() => null, )); @@ -120,7 +114,7 @@ public function testAtWithDateNotOfExpectedFormat() public function testAtWithNullDate() { $clock = new Clock; - $this->assertNull($clock->at("\x00", new ISO8601)->match( + $this->assertNull($clock->at("\x00", Format::iso8601())->match( static fn($point) => $point, static fn() => null, )); @@ -139,12 +133,7 @@ public function testDateCorrectlyRespectTheFormatGiven() $this->assertNull( (new Clock) - ->at($date, new class implements Format { - public function toString(): string - { - return 'Y-m-d'; - } - }) + ->at($date, Format::of('Y-m-d')) ->match( static fn($point) => $point, static fn() => null, diff --git a/tests/Earth/Format/CookieTest.php b/tests/Earth/Format/CookieTest.php deleted file mode 100644 index 621c893..0000000 --- a/tests/Earth/Format/CookieTest.php +++ /dev/null @@ -1,21 +0,0 @@ -assertInstanceOf(Format::class, $format); - $this->assertSame(\DateTime::COOKIE, $format->toString()); - } -} diff --git a/tests/Earth/Format/ISO8601Test.php b/tests/Earth/Format/ISO8601Test.php deleted file mode 100644 index 563a061..0000000 --- a/tests/Earth/Format/ISO8601Test.php +++ /dev/null @@ -1,21 +0,0 @@ -assertInstanceOf(Format::class, $format); - $this->assertSame(\DateTime::ATOM, $format->toString()); - } -} diff --git a/tests/Earth/Format/RFC1036Test.php b/tests/Earth/Format/RFC1036Test.php deleted file mode 100644 index e1b1b79..0000000 --- a/tests/Earth/Format/RFC1036Test.php +++ /dev/null @@ -1,21 +0,0 @@ -assertInstanceOf(Format::class, $format); - $this->assertSame(\DateTime::RFC1036, $format->toString()); - } -} diff --git a/tests/Earth/Format/RFC1123Test.php b/tests/Earth/Format/RFC1123Test.php deleted file mode 100644 index db521d9..0000000 --- a/tests/Earth/Format/RFC1123Test.php +++ /dev/null @@ -1,21 +0,0 @@ -assertInstanceOf(Format::class, $format); - $this->assertSame(\DateTime::RFC1123, $format->toString()); - } -} diff --git a/tests/Earth/Format/RFC2822Test.php b/tests/Earth/Format/RFC2822Test.php deleted file mode 100644 index 76f6cb6..0000000 --- a/tests/Earth/Format/RFC2822Test.php +++ /dev/null @@ -1,21 +0,0 @@ -assertInstanceOf(Format::class, $format); - $this->assertSame(\DateTime::RFC2822, $format->toString()); - } -} diff --git a/tests/Earth/Format/RFC822Test.php b/tests/Earth/Format/RFC822Test.php deleted file mode 100644 index 1c0509c..0000000 --- a/tests/Earth/Format/RFC822Test.php +++ /dev/null @@ -1,21 +0,0 @@ -assertInstanceOf(Format::class, $format); - $this->assertSame(\DateTime::RFC822, $format->toString()); - } -} diff --git a/tests/Earth/Format/RFC850Test.php b/tests/Earth/Format/RFC850Test.php deleted file mode 100644 index 4a5d47d..0000000 --- a/tests/Earth/Format/RFC850Test.php +++ /dev/null @@ -1,21 +0,0 @@ -assertInstanceOf(Format::class, $format); - $this->assertSame(\DateTime::RFC850, $format->toString()); - } -} diff --git a/tests/Earth/Format/RSSTest.php b/tests/Earth/Format/RSSTest.php deleted file mode 100644 index ced98c3..0000000 --- a/tests/Earth/Format/RSSTest.php +++ /dev/null @@ -1,21 +0,0 @@ -assertInstanceOf(Format::class, $format); - $this->assertSame(\DateTime::RSS, $format->toString()); - } -} diff --git a/tests/Earth/Format/W3CTest.php b/tests/Earth/Format/W3CTest.php deleted file mode 100644 index 84d8f79..0000000 --- a/tests/Earth/Format/W3CTest.php +++ /dev/null @@ -1,21 +0,0 @@ -assertInstanceOf(Format::class, $format); - $this->assertSame(\DateTime::W3C, $format->toString()); - } -} diff --git a/tests/Earth/FrozenClockTest.php b/tests/Earth/FrozenClockTest.php index 832da2b..1f61c8a 100644 --- a/tests/Earth/FrozenClockTest.php +++ b/tests/Earth/FrozenClockTest.php @@ -5,7 +5,7 @@ use Innmind\TimeContinuum\{ Earth\FrozenClock, - Earth\Format\ISO8601, + Format, Clock, PointInTime as PointInTimeInterface, }; @@ -45,7 +45,7 @@ public function testAtReturnWithTheSameTimezoneAsNow() ->then(function($now, $at) { $clock = new FrozenClock($now); - $point = $clock->at($at->format(new ISO8601))->match( + $point = $clock->at($at->format(Format::iso8601()))->match( static fn($point) => $point, static fn() => null, ); diff --git a/tests/Earth/Move/EndOfDayTest.php b/tests/Earth/Move/EndOfDayTest.php index 57bf2be..c79686c 100644 --- a/tests/Earth/Move/EndOfDayTest.php +++ b/tests/Earth/Move/EndOfDayTest.php @@ -23,12 +23,7 @@ public function testInterface($time, $expected) $point = $endOfDay(new PointInTime($time)); $this->assertInstanceOf(PointInTimeInterface::class, $point); - $this->assertSame($expected, $point->format(new class implements Format { - public function toString(): string - { - return 'Y-m-d H:i:s.u'; - } - })); + $this->assertSame($expected, $point->format(Format::of('Y-m-d H:i:s.u'))); } public static function cases(): array diff --git a/tests/Earth/Move/EndOfMonthTest.php b/tests/Earth/Move/EndOfMonthTest.php index 55beee6..5bc668d 100644 --- a/tests/Earth/Move/EndOfMonthTest.php +++ b/tests/Earth/Move/EndOfMonthTest.php @@ -23,12 +23,7 @@ public function testInterface($time, $expected) $point = $endOfMonth(new PointInTime($time)); $this->assertInstanceOf(PointInTimeInterface::class, $point); - $this->assertSame($expected, $point->format(new class implements Format { - public function toString(): string - { - return 'Y-m-d H:i:s.u'; - } - })); + $this->assertSame($expected, $point->format(Format::of('Y-m-d H:i:s.u'))); } public static function cases(): array diff --git a/tests/Earth/Move/EndOfYearTest.php b/tests/Earth/Move/EndOfYearTest.php index 012f6b1..1ebf8bc 100644 --- a/tests/Earth/Move/EndOfYearTest.php +++ b/tests/Earth/Move/EndOfYearTest.php @@ -23,12 +23,7 @@ public function testInterface($time, $expected) $point = $endOfYear(new PointInTime($time)); $this->assertInstanceOf(PointInTimeInterface::class, $point); - $this->assertSame($expected, $point->format(new class implements Format { - public function toString(): string - { - return 'Y-m-d H:i:s.u'; - } - })); + $this->assertSame($expected, $point->format(Format::of('Y-m-d H:i:s.u'))); } public static function cases(): array diff --git a/tests/Earth/Move/MonthTest.php b/tests/Earth/Move/MonthTest.php index 82f41dc..34dba8a 100644 --- a/tests/Earth/Move/MonthTest.php +++ b/tests/Earth/Move/MonthTest.php @@ -18,12 +18,7 @@ class MonthTest extends TestCase */ public function testInterface($time, $expectedForward, $expectedBackward) { - $format = new class implements Format { - public function toString(): string - { - return 'Y-m-d H:i:s.u'; - } - }; + $format = Format::of('Y-m-d H:i:s.u'); $forward = Month::forward(1); $backward = Month::backward(1); diff --git a/tests/Earth/Move/StartOfDayTest.php b/tests/Earth/Move/StartOfDayTest.php index 4a0ebca..08f7067 100644 --- a/tests/Earth/Move/StartOfDayTest.php +++ b/tests/Earth/Move/StartOfDayTest.php @@ -23,12 +23,7 @@ public function testInterface($time, $expected) $point = $startOfDay(new PointInTime($time)); $this->assertInstanceOf(PointInTimeInterface::class, $point); - $this->assertSame($expected, $point->format(new class implements Format { - public function toString(): string - { - return 'Y-m-d H:i:s.u'; - } - })); + $this->assertSame($expected, $point->format(Format::of('Y-m-d H:i:s.u'))); } public static function cases(): array diff --git a/tests/Earth/Move/StartOfMonthTest.php b/tests/Earth/Move/StartOfMonthTest.php index 483e8f2..6366f52 100644 --- a/tests/Earth/Move/StartOfMonthTest.php +++ b/tests/Earth/Move/StartOfMonthTest.php @@ -23,12 +23,7 @@ public function testInterface($time, $expected) $point = $startOfMonth(new PointInTime($time)); $this->assertInstanceOf(PointInTimeInterface::class, $point); - $this->assertSame($expected, $point->format(new class implements Format { - public function toString(): string - { - return 'Y-m-d H:i:s.u'; - } - })); + $this->assertSame($expected, $point->format(Format::of('Y-m-d H:i:s.u'))); } public static function cases(): array diff --git a/tests/Earth/Move/StartOfYearTest.php b/tests/Earth/Move/StartOfYearTest.php index b11df4f..801bd13 100644 --- a/tests/Earth/Move/StartOfYearTest.php +++ b/tests/Earth/Move/StartOfYearTest.php @@ -23,12 +23,7 @@ public function testInterface($time, $expected) $point = $startOfYear(new PointInTime($time)); $this->assertInstanceOf(PointInTimeInterface::class, $point); - $this->assertSame($expected, $point->format(new class implements Format { - public function toString(): string - { - return 'Y-m-d H:i:s.u'; - } - })); + $this->assertSame($expected, $point->format(Format::of('Y-m-d H:i:s.u'))); } public static function cases(): array diff --git a/tests/Earth/PointInTime/NowTest.php b/tests/Earth/PointInTime/NowTest.php index da65de2..9a48dae 100644 --- a/tests/Earth/PointInTime/NowTest.php +++ b/tests/Earth/PointInTime/NowTest.php @@ -65,14 +65,7 @@ public function testFormat() $this->assertSame( \date('H:i:s d/m/Y'), - $point->format( - new class implements Format { - public function toString(): string - { - return 'H:i:s d/m/Y'; - } - }, - ), + $point->format(Format::of('H:i:s d/m/Y')), ); } diff --git a/tests/Earth/PointInTime/PointInTimeTest.php b/tests/Earth/PointInTime/PointInTimeTest.php index 9b9ee9b..0772947 100644 --- a/tests/Earth/PointInTime/PointInTimeTest.php +++ b/tests/Earth/PointInTime/PointInTimeTest.php @@ -67,14 +67,7 @@ public function testFormat() $this->assertSame( '08:01:30 05/10/2016', - $point->format( - new class implements Format { - public function toString(): string - { - return 'H:i:s d/m/Y'; - } - }, - ), + $point->format(Format::of('H:i:s d/m/Y')), ); } @@ -183,14 +176,7 @@ public function testGoBack() '2016-10-05T08:01:29.500000+02:00', $point ->goBack(new MillisecondPeriod(623)) - ->format( - new class implements Format { - public function toString(): string - { - return 'Y-m-d\TH:i:s.uP'; - } - }, - ), + ->format(Format::of('Y-m-d\TH:i:s.uP')), ); } @@ -198,12 +184,7 @@ public function testGoBackOneDay() { $point = new PointInTime('2018-03-04'); $point2 = $point->goBack(new Day(1)); - $format = new class implements Format { - public function toString(): string - { - return 'Y-m-d\TH:i:s.u'; - } - }; + $format = Format::of('Y-m-d\TH:i:s.u'); $this->assertSame( '2018-03-04T00:00:00.000000', @@ -219,12 +200,7 @@ public function testGoBackOneMillisecondWhenCurrentPointIsAtPreciselyZeroMillise { $point = new PointInTime('1402-07-21 02:42:53.000000'); $point2 = $point->goBack(new MillisecondPeriod(1)); - $format = new class implements Format { - public function toString(): string - { - return 'Y-m-d\TH:i:s.u'; - } - }; + $format = Format::of('Y-m-d\TH:i:s.u'); $this->assertSame( '1402-07-21T02:42:53.000000', diff --git a/tests/Fixtures/Earth/PointInTimeTest.php b/tests/Fixtures/Earth/PointInTimeTest.php index aee4129..c34dffb 100644 --- a/tests/Fixtures/Earth/PointInTimeTest.php +++ b/tests/Fixtures/Earth/PointInTimeTest.php @@ -10,7 +10,7 @@ }; use Innmind\TimeContinuum\{ PointInTime as PointInTimeInterface, - Earth\Format\ISO8601, + Format, }; use PHPUnit\Framework\TestCase; @@ -40,7 +40,7 @@ public function testAfter() foreach ($points->values(Random::default) as $point) { $this->assertGreaterThanOrEqual( '1970-01-01T12:13:14+02:00', - $point->unwrap()->format(new ISO8601), + $point->unwrap()->format(Format::iso8601()), ); } } @@ -55,7 +55,7 @@ public function testBefore() foreach ($points->values(Random::default) as $point) { $this->assertLessThanOrEqual( '1970-01-01T12:13:14+02:00', - $point->unwrap()->format(new ISO8601), + $point->unwrap()->format(Format::iso8601()), ); } } diff --git a/tests/FormatTest.php b/tests/FormatTest.php new file mode 100644 index 0000000..3608861 --- /dev/null +++ b/tests/FormatTest.php @@ -0,0 +1,32 @@ +assertSame($expected, $format->toString()); + } + + public static function formats() + { + yield [Format::cookie(), \DateTime::COOKIE]; + yield [Format::iso8601(), \DateTime::ATOM]; + yield [Format::rfc1036(), \DateTime::RFC1036]; + yield [Format::rfc1123(), \DateTime::RFC1123]; + yield [Format::rfc2822(), \DateTime::RFC2822]; + yield [Format::rfc822(), \DateTime::RFC822]; + yield [Format::rfc850(), \DateTime::RFC850]; + yield [Format::rss(), \DateTime::RSS]; + yield [Format::w3c(), \DateTime::W3C]; + } +} diff --git a/tests/Logger/ClockTest.php b/tests/Logger/ClockTest.php index 0a8722f..abc5718 100644 --- a/tests/Logger/ClockTest.php +++ b/tests/Logger/ClockTest.php @@ -8,7 +8,6 @@ Clock as ClockInterface, PointInTime, Format, - Earth\Format\ISO8601, }; use Innmind\Immutable\Maybe; use Psr\Log\LoggerInterface; @@ -46,7 +45,7 @@ public function testGeneratedNowIsLogged() $now ->expects($this->once()) ->method('format') - ->with(new ISO8601) + ->with(Format::iso8601()) ->willReturn($value); $logger = $this->createMock(LoggerInterface::class); $logger @@ -80,7 +79,7 @@ public function testAskedDateIsLogged() $point ->expects($this->once()) ->method('format') - ->with(new ISO8601) + ->with(Format::iso8601()) ->willReturn($value); $logger = $this->createMock(LoggerInterface::class); $logger @@ -113,15 +112,19 @@ public function testAskedDateWithSpecificFormatIsLogged() ->forAll( Set\Strings::any(), Set\Strings::any(), - Set\Strings::any(), + Set\Elements::of( + Format::cookie(), + Format::iso8601(), + Format::rfc1036(), + Format::rfc1123(), + Format::rfc2822(), + Format::rfc822(), + Format::rfc850(), + Format::rss(), + Format::w3c(), + ), ) ->then(function($date, $value, $format) { - $formatObject = $this->createMock(Format::class); - $formatObject - ->expects($this->once()) - ->method('toString') - ->willReturn($format); - $formatClass = \get_class($formatObject); $concrete = $this->createMock(ClockInterface::class); $concrete ->expects($this->once()) @@ -131,7 +134,7 @@ public function testAskedDateWithSpecificFormatIsLogged() $point ->expects($this->once()) ->method('format') - ->with(new ISO8601) + ->with(Format::iso8601()) ->willReturn($value); $logger = $this->createMock(LoggerInterface::class); $logger @@ -141,7 +144,7 @@ public function testAskedDateWithSpecificFormatIsLogged() 'Asked time {date} ({format}) resolved to {point}', [ 'date' => $date, - 'format' => "$formatClass($format)", + 'format' => $format->toString(), 'point' => $value, ], ); @@ -150,7 +153,7 @@ public function testAskedDateWithSpecificFormatIsLogged() $this->assertSame( $point, - $clock->at($date, $formatObject)->match( + $clock->at($date, $format)->match( static fn($point) => $point, static fn() => null, ), From 76f7b827d6ba1e25a0092f562e38e56a0b6d3d3d Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Sun, 17 Nov 2024 17:45:15 +0100 Subject: [PATCH 07/85] make interfaces Clock\* final classes --- CHANGELOG.md | 2 + src/Clock/Day.php | 86 +++++++++++++++++++++++++-- src/Clock/Hour.php | 47 +++++++++++++-- src/Clock/Millisecond.php | 38 +++++++++++- src/Clock/Minute.php | 47 +++++++++++++-- src/Clock/Month.php | 62 +++++++++++++++++-- src/Clock/Second.php | 38 +++++++++++- src/Clock/Year.php | 54 +++++++++++++++-- src/Earth/Clock/Day.php | 60 ------------------- src/Earth/Clock/Hour.php | 41 ------------- src/Earth/Clock/Millisecond.php | 36 ----------- src/Earth/Clock/Minute.php | 41 ------------- src/Earth/Clock/Month.php | 48 --------------- src/Earth/Clock/Second.php | 36 ----------- src/Earth/Clock/Year.php | 41 ------------- src/Earth/PointInTime/PointInTime.php | 58 ++++++++++-------- tests/Clock/DayTest.php | 25 ++++++++ tests/Clock/HourTest.php | 19 ++++++ tests/Clock/MillisecondTest.php | 18 ++++++ tests/Clock/MinuteTest.php | 19 ++++++ tests/Clock/MonthTest.php | 22 +++++++ tests/Clock/SecondTest.php | 18 ++++++ tests/{Earth => }/Clock/YearTest.php | 12 ++-- tests/Earth/Clock/DayTest.php | 44 -------------- tests/Earth/Clock/HourTest.php | 40 ------------- tests/Earth/Clock/MillisecondTest.php | 39 ------------ tests/Earth/Clock/MinuteTest.php | 40 ------------- tests/Earth/Clock/MonthTest.php | 41 ------------- tests/Earth/Clock/SecondTest.php | 39 ------------ 29 files changed, 504 insertions(+), 607 deletions(-) delete mode 100644 src/Earth/Clock/Day.php delete mode 100644 src/Earth/Clock/Hour.php delete mode 100644 src/Earth/Clock/Millisecond.php delete mode 100644 src/Earth/Clock/Minute.php delete mode 100644 src/Earth/Clock/Month.php delete mode 100644 src/Earth/Clock/Second.php delete mode 100644 src/Earth/Clock/Year.php create mode 100644 tests/Clock/DayTest.php create mode 100644 tests/Clock/HourTest.php create mode 100644 tests/Clock/MillisecondTest.php create mode 100644 tests/Clock/MinuteTest.php create mode 100644 tests/Clock/MonthTest.php create mode 100644 tests/Clock/SecondTest.php rename tests/{Earth => }/Clock/YearTest.php (55%) delete mode 100644 tests/Earth/Clock/DayTest.php delete mode 100644 tests/Earth/Clock/HourTest.php delete mode 100644 tests/Earth/Clock/MillisecondTest.php delete mode 100644 tests/Earth/Clock/MinuteTest.php delete mode 100644 tests/Earth/Clock/MonthTest.php delete mode 100644 tests/Earth/Clock/SecondTest.php diff --git a/CHANGELOG.md b/CHANGELOG.md index 888e4b3..254c7a4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,11 +5,13 @@ ### Changed - `Innmind\TimeContinuum\Format` is now a `final class` +- Interfaces in the `Innmind\TimeContinuum\Clock` namespace are now `final class`es ### Removed - Support for `innmind/immutable` `4` - Classes in the `Innmind\TimeContinuum\Earth\Format` namespaces are now named constructors of `Innmind\TimeContinuum\Format` +- Classes in the `Innmind\TimeContinuum\Earth\Clock` namespace ## 3.4.1 - 2023-09-17 diff --git a/src/Clock/Day.php b/src/Clock/Day.php index a3b4ecb..943fa4f 100644 --- a/src/Clock/Day.php +++ b/src/Clock/Day.php @@ -6,11 +6,85 @@ /** * @psalm-immutable */ -interface Day +final class Day { - public function weekNumber(): int; - public function ofYear(): int; - public function numberOfHours(): int; - public function toInt(): int; - public function toString(): string; + /** @var int<1, 31> */ + private int $day; + /** @var int<0, 6> */ + private int $week; + /** @var int<0, 365> */ + private int $ofYear; + /** @var 'Monday'|'Tuesday'|'Wednesday'|'Thursday'|'Friday'|'Saturday'|'Sunday' */ + private string $string; + + /** + * @param int<1, 31> $day + */ + private function __construct(Year $year, Month $month, int $day) + { + $this->day = $day; + /** @var int<0, 6> */ + $this->week = (int) \date( + 'w', + $time = \mktime(0, 0, 0, $month->toInt(), $day, $year->toInt()), + ); + /** @var int<0, 365> */ + $this->ofYear = (int) \date('z', $time); + /** @var 'Monday'|'Tuesday'|'Wednesday'|'Thursday'|'Friday'|'Saturday'|'Sunday' */ + $this->string = \date('l', $time); + } + + /** + * @psalm-pure + * @internal + * + * @param int<1, 31> $day + */ + public static function of(Year $year, Month $month, int $day): self + { + return new self($year, $month, $day); + } + + /** + * @return int<0, 6> + */ + public function weekNumber(): int + { + // todo move to the Day\Week enum + return $this->week; + } + + /** + * @return int<0, 365> + */ + public function ofYear(): int + { + return $this->ofYear; + } + + /** + * @return 24 + */ + public function numberOfHours(): int + { + return 24; + } + + /** + * @return int<1, 31> + */ + public function toInt(): int + { + // todo rename to ofMonth + return $this->day; + } + + /** + * @return 'Monday'|'Tuesday'|'Wednesday'|'Thursday'|'Friday'|'Saturday'|'Sunday' + */ + public function toString(): string + { + // todo transform into an enum + return $this->string; + } } diff --git a/src/Clock/Hour.php b/src/Clock/Hour.php index dfaab4d..467848c 100644 --- a/src/Clock/Hour.php +++ b/src/Clock/Hour.php @@ -6,9 +6,48 @@ /** * @psalm-immutable */ -interface Hour +final class Hour { - public function numberOfMinutes(): int; - public function toInt(): int; - public function toString(): string; + /** + * @param int<0, 23> $hour + */ + private function __construct( + private int $hour, + ) { + } + + /** + * @psalm-pure + * @internal + * + * @param int<0, 23> $hour + */ + public static function of(int $hour): self + { + return new self($hour); + } + + /** + * @return 60 + */ + public function numberOfMinutes(): int + { + return 60; + } + + /** + * @return int<0, 23> + */ + public function toInt(): int + { + return $this->hour; + } + + /** + * @return non-empty-string + */ + public function toString(): string + { + return (string) $this->hour; + } } diff --git a/src/Clock/Millisecond.php b/src/Clock/Millisecond.php index dbdf801..426f60f 100644 --- a/src/Clock/Millisecond.php +++ b/src/Clock/Millisecond.php @@ -6,8 +6,40 @@ /** * @psalm-immutable */ -interface Millisecond +final class Millisecond { - public function toInt(): int; - public function toString(): string; + /** + * @param int<0, 999> $millisecond + */ + private function __construct( + private int $millisecond, + ) { + } + + /** + * @psalm-pure + * @internal + * + * @param int<0, 999> $millisecond + */ + public static function of(int $millisecond): self + { + return new self($millisecond); + } + + /** + * @return int<0, 999> + */ + public function toInt(): int + { + return $this->millisecond; + } + + /** + * @return non-empty-string + */ + public function toString(): string + { + return (string) $this->millisecond; + } } diff --git a/src/Clock/Minute.php b/src/Clock/Minute.php index 1cded30..512405b 100644 --- a/src/Clock/Minute.php +++ b/src/Clock/Minute.php @@ -6,9 +6,48 @@ /** * @psalm-immutable */ -interface Minute +final class Minute { - public function numberOfSeconds(): int; - public function toInt(): int; - public function toString(): string; + /** + * @param int<0, 59> $minute + */ + private function __construct( + private int $minute, + ) { + } + + /** + * @psalm-pure + * @internal + * + * @param int<0, 59> $minute + */ + public static function of(int $minute): self + { + return new self($minute); + } + + /** + * @return 60 + */ + public function numberOfSeconds(): int + { + return 60; + } + + /** + * @return int<0, 59> + */ + public function toInt(): int + { + return $this->minute; + } + + /** + * @return non-empty-string + */ + public function toString(): string + { + return (string) $this->minute; + } } diff --git a/src/Clock/Month.php b/src/Clock/Month.php index 321b4c0..9b4720e 100644 --- a/src/Clock/Month.php +++ b/src/Clock/Month.php @@ -6,9 +6,63 @@ /** * @psalm-immutable */ -interface Month +final class Month { - public function numberOfDays(): int; - public function toInt(): int; - public function toString(): string; + /** @var int<1, 12> */ + private int $month; + /** @var int<28, 31> */ + private int $days; + /** @var 'January'|'February'|'March'|'April'|'May'|'June'|'July'|'August'|'September'|'October'|'November'|'December' */ + private string $string; + + /** + * @param int<1, 12> $month + */ + private function __construct(Year $year, int $month) + { + // todo transform into an enum + $this->month = $month; + /** @var int<28, 31> */ + $this->days = (int) \date( + 't', + $time = \mktime(0, 0, 0, $month, 1, $year->toInt()), + ); + /** @var 'January'|'February'|'March'|'April'|'May'|'June'|'July'|'August'|'September'|'October'|'November'|'December' */ + $this->string = \date('F', $time); + } + + /** + * @psalm-pure + * @internal + * + * @param int<1, 12> $month + */ + public static function of(Year $year, int $month): self + { + return new self($year, $month); + } + + /** + * @return int<28, 31> + */ + public function numberOfDays(): int + { + return $this->days; + } + + /** + * @return int<1, 12> + */ + public function toInt(): int + { + return $this->month; + } + + /** + * @return 'January'|'February'|'March'|'April'|'May'|'June'|'July'|'August'|'September'|'October'|'November'|'December' + */ + public function toString(): string + { + return $this->string; + } } diff --git a/src/Clock/Second.php b/src/Clock/Second.php index ac4ca02..2771c0f 100644 --- a/src/Clock/Second.php +++ b/src/Clock/Second.php @@ -6,8 +6,40 @@ /** * @psalm-immutable */ -interface Second +final class Second { - public function toInt(): int; - public function toString(): string; + /** + * @param int<0, 59> $second + */ + private function __construct( + private int $second, + ) { + } + + /** + * @psalm-pure + * @internal + * + * @param int<0, 59> $second + */ + public static function of(int $second): self + { + return new self($second); + } + + /** + * @return int<0, 59> + */ + public function toInt(): int + { + return $this->second; + } + + /** + * @return non-empty-string + */ + public function toString(): string + { + return (string) $this->second; + } } diff --git a/src/Clock/Year.php b/src/Clock/Year.php index bc82c57..e23c4de 100644 --- a/src/Clock/Year.php +++ b/src/Clock/Year.php @@ -6,10 +6,54 @@ /** * @psalm-immutable */ -interface Year +final class Year { - public function numberOfDays(): int; - public function numberOfMonths(): int; - public function toInt(): int; - public function toString(): string; + private int $year; + /** @var int<0, 365> */ + private int $days; + + private function __construct(int $year) + { + $this->year = $year; + /** @var int<0, 365> */ + $this->days = (int) \date('z', \mktime(0, 0, 0, 12, 31, $year)) + 1; + } + + /** + * @psalm-pure + * @internal + */ + public static function of(int $year): self + { + return new self($year); + } + + /** + * @return int<0, 365> + */ + public function numberOfDays(): int + { + return $this->days; + } + + /** + * @return 12 + */ + public function numberOfMonths(): int + { + return 12; + } + + public function toInt(): int + { + return $this->year; + } + + /** + * @return non-empty-string + */ + public function toString(): string + { + return (string) $this->year; + } } diff --git a/src/Earth/Clock/Day.php b/src/Earth/Clock/Day.php deleted file mode 100644 index e70845a..0000000 --- a/src/Earth/Clock/Day.php +++ /dev/null @@ -1,60 +0,0 @@ - 31) { - throw new DomainException((string) $day); - } - - $this->day = $day; - $this->week = (int) \date( - 'w', - $time = \mktime(0, 0, 0, $month->toInt(), $day, $year->toInt()), - ); - $this->ofYear = (int) \date('z', $time); - $this->string = \date('l', $time); - } - - public function weekNumber(): int - { - return $this->week; - } - - public function ofYear(): int - { - return $this->ofYear; - } - - public function numberOfHours(): int - { - return 24; - } - - public function toInt(): int - { - return $this->day; - } - - public function toString(): string - { - return $this->string; - } -} diff --git a/src/Earth/Clock/Hour.php b/src/Earth/Clock/Hour.php deleted file mode 100644 index 7343308..0000000 --- a/src/Earth/Clock/Hour.php +++ /dev/null @@ -1,41 +0,0 @@ - 23) { - throw new DomainException((string) $hour); - } - - $this->hour = $hour; - } - - public function numberOfMinutes(): int - { - return 60; - } - - public function toInt(): int - { - return $this->hour; - } - - public function toString(): string - { - return (string) $this->hour; - } -} diff --git a/src/Earth/Clock/Millisecond.php b/src/Earth/Clock/Millisecond.php deleted file mode 100644 index 8886880..0000000 --- a/src/Earth/Clock/Millisecond.php +++ /dev/null @@ -1,36 +0,0 @@ - 999) { - throw new DomainException((string) $millisecond); - } - - $this->millisecond = $millisecond; - } - - public function toInt(): int - { - return $this->millisecond; - } - - public function toString(): string - { - return (string) $this->millisecond; - } -} diff --git a/src/Earth/Clock/Minute.php b/src/Earth/Clock/Minute.php deleted file mode 100644 index 3169fc3..0000000 --- a/src/Earth/Clock/Minute.php +++ /dev/null @@ -1,41 +0,0 @@ - 59) { - throw new DomainException((string) $minute); - } - - $this->minute = $minute; - } - - public function numberOfSeconds(): int - { - return 60; - } - - public function toInt(): int - { - return $this->minute; - } - - public function toString(): string - { - return (string) $this->minute; - } -} diff --git a/src/Earth/Clock/Month.php b/src/Earth/Clock/Month.php deleted file mode 100644 index 0ae251c..0000000 --- a/src/Earth/Clock/Month.php +++ /dev/null @@ -1,48 +0,0 @@ - 12) { - throw new DomainException((string) $month); - } - - $this->month = $month; - $this->days = (int) \date( - 't', - $time = \mktime(0, 0, 0, $month, 1, $year->toInt()), - ); - $this->string = \date('F', $time); - } - - public function numberOfDays(): int - { - return $this->days; - } - - public function toInt(): int - { - return $this->month; - } - - public function toString(): string - { - return $this->string; - } -} diff --git a/src/Earth/Clock/Second.php b/src/Earth/Clock/Second.php deleted file mode 100644 index 931d89c..0000000 --- a/src/Earth/Clock/Second.php +++ /dev/null @@ -1,36 +0,0 @@ - 59) { - throw new DomainException((string) $second); - } - - $this->second = $second; - } - - public function toInt(): int - { - return $this->second; - } - - public function toString(): string - { - return (string) $this->second; - } -} diff --git a/src/Earth/Clock/Year.php b/src/Earth/Clock/Year.php deleted file mode 100644 index 12d197a..0000000 --- a/src/Earth/Clock/Year.php +++ /dev/null @@ -1,41 +0,0 @@ -year = $year; - $this->days = (int) \date('z', \mktime(0, 0, 0, 12, 31, $year)) + 1; - } - - public function numberOfDays(): int - { - return $this->days; - } - - public function numberOfMonths(): int - { - return 12; - } - - public function toInt(): int - { - return $this->year; - } - - public function toString(): string - { - return (string) $this->year; - } -} diff --git a/src/Earth/PointInTime/PointInTime.php b/src/Earth/PointInTime/PointInTime.php index 1504caf..f00f738 100644 --- a/src/Earth/PointInTime/PointInTime.php +++ b/src/Earth/PointInTime/PointInTime.php @@ -10,14 +10,14 @@ Earth\ElapsedPeriod, ElapsedPeriod as ElapsedPeriodInterface, Period, + Clock\Year, + Clock\Month, + Clock\Day, + Clock\Hour, + Clock\Minute, + Clock\Second, + Clock\Millisecond, Earth\Timezone\UTC, - Earth\Clock\Year, - Earth\Clock\Month, - Earth\Clock\Day, - Earth\Clock\Hour, - Earth\Clock\Minute, - Earth\Clock\Second, - Earth\Clock\Millisecond, Earth\Period\Millisecond as MillisecondPeriod, }; @@ -46,51 +46,61 @@ public function milliseconds(): int public function year(): Year { - return new Year((int) $this->date->format('Y')); + return Year::of((int) $this->date->format('Y')); } public function month(): Month { - return new Month( + /** @var int<1, 12> */ + $month = (int) $this->date->format('n'); + + return Month::of( $this->year(), - (int) $this->date->format('n'), + $month, ); } public function day(): Day { - return new Day( + /** @var int<1, 31> */ + $day = (int) $this->date->format('j'); + + return Day::of( $this->year(), $this->month(), - (int) $this->date->format('j'), + $day, ); } public function hour(): Hour { - return new Hour( - (int) $this->date->format('G'), - ); + /** @var int<0, 23> */ + $hour = (int) $this->date->format('G'); + + return Hour::of($hour); } public function minute(): Minute { - return new Minute( - (int) $this->date->format('i'), - ); + /** @var int<0, 59> */ + $minute = (int) $this->date->format('i'); + + return Minute::of($minute); } public function second(): Second { - return new Second( - (int) $this->date->format('s'), - ); + /** @var int<0, 59> */ + $second = (int) $this->date->format('s'); + + return Second::of($second); } public function millisecond(): Millisecond { - return new Millisecond( - (int) ((int) $this->date->format('u') / 1000), - ); + /** @var int<0, 999> */ + $millisecond = (int) ((int) $this->date->format('u') / 1000); + + return Millisecond::of($millisecond); } public function format(Format $format): string diff --git a/tests/Clock/DayTest.php b/tests/Clock/DayTest.php new file mode 100644 index 0000000..68f6f75 --- /dev/null +++ b/tests/Clock/DayTest.php @@ -0,0 +1,25 @@ +assertSame(3, $day->weekNumber()); + $this->assertSame(278, $day->ofYear()); + $this->assertSame(24, $day->numberOfHours()); + $this->assertSame(5, $day->toInt()); + $this->assertSame('Wednesday', $day->toString()); + } +} diff --git a/tests/Clock/HourTest.php b/tests/Clock/HourTest.php new file mode 100644 index 0000000..3e084d6 --- /dev/null +++ b/tests/Clock/HourTest.php @@ -0,0 +1,19 @@ +assertSame(60, $hour->numberOfMinutes()); + $this->assertSame(13, $hour->toInt()); + $this->assertSame('13', $hour->toString()); + } +} diff --git a/tests/Clock/MillisecondTest.php b/tests/Clock/MillisecondTest.php new file mode 100644 index 0000000..14fac4d --- /dev/null +++ b/tests/Clock/MillisecondTest.php @@ -0,0 +1,18 @@ +assertSame(600, $millisecond->toInt()); + $this->assertSame('600', $millisecond->toString()); + } +} diff --git a/tests/Clock/MinuteTest.php b/tests/Clock/MinuteTest.php new file mode 100644 index 0000000..72e2ee9 --- /dev/null +++ b/tests/Clock/MinuteTest.php @@ -0,0 +1,19 @@ +assertSame(60, $minute->numberOfSeconds()); + $this->assertSame(13, $minute->toInt()); + $this->assertSame('13', $minute->toString()); + } +} diff --git a/tests/Clock/MonthTest.php b/tests/Clock/MonthTest.php new file mode 100644 index 0000000..7fd4a76 --- /dev/null +++ b/tests/Clock/MonthTest.php @@ -0,0 +1,22 @@ +assertSame(31, $month->numberOfDays()); + $this->assertSame(10, $month->toInt()); + $this->assertSame('October', $month->toString()); + } +} diff --git a/tests/Clock/SecondTest.php b/tests/Clock/SecondTest.php new file mode 100644 index 0000000..8962fa7 --- /dev/null +++ b/tests/Clock/SecondTest.php @@ -0,0 +1,18 @@ +assertSame(13, $second->toInt()); + $this->assertSame('13', $second->toString()); + } +} diff --git a/tests/Earth/Clock/YearTest.php b/tests/Clock/YearTest.php similarity index 55% rename from tests/Earth/Clock/YearTest.php rename to tests/Clock/YearTest.php index 76ce8df..9083417 100644 --- a/tests/Earth/Clock/YearTest.php +++ b/tests/Clock/YearTest.php @@ -1,26 +1,22 @@ assertInstanceOf(YearInterface::class, $year); $this->assertSame(366, $year->numberOfDays()); $this->assertSame(12, $year->numberOfMonths()); $this->assertSame(2016, $year->toInt()); $this->assertSame('2016', $year->toString()); - $this->assertSame(365, (new Year(2017))->numberOfDays()); + $this->assertSame(365, Year::of(2017)->numberOfDays()); } } diff --git a/tests/Earth/Clock/DayTest.php b/tests/Earth/Clock/DayTest.php deleted file mode 100644 index 2cbb06d..0000000 --- a/tests/Earth/Clock/DayTest.php +++ /dev/null @@ -1,44 +0,0 @@ -assertInstanceOf(DayInterface::class, $day); - $this->assertSame(3, $day->weekNumber()); - $this->assertSame(278, $day->ofYear()); - $this->assertSame(24, $day->numberOfHours()); - $this->assertSame(5, $day->toInt()); - $this->assertSame('Wednesday', $day->toString()); - } - - public function testThrowWhenDayTooLow() - { - $this->expectException(DomainException::class); - $this->expectExceptionMessage('0'); - - new Day($year = new Year(2016), new Month($year, 10), 0); - } - - public function testThrowWhenDayTooHigh() - { - $this->expectException(DomainException::class); - $this->expectExceptionMessage('32'); - - new Day($year = new Year(2016), new Month($year, 10), 32); - } -} diff --git a/tests/Earth/Clock/HourTest.php b/tests/Earth/Clock/HourTest.php deleted file mode 100644 index 34460d6..0000000 --- a/tests/Earth/Clock/HourTest.php +++ /dev/null @@ -1,40 +0,0 @@ -assertInstanceOf(HourInterface::class, $hour); - $this->assertSame(60, $hour->numberOfMinutes()); - $this->assertSame(13, $hour->toInt()); - $this->assertSame('13', $hour->toString()); - } - - public function testThrowWhenHourTooLow() - { - $this->expectException(DomainException::class); - $this->expectExceptionMessage('-1'); - - new Hour(-1); - } - - public function testThrowWhenHourTooHigh() - { - $this->expectException(DomainException::class); - $this->expectExceptionMessage('24'); - - new Hour(24); - } -} diff --git a/tests/Earth/Clock/MillisecondTest.php b/tests/Earth/Clock/MillisecondTest.php deleted file mode 100644 index afb6ef0..0000000 --- a/tests/Earth/Clock/MillisecondTest.php +++ /dev/null @@ -1,39 +0,0 @@ -assertInstanceOf(MillisecondInterface::class, $millisecond); - $this->assertSame(600, $millisecond->toInt()); - $this->assertSame('600', $millisecond->toString()); - } - - public function testThrowWhenMillisecondTooLow() - { - $this->expectException(DomainException::class); - $this->expectExceptionMessage('-1'); - - new Millisecond(-1); - } - - public function testThrowWhenMillisecondTooHigh() - { - $this->expectException(DomainException::class); - $this->expectExceptionMessage('00'); - - new Millisecond(1000); - } -} diff --git a/tests/Earth/Clock/MinuteTest.php b/tests/Earth/Clock/MinuteTest.php deleted file mode 100644 index d8dc26a..0000000 --- a/tests/Earth/Clock/MinuteTest.php +++ /dev/null @@ -1,40 +0,0 @@ -assertInstanceOf(MinuteInterface::class, $minute); - $this->assertSame(60, $minute->numberOfSeconds()); - $this->assertSame(13, $minute->toInt()); - $this->assertSame('13', $minute->toString()); - } - - public function testThrowWhenMinuteTooLow() - { - $this->expectException(DomainException::class); - $this->expectExceptionMessage('-1'); - - new Minute(-1); - } - - public function testThrowWhenMinuteTooHigh() - { - $this->expectException(DomainException::class); - $this->expectExceptionMessage('60'); - - new Minute(60); - } -} diff --git a/tests/Earth/Clock/MonthTest.php b/tests/Earth/Clock/MonthTest.php deleted file mode 100644 index 30f36eb..0000000 --- a/tests/Earth/Clock/MonthTest.php +++ /dev/null @@ -1,41 +0,0 @@ -assertInstanceOf(MonthInterface::class, $month); - $this->assertSame(31, $month->numberOfDays()); - $this->assertSame(10, $month->toInt()); - $this->assertSame('October', $month->toString()); - } - - public function testThrowWhenMonthTooLow() - { - $this->expectException(DomainException::class); - $this->expectExceptionMessage('0'); - - new Month(new Year(2016), 0); - } - - public function testThrowWhenMonthTooHigh() - { - $this->expectException(DomainException::class); - $this->expectExceptionMessage('13'); - - new Month(new Year(2016), 13); - } -} diff --git a/tests/Earth/Clock/SecondTest.php b/tests/Earth/Clock/SecondTest.php deleted file mode 100644 index 79e2d55..0000000 --- a/tests/Earth/Clock/SecondTest.php +++ /dev/null @@ -1,39 +0,0 @@ -assertInstanceOf(SecondInterface::class, $second); - $this->assertSame(13, $second->toInt()); - $this->assertSame('13', $second->toString()); - } - - public function testThrowWhenSecondTooLow() - { - $this->expectException(DomainException::class); - $this->expectExceptionMessage('-1'); - - new Second(-1); - } - - public function testThrowWhenSecondTooHigh() - { - $this->expectException(DomainException::class); - $this->expectExceptionMessage('60'); - - new Second(60); - } -} From 9862ad9858b2255410635b5975456d304a6d2ee3 Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Sun, 17 Nov 2024 17:49:25 +0100 Subject: [PATCH 08/85] rename Clock namespace to PointInTime --- CHANGELOG.md | 1 + src/Earth/PointInTime/Now.php | 14 +++++++------- src/Earth/PointInTime/PointInTime.php | 14 +++++++------- src/PointInTime.php | 2 +- src/{Clock => PointInTime}/Day.php | 2 +- src/{Clock => PointInTime}/Hour.php | 2 +- src/{Clock => PointInTime}/Millisecond.php | 2 +- src/{Clock => PointInTime}/Minute.php | 2 +- src/{Clock => PointInTime}/Month.php | 2 +- src/{Clock => PointInTime}/Second.php | 2 +- src/{Clock => PointInTime}/Year.php | 2 +- tests/Earth/PointInTime/NowTest.php | 14 +++++++------- tests/Earth/PointInTime/PointInTimeTest.php | 14 +++++++------- tests/{Clock => PointInTime}/DayTest.php | 8 ++++---- tests/{Clock => PointInTime}/HourTest.php | 4 ++-- tests/{Clock => PointInTime}/MillisecondTest.php | 4 ++-- tests/{Clock => PointInTime}/MinuteTest.php | 4 ++-- tests/{Clock => PointInTime}/MonthTest.php | 6 +++--- tests/{Clock => PointInTime}/SecondTest.php | 4 ++-- tests/{Clock => PointInTime}/YearTest.php | 4 ++-- 20 files changed, 54 insertions(+), 53 deletions(-) rename src/{Clock => PointInTime}/Day.php (97%) rename src/{Clock => PointInTime}/Hour.php (94%) rename src/{Clock => PointInTime}/Millisecond.php (93%) rename src/{Clock => PointInTime}/Minute.php (94%) rename src/{Clock => PointInTime}/Month.php (97%) rename src/{Clock => PointInTime}/Second.php (93%) rename src/{Clock => PointInTime}/Year.php (95%) rename tests/{Clock => PointInTime}/DayTest.php (81%) rename tests/{Clock => PointInTime}/HourTest.php (78%) rename tests/{Clock => PointInTime}/MillisecondTest.php (75%) rename tests/{Clock => PointInTime}/MinuteTest.php (78%) rename tests/{Clock => PointInTime}/MonthTest.php (80%) rename tests/{Clock => PointInTime}/SecondTest.php (75%) rename tests/{Clock => PointInTime}/YearTest.php (83%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 254c7a4..348e03e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - `Innmind\TimeContinuum\Format` is now a `final class` - Interfaces in the `Innmind\TimeContinuum\Clock` namespace are now `final class`es +- Classes in the `Innmind\TimeContinuum\Clock` namespace have been moved to `Innmind\TimeContinuum\PointInTime` ### Removed diff --git a/src/Earth/PointInTime/Now.php b/src/Earth/PointInTime/Now.php index b3844e2..4edb364 100644 --- a/src/Earth/PointInTime/Now.php +++ b/src/Earth/PointInTime/Now.php @@ -10,13 +10,13 @@ Earth\ElapsedPeriod, ElapsedPeriod as ElapsedPeriodInterface, Period, - Clock\Year, - Clock\Month, - Clock\Day, - Clock\Hour, - Clock\Minute, - Clock\Second, - Clock\Millisecond, + PointInTime\Year, + PointInTime\Month, + PointInTime\Day, + PointInTime\Hour, + PointInTime\Minute, + PointInTime\Second, + PointInTime\Millisecond, }; /** diff --git a/src/Earth/PointInTime/PointInTime.php b/src/Earth/PointInTime/PointInTime.php index f00f738..c85b54c 100644 --- a/src/Earth/PointInTime/PointInTime.php +++ b/src/Earth/PointInTime/PointInTime.php @@ -10,13 +10,13 @@ Earth\ElapsedPeriod, ElapsedPeriod as ElapsedPeriodInterface, Period, - Clock\Year, - Clock\Month, - Clock\Day, - Clock\Hour, - Clock\Minute, - Clock\Second, - Clock\Millisecond, + PointInTime\Year, + PointInTime\Month, + PointInTime\Day, + PointInTime\Hour, + PointInTime\Minute, + PointInTime\Second, + PointInTime\Millisecond, Earth\Timezone\UTC, Earth\Period\Millisecond as MillisecondPeriod, }; diff --git a/src/PointInTime.php b/src/PointInTime.php index ee5662b..23547f1 100644 --- a/src/PointInTime.php +++ b/src/PointInTime.php @@ -3,7 +3,7 @@ namespace Innmind\TimeContinuum; -use Innmind\TimeContinuum\Clock\{ +use Innmind\TimeContinuum\PointInTime\{ Year, Month, Day, diff --git a/src/Clock/Day.php b/src/PointInTime/Day.php similarity index 97% rename from src/Clock/Day.php rename to src/PointInTime/Day.php index 943fa4f..af8bfd7 100644 --- a/src/Clock/Day.php +++ b/src/PointInTime/Day.php @@ -1,7 +1,7 @@ Date: Sun, 17 Nov 2024 18:47:51 +0100 Subject: [PATCH 09/85] make Period a final class --- CHANGELOG.md | 2 + fixtures/Earth/Period.php | 28 +-- src/Earth/Move/EndOfDay.php | 16 +- src/Earth/Move/EndOfMonth.php | 5 +- src/Earth/Move/EndOfYear.php | 4 +- src/Earth/Move/Month.php | 34 ++-- src/Earth/Move/StartOfDay.php | 16 +- src/Earth/Move/StartOfMonth.php | 4 +- src/Earth/Move/StartOfYear.php | 4 +- src/Earth/Period/Composite.php | 124 ------------ src/Earth/Period/Day.php | 99 ---------- src/Earth/Period/Hour.php | 101 ---------- src/Earth/Period/Millisecond.php | 101 ---------- src/Earth/Period/Minute.php | 101 ---------- src/Earth/Period/Month.php | 95 --------- src/Earth/Period/Second.php | 101 ---------- src/Earth/Period/Year.php | 93 --------- src/Earth/PointInTime/PointInTime.php | 5 +- src/Period.php | 185 +++++++++++++++++- src/Period/Day.php | 31 +++ src/Period/Hour.php | 35 ++++ src/Period/Millisecond.php | 36 ++++ src/Period/Minute.php | 36 ++++ src/Period/Month.php | 35 ++++ src/Period/Second.php | 36 ++++ src/Period/Year.php | 31 +++ tests/Earth/ElapsedPeriodTest.php | 8 +- tests/Earth/PointInTime/NowTest.php | 10 +- tests/Earth/PointInTime/PointInTimeTest.php | 15 +- tests/Fixtures/Earth/PeriodTest.php | 11 +- .../Period/CompositeTest.php => Period.php} | 55 +----- tests/{Earth => }/Period/DayTest.php | 25 +-- tests/{Earth => }/Period/HourTest.php | 27 +-- tests/{Earth => }/Period/MillisecondTest.php | 27 +-- tests/{Earth => }/Period/MinuteTest.php | 27 +-- tests/{Earth => }/Period/MonthTest.php | 21 +- tests/{Earth => }/Period/SecondTest.php | 27 +-- tests/{Earth => }/Period/YearTest.php | 19 +- 38 files changed, 557 insertions(+), 1073 deletions(-) delete mode 100644 src/Earth/Period/Composite.php delete mode 100644 src/Earth/Period/Day.php delete mode 100644 src/Earth/Period/Hour.php delete mode 100644 src/Earth/Period/Millisecond.php delete mode 100644 src/Earth/Period/Minute.php delete mode 100644 src/Earth/Period/Month.php delete mode 100644 src/Earth/Period/Second.php delete mode 100644 src/Earth/Period/Year.php create mode 100644 src/Period/Day.php create mode 100644 src/Period/Hour.php create mode 100644 src/Period/Millisecond.php create mode 100644 src/Period/Minute.php create mode 100644 src/Period/Month.php create mode 100644 src/Period/Second.php create mode 100644 src/Period/Year.php rename tests/{Earth/Period/CompositeTest.php => Period.php} (59%) rename tests/{Earth => }/Period/DayTest.php (74%) rename tests/{Earth => }/Period/HourTest.php (78%) rename tests/{Earth => }/Period/MillisecondTest.php (81%) rename tests/{Earth => }/Period/MinuteTest.php (79%) rename tests/{Earth => }/Period/MonthTest.php (81%) rename tests/{Earth => }/Period/SecondTest.php (80%) rename tests/{Earth => }/Period/YearTest.php (76%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 348e03e..dd51b63 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,12 +7,14 @@ - `Innmind\TimeContinuum\Format` is now a `final class` - Interfaces in the `Innmind\TimeContinuum\Clock` namespace are now `final class`es - Classes in the `Innmind\TimeContinuum\Clock` namespace have been moved to `Innmind\TimeContinuum\PointInTime` +- `Innmind\TimeContinuum\Period` is now a `final class` ### Removed - Support for `innmind/immutable` `4` - Classes in the `Innmind\TimeContinuum\Earth\Format` namespaces are now named constructors of `Innmind\TimeContinuum\Format` - Classes in the `Innmind\TimeContinuum\Earth\Clock` namespace +- Classes in the `Innmind\TimeContinuum\Earth\Period` namespace ## 3.4.1 - 2023-09-17 diff --git a/fixtures/Earth/Period.php b/fixtures/Earth/Period.php index d89b246..a2ce9ee 100644 --- a/fixtures/Earth/Period.php +++ b/fixtures/Earth/Period.php @@ -3,31 +3,21 @@ namespace Fixtures\Innmind\TimeContinuum\Earth; -use Innmind\TimeContinuum\Earth\Period\{ - Composite, - Year, +use Innmind\TimeContinuum\{ + Period as Model, + Period\Year, }; use Innmind\BlackBox\Set; final class Period { /** - * @return Set + * @return Set */ public static function any(): Set { return Set\Composite::immutable( - static function($year, $month, $day, $hour, $minute, $second, $millisecond): Composite { - return new Composite( - $year, - $month, - $day, - $hour, - $minute, - $second, - $millisecond, - ); - }, + Model::of(...), Set\Integers::between(0, 9999), Set\Integers::between(0, 12), Set\Integers::between(0, 31), @@ -44,19 +34,19 @@ static function($year, $month, $day, $hour, $minute, $second, $millisecond): Com public static function anyNumberOfYear(): Set { return Set\Decorate::immutable( - static fn(int $year): Year => new Year($year), + Year::of(...), Set\Integers::between(0, 9999), )->take(100); } /** - * @return Set + * @return Set */ public static function lessThanAYear(): Set { return Set\Composite::immutable( - static function($day, $hour, $minute, $second, $millisecond): Composite { - return new Composite( + static function($day, $hour, $minute, $second, $millisecond): Model { + return Model::of( 0, 0, $day, diff --git a/src/Earth/Move/EndOfDay.php b/src/Earth/Move/EndOfDay.php index a904102..2ebd51d 100644 --- a/src/Earth/Move/EndOfDay.php +++ b/src/Earth/Move/EndOfDay.php @@ -5,10 +5,10 @@ use Innmind\TimeContinuum\{ PointInTime, - Earth\Period\Hour, - Earth\Period\Minute, - Earth\Period\Second, - Earth\Period\Millisecond, + Period\Hour, + Period\Minute, + Period\Second, + Period\Millisecond, }; final class EndOfDay @@ -16,10 +16,10 @@ final class EndOfDay public function __invoke(PointInTime $point): PointInTime { return $point->goForward( - (new Hour(23 - $point->hour()->toInt())) - ->add(new Minute(59 - $point->minute()->toInt())) - ->add(new Second(59 - $point->second()->toInt())) - ->add(new Millisecond(999 - $point->millisecond()->toInt())), + Hour::of(23 - $point->hour()->toInt()) + ->add(Minute::of(59 - $point->minute()->toInt())) + ->add(Second::of(59 - $point->second()->toInt())) + ->add(Millisecond::of(999 - $point->millisecond()->toInt())), ); } } diff --git a/src/Earth/Move/EndOfMonth.php b/src/Earth/Move/EndOfMonth.php index 35713d9..de963c3 100644 --- a/src/Earth/Move/EndOfMonth.php +++ b/src/Earth/Move/EndOfMonth.php @@ -5,15 +5,16 @@ use Innmind\TimeContinuum\{ PointInTime, - Earth\Period\Day, + Period\Day, }; final class EndOfMonth { public function __invoke(PointInTime $point): PointInTime { + /** @psalm-suppress InvalidArgument The negative values can only happen when working with 2 different points in time */ return (new EndOfDay)($point)->goForward( - new Day($point->month()->numberOfDays() - $point->day()->toInt()), + Day::of($point->month()->numberOfDays() - $point->day()->toInt()), ); } } diff --git a/src/Earth/Move/EndOfYear.php b/src/Earth/Move/EndOfYear.php index 21e5968..2742a72 100644 --- a/src/Earth/Move/EndOfYear.php +++ b/src/Earth/Move/EndOfYear.php @@ -5,7 +5,7 @@ use Innmind\TimeContinuum\{ PointInTime, - Earth\Period\Month, + Period\Month, }; final class EndOfYear @@ -13,7 +13,7 @@ final class EndOfYear public function __invoke(PointInTime $point): PointInTime { $point = (new StartOfMonth)($point)->goForward( - new Month(12 - $point->month()->toInt()), + Month::of(12 - $point->month()->toInt()), ); return (new EndOfMonth)($point); diff --git a/src/Earth/Move/Month.php b/src/Earth/Move/Month.php index 8b78049..4132d96 100644 --- a/src/Earth/Move/Month.php +++ b/src/Earth/Move/Month.php @@ -5,12 +5,12 @@ use Innmind\TimeContinuum\{ PointInTime, - Earth\Period\Day, - Earth\Period\Hour, - Earth\Period\Minute, - Earth\Period\Second, - Earth\Period\Millisecond, - Earth\Period\Month as Period, + Period, + Period\Day, + Period\Hour, + Period\Minute, + Period\Second, + Period\Millisecond, }; final class Month @@ -29,30 +29,36 @@ public function __invoke(PointInTime $point): PointInTime /** @var PointInTime $newPoint */ $newPoint = (new StartOfMonth)($point)->{$this->direction}($this->months); $newPoint = $newPoint->goForward( - (new Hour($point->hour()->toInt())) - ->add(new Minute($point->minute()->toInt())) - ->add(new Second($point->second()->toInt())) - ->add(new Millisecond($point->millisecond()->toInt())), + Hour::of($point->hour()->toInt()) + ->add(Minute::of($point->minute()->toInt())) + ->add(Second::of($point->second()->toInt())) + ->add(Millisecond::of($point->millisecond()->toInt())), ); if ($newPoint->month()->numberOfDays() < $point->day()->toInt()) { return $newPoint->goForward( - new Day($newPoint->month()->numberOfDays() - 1), + Day::of($newPoint->month()->numberOfDays() - 1), ); } return $newPoint->goForward( - new Day($point->day()->toInt() - 1), + Day::of($point->day()->toInt() - 1), ); } + /** + * @param int<1, max> $months + */ public static function forward(int $months): self { - return new self('goForward', new Period($months)); + return new self('goForward', Period\Month::of($months)); } + /** + * @param int<1, max> $months + */ public static function backward(int $months): self { - return new self('goBack', new Period($months)); + return new self('goBack', Period\Month::of($months)); } } diff --git a/src/Earth/Move/StartOfDay.php b/src/Earth/Move/StartOfDay.php index 57ba491..a96865d 100644 --- a/src/Earth/Move/StartOfDay.php +++ b/src/Earth/Move/StartOfDay.php @@ -5,10 +5,10 @@ use Innmind\TimeContinuum\{ PointInTime, - Earth\Period\Hour, - Earth\Period\Minute, - Earth\Period\Second, - Earth\Period\Millisecond, + Period\Hour, + Period\Minute, + Period\Second, + Period\Millisecond, }; final class StartOfDay @@ -23,10 +23,10 @@ public function __invoke(PointInTime $point): PointInTime } return $point->goBack( - (new Hour($point->hour()->toInt())) - ->add(new Minute($point->minute()->toInt())) - ->add(new Second($seconds)) - ->add(new Millisecond($millisecond)), + Hour::of($point->hour()->toInt()) + ->add(Minute::of($point->minute()->toInt())) + ->add(Second::of($seconds)) + ->add(Millisecond::of($millisecond)), ); } } diff --git a/src/Earth/Move/StartOfMonth.php b/src/Earth/Move/StartOfMonth.php index 9f6eb44..10f54d1 100644 --- a/src/Earth/Move/StartOfMonth.php +++ b/src/Earth/Move/StartOfMonth.php @@ -5,7 +5,7 @@ use Innmind\TimeContinuum\{ PointInTime, - Earth\Period\Day, + Period\Day, }; final class StartOfMonth @@ -13,7 +13,7 @@ final class StartOfMonth public function __invoke(PointInTime $point): PointInTime { return (new StartOfDay)($point)->goBack( - new Day($point->day()->toInt() - 1), + Day::of($point->day()->toInt() - 1), ); } } diff --git a/src/Earth/Move/StartOfYear.php b/src/Earth/Move/StartOfYear.php index 713b50a..ec213c6 100644 --- a/src/Earth/Move/StartOfYear.php +++ b/src/Earth/Move/StartOfYear.php @@ -5,7 +5,7 @@ use Innmind\TimeContinuum\{ PointInTime, - Earth\Period\Month, + Period\Month, }; final class StartOfYear @@ -13,7 +13,7 @@ final class StartOfYear public function __invoke(PointInTime $point): PointInTime { return (new StartOfMonth)($point)->goBack( - new Month($point->month()->toInt() - 1), + Month::of($point->month()->toInt() - 1), ); } } diff --git a/src/Earth/Period/Composite.php b/src/Earth/Period/Composite.php deleted file mode 100644 index cf2d926..0000000 --- a/src/Earth/Period/Composite.php +++ /dev/null @@ -1,124 +0,0 @@ -seconds()); - $minute = new Minute($minute + $second->minutes() + $millisecond->minutes()); - $hour = new Hour( - $hour + - $minute->hours() + - $second->hours() + - $millisecond->hours(), - ); - $day = new Day( - $day + - $hour->days() + - $minute->days() + - $second->days() + - $millisecond->days(), - ); - $month = new Month($month); - $year = new Year($year + $month->years()); - - $this->year = $year->years(); - $this->month = $month->months(); - $this->day = $day->days(); - $this->hour = $hour->hours(); - $this->minute = $minute->minutes(); - $this->second = $second->seconds(); - $this->millisecond = $millisecond->milliseconds(); - } - - public function years(): int - { - return $this->year; - } - - public function months(): int - { - return $this->month; - } - - public function days(): int - { - return $this->day; - } - - public function hours(): int - { - return $this->hour; - } - - public function minutes(): int - { - return $this->minute; - } - - public function seconds(): int - { - return $this->second; - } - - public function milliseconds(): int - { - return $this->millisecond; - } - - public function equals(Period $period): bool - { - return $this->year === $period->years() && - $this->month === $period->months() && - $this->day === $period->days() && - $this->hour === $period->hours() && - $this->minute === $period->minutes() && - $this->second === $period->seconds() && - $this->millisecond === $period->milliseconds(); - } - - public function add(Period $period): self - { - return new self( - $this->year + $period->years(), - $this->month + $period->months(), - $this->day + $period->days(), - $this->hour + $period->hours(), - $this->minute + $period->minutes(), - $this->second + $period->seconds(), - $this->millisecond + $period->milliseconds(), - ); - } - - public function asElapsedPeriod(): ElapsedPeriod - { - return ElapsedPeriod::ofPeriod($this); - } -} diff --git a/src/Earth/Period/Day.php b/src/Earth/Period/Day.php deleted file mode 100644 index 319301c..0000000 --- a/src/Earth/Period/Day.php +++ /dev/null @@ -1,99 +0,0 @@ -day = $day; - } - - /** - * @param 0|positive-int $day - */ - public static function of(int $day): self - { - return new self($day); - } - - public function years(): int - { - return 0; - } - - public function months(): int - { - return 0; - } - - public function days(): int - { - return $this->day; - } - - public function hours(): int - { - return 0; - } - - public function minutes(): int - { - return 0; - } - - public function seconds(): int - { - return 0; - } - - public function milliseconds(): int - { - return 0; - } - - public function equals(Period $period): bool - { - return $period->years() === 0 && - $period->months() === 0 && - $period->days() === $this->day && - $period->hours() === 0 && - $period->minutes() === 0 && - $period->seconds() === 0 && - $period->milliseconds() === 0; - } - - public function add(Period $period): Composite - { - return new Composite( - $period->years(), - $period->months(), - $this->day + $period->days(), - $period->hours(), - $period->minutes(), - $period->seconds(), - $period->milliseconds(), - ); - } - - public function asElapsedPeriod(): ElapsedPeriod - { - return ElapsedPeriod::ofPeriod($this); - } -} diff --git a/src/Earth/Period/Hour.php b/src/Earth/Period/Hour.php deleted file mode 100644 index b581401..0000000 --- a/src/Earth/Period/Hour.php +++ /dev/null @@ -1,101 +0,0 @@ -day = (int) ($hour / 24); - $this->hour = $hour % 24; - } - - /** - * @param 0|positive-int $hour - */ - public static function of(int $hour): self - { - return new self($hour); - } - - public function years(): int - { - return 0; - } - - public function months(): int - { - return 0; - } - - public function days(): int - { - return $this->day; - } - - public function hours(): int - { - return $this->hour; - } - - public function minutes(): int - { - return 0; - } - - public function seconds(): int - { - return 0; - } - - public function milliseconds(): int - { - return 0; - } - - public function equals(Period $period): bool - { - return $period->years() === 0 && - $period->months() === 0 && - $period->days() === $this->day && - $period->hours() === $this->hour && - $period->minutes() === 0 && - $period->seconds() === 0 && - $period->milliseconds() === 0; - } - - public function add(Period $period): Composite - { - return new Composite( - $period->years(), - $period->months(), - $this->day + $period->days(), - $this->hour + $period->hours(), - $period->minutes(), - $period->seconds(), - $period->milliseconds(), - ); - } - - public function asElapsedPeriod(): ElapsedPeriod - { - return ElapsedPeriod::ofPeriod($this); - } -} diff --git a/src/Earth/Period/Millisecond.php b/src/Earth/Period/Millisecond.php deleted file mode 100644 index c3da55d..0000000 --- a/src/Earth/Period/Millisecond.php +++ /dev/null @@ -1,101 +0,0 @@ -second = new Second((int) ($millisecond / 1000)); - $this->millisecond = $millisecond % 1000; - } - - /** - * @param 0|positive-int $millisecond - */ - public static function of(int $millisecond): self - { - return new self($millisecond); - } - - public function years(): int - { - return 0; - } - - public function months(): int - { - return 0; - } - - public function days(): int - { - return $this->second->days(); - } - - public function hours(): int - { - return $this->second->hours(); - } - - public function minutes(): int - { - return $this->second->minutes(); - } - - public function seconds(): int - { - return $this->second->seconds(); - } - - public function milliseconds(): int - { - return $this->millisecond; - } - - public function equals(Period $period): bool - { - return $period->years() === 0 && - $period->months() === 0 && - $period->days() === $this->days() && - $period->hours() === $this->hours() && - $period->minutes() === $this->minutes() && - $period->seconds() === $this->seconds() && - $period->milliseconds() === $this->millisecond; - } - - public function add(Period $period): Composite - { - return new Composite( - $period->years(), - $period->months(), - $this->days() + $period->days(), - $this->hours() + $period->hours(), - $this->minutes() + $period->minutes(), - $this->seconds() + $period->seconds(), - $this->millisecond + $period->milliseconds(), - ); - } - - public function asElapsedPeriod(): ElapsedPeriod - { - return ElapsedPeriod::ofPeriod($this); - } -} diff --git a/src/Earth/Period/Minute.php b/src/Earth/Period/Minute.php deleted file mode 100644 index 7754623..0000000 --- a/src/Earth/Period/Minute.php +++ /dev/null @@ -1,101 +0,0 @@ -hour = new Hour((int) ($minute / 60)); - $this->minute = $minute % 60; - } - - /** - * @param 0|positive-int $minute - */ - public static function of(int $minute): self - { - return new self($minute); - } - - public function years(): int - { - return 0; - } - - public function months(): int - { - return 0; - } - - public function days(): int - { - return $this->hour->days(); - } - - public function hours(): int - { - return $this->hour->hours(); - } - - public function minutes(): int - { - return $this->minute; - } - - public function seconds(): int - { - return 0; - } - - public function milliseconds(): int - { - return 0; - } - - public function equals(Period $period): bool - { - return $period->years() === 0 && - $period->months() === 0 && - $period->days() === $this->days() && - $period->hours() === $this->hours() && - $period->minutes() === $this->minute && - $period->seconds() === 0 && - $period->milliseconds() === 0; - } - - public function add(Period $period): Composite - { - return new Composite( - $period->years(), - $period->months(), - $this->days() + $period->days(), - $this->hours() + $period->hours(), - $this->minute + $period->minutes(), - $period->seconds(), - $period->milliseconds(), - ); - } - - public function asElapsedPeriod(): ElapsedPeriod - { - return ElapsedPeriod::ofPeriod($this); - } -} diff --git a/src/Earth/Period/Month.php b/src/Earth/Period/Month.php deleted file mode 100644 index 1fa6721..0000000 --- a/src/Earth/Period/Month.php +++ /dev/null @@ -1,95 +0,0 @@ -year = (int) ($month / 12); - $this->month = $month % 12; - } - - /** - * @param 0|positive-int $month - */ - public static function of(int $month): self - { - return new self($month); - } - - public function years(): int - { - return $this->year; - } - - public function months(): int - { - return $this->month; - } - - public function days(): int - { - return 0; - } - - public function hours(): int - { - return 0; - } - - public function minutes(): int - { - return 0; - } - - public function seconds(): int - { - return 0; - } - - public function milliseconds(): int - { - return 0; - } - - public function equals(Period $period): bool - { - return $period->years() === $this->year && - $period->months() === $this->month && - $period->days() === 0 && - $period->hours() === 0 && - $period->minutes() === 0 && - $period->seconds() === 0 && - $period->milliseconds() === 0; - } - - public function add(Period $period): Period - { - return new Composite( - $this->year + $period->years(), - $this->month + $period->months(), - $period->days(), - $period->hours(), - $period->minutes(), - $period->seconds(), - $period->milliseconds(), - ); - } -} diff --git a/src/Earth/Period/Second.php b/src/Earth/Period/Second.php deleted file mode 100644 index caf73d2..0000000 --- a/src/Earth/Period/Second.php +++ /dev/null @@ -1,101 +0,0 @@ -minute = new Minute((int) ($second / 60)); - $this->second = $second % 60; - } - - /** - * @param 0|positive-int $second - */ - public static function of(int $second): self - { - return new self($second); - } - - public function years(): int - { - return 0; - } - - public function months(): int - { - return 0; - } - - public function days(): int - { - return $this->minute->days(); - } - - public function hours(): int - { - return $this->minute->hours(); - } - - public function minutes(): int - { - return $this->minute->minutes(); - } - - public function seconds(): int - { - return $this->second; - } - - public function milliseconds(): int - { - return 0; - } - - public function equals(Period $period): bool - { - return $period->years() === 0 && - $period->months() === 0 && - $period->days() === $this->days() && - $period->hours() === $this->hours() && - $period->minutes() === $this->minutes() && - $period->seconds() === $this->second && - $period->milliseconds() === 0; - } - - public function add(Period $period): Period - { - return new Composite( - $period->years(), - $period->months(), - $this->days() + $period->days(), - $this->hours() + $period->hours(), - $this->minutes() + $period->minutes(), - $this->second + $period->seconds(), - $period->milliseconds(), - ); - } - - public function asElapsedPeriod(): ElapsedPeriod - { - return ElapsedPeriod::ofPeriod($this); - } -} diff --git a/src/Earth/Period/Year.php b/src/Earth/Period/Year.php deleted file mode 100644 index 094f931..0000000 --- a/src/Earth/Period/Year.php +++ /dev/null @@ -1,93 +0,0 @@ -year = $year; - } - - /** - * @param 0|positive-int $year - */ - public static function of(int $year): self - { - return new self($year); - } - - public function years(): int - { - return $this->year; - } - - public function months(): int - { - return 0; - } - - public function days(): int - { - return 0; - } - - public function hours(): int - { - return 0; - } - - public function minutes(): int - { - return 0; - } - - public function seconds(): int - { - return 0; - } - - public function milliseconds(): int - { - return 0; - } - - public function equals(Period $period): bool - { - return $period->years() === $this->year && - $period->months() === 0 && - $period->days() === 0 && - $period->hours() === 0 && - $period->minutes() === 0 && - $period->seconds() === 0 && - $period->milliseconds() === 0; - } - - public function add(Period $period): Period - { - return new Composite( - $this->year + $period->years(), - $period->months(), - $period->days(), - $period->hours(), - $period->minutes(), - $period->seconds(), - $period->milliseconds(), - ); - } -} diff --git a/src/Earth/PointInTime/PointInTime.php b/src/Earth/PointInTime/PointInTime.php index c85b54c..555b230 100644 --- a/src/Earth/PointInTime/PointInTime.php +++ b/src/Earth/PointInTime/PointInTime.php @@ -18,7 +18,6 @@ PointInTime\Second, PointInTime\Millisecond, Earth\Timezone\UTC, - Earth\Period\Millisecond as MillisecondPeriod, }; /** @@ -132,7 +131,7 @@ public function goBack(Period $period): PointInTimeInterface { if ($this->millisecond()->toInt() > 0) { $period = $period->add( - new MillisecondPeriod(1000 - $this->millisecond()->toInt()), + Period\Millisecond::of(1000 - $this->millisecond()->toInt()), ); } $date = $this->date; @@ -168,7 +167,7 @@ public function goBack(Period $period): PointInTimeInterface public function goForward(Period $period): PointInTimeInterface { $period = $period->add( - new MillisecondPeriod($this->millisecond()->toInt()), + Period\Millisecond::of($this->millisecond()->toInt()), ); $date = $this->date; diff --git a/src/Period.php b/src/Period.php index 817413e..d5f941c 100644 --- a/src/Period.php +++ b/src/Period.php @@ -3,18 +3,183 @@ namespace Innmind\TimeContinuum; +use Innmind\TimeContinuum\Period\{ + Year, + Month, + Day, + Hour, + Minute, + Second, + Millisecond, +}; + /** * @psalm-immutable */ -interface Period +final class Period { - public function years(): int; - public function months(): int; - public function days(): int; - public function hours(): int; - public function minutes(): int; - public function seconds(): int; - public function milliseconds(): int; - public function equals(self $period): bool; - public function add(self $period): self; + /** + * @param int<0, max> $year + * @param int<0, max> $month + * @param int<0, max> $day + * @param int<0, max> $hour + * @param int<0, max> $minute + * @param int<0, max> $second + * @param int<0, max> $millisecond + */ + private function __construct( + private int $year, + private int $month, + private int $day, + private int $hour, + private int $minute, + private int $second, + private int $millisecond, + ) { + } + + /** + * @psalm-pure + * + * @param int<0, max> $year + * @param int<0, max> $month + * @param int<0, max> $day + * @param int<0, max> $hour + * @param int<0, max> $minute + * @param int<0, max> $second + * @param int<0, max> $millisecond + */ + public static function of( + int $year, + int $month, + int $day, + int $hour, + int $minute, + int $second, + int $millisecond, + ): self { + return new self( + $year, + $month, + $day, + $hour, + $minute, + $second, + $millisecond, + ); + } + + /** + * @return int<0, max> + */ + public function years(): int + { + return $this->year; + } + + /** + * @return int<0, max> + */ + public function months(): int + { + return $this->month; + } + + /** + * @return int<0, max> + */ + public function days(): int + { + return $this->day; + } + + /** + * @return int<0, max> + */ + public function hours(): int + { + return $this->hour; + } + + /** + * @return int<0, max> + */ + public function minutes(): int + { + return $this->minute; + } + + /** + * @return int<0, max> + */ + public function seconds(): int + { + return $this->second; + } + + /** + * @return int<0, max> + */ + public function milliseconds(): int + { + return $this->millisecond; + } + + public function equals(self $period): bool + { + return $this->year === $period->years() && + $this->month === $period->months() && + $this->day === $period->days() && + $this->hour === $period->hours() && + $this->minute === $period->minutes() && + $this->second === $period->seconds() && + $this->millisecond === $period->milliseconds(); + } + + public function add(self $period): self + { + $millisecond = Millisecond::of($this->millisecond + $period->milliseconds()); + $second = Second::of($this->second + $period->seconds()); + $minute = Minute::of($this->minute + $period->minutes()); + $hour = Hour::of($this->hour + $period->hours()); + $day = Day::of($this->day + $period->days()); + $month = Month::of($this->month + $period->months()); + $year = Year::of($this->year + $period->years()); + + return new self( + $year->years() + + $month->years() + + $day->years() + + $hour->years() + + $minute->years() + + $second->years() + + $millisecond->years(), + $month->months() + + $day->months() + + $hour->months() + + $minute->months() + + $second->months() + + $millisecond->months(), + $day->days() + + $hour->days() + + $minute->days() + + $second->days() + + $millisecond->days(), + $hour->hours() + + $minute->hours() + + $second->hours() + + $millisecond->hours(), + $minute->minutes() + + $second->minutes() + + $millisecond->minutes(), + $second->seconds() + + $millisecond->seconds(), + $millisecond->milliseconds(), + ); + } + + public function asElapsedPeriod(): ElapsedPeriod + { + return Earth\ElapsedPeriod::ofPeriod($this); + } } diff --git a/src/Period/Day.php b/src/Period/Day.php new file mode 100644 index 0000000..d3e26a3 --- /dev/null +++ b/src/Period/Day.php @@ -0,0 +1,31 @@ + */ + $day = (int) ($hour / 24); + $hour = $hour % 24; + + return Period::of( + 0, + 0, + $day, + $hour, + 0, + 0, + 0, + ); + } +} diff --git a/src/Period/Millisecond.php b/src/Period/Millisecond.php new file mode 100644 index 0000000..6ce7a97 --- /dev/null +++ b/src/Period/Millisecond.php @@ -0,0 +1,36 @@ + */ + $second = (int) ($millisecond / 1000); + $second = Second::of($second); + $millisecond = $millisecond % 1000; + + return Period::of( + $second->years(), + $second->months(), + $second->days(), + $second->hours(), + $second->minutes(), + $second->seconds(), + $millisecond, + ); + } +} diff --git a/src/Period/Minute.php b/src/Period/Minute.php new file mode 100644 index 0000000..576e3f1 --- /dev/null +++ b/src/Period/Minute.php @@ -0,0 +1,36 @@ + */ + $hour = (int) ($minute / 60); + $hour = Hour::of($hour); + $minute = $minute % 60; + + return Period::of( + $hour->years(), + $hour->months(), + $hour->days(), + $hour->hours(), + $minute, + 0, + 0, + ); + } +} diff --git a/src/Period/Month.php b/src/Period/Month.php new file mode 100644 index 0000000..689c796 --- /dev/null +++ b/src/Period/Month.php @@ -0,0 +1,35 @@ + */ + $year = (int) ($month / 12); + $month = $month % 12; + + return Period::of( + $year, + $month, + 0, + 0, + 0, + 0, + 0, + ); + } +} diff --git a/src/Period/Second.php b/src/Period/Second.php new file mode 100644 index 0000000..7c241f4 --- /dev/null +++ b/src/Period/Second.php @@ -0,0 +1,36 @@ + */ + $minute = (int) ($second / 60); + $minute = Minute::of($minute); + $second = $second % 60; + + return Period::of( + $minute->years(), + $minute->months(), + $minute->days(), + $minute->hours(), + $minute->minutes(), + $second, + 0, + ); + } +} diff --git a/src/Period/Year.php b/src/Period/Year.php new file mode 100644 index 0000000..ef68424 --- /dev/null +++ b/src/Period/Year.php @@ -0,0 +1,31 @@ +expectException(LogicException::class); - ElapsedPeriod::ofPeriod(new Year(1)); + ElapsedPeriod::ofPeriod(Year::of(1)); } public function testThrowWhenTryingToBuildFromMonthPeriod() { $this->expectException(LogicException::class); - ElapsedPeriod::ofPeriod(new Month(1)); + ElapsedPeriod::ofPeriod(Month::of(1)); } } diff --git a/tests/Earth/PointInTime/NowTest.php b/tests/Earth/PointInTime/NowTest.php index a070df7..2c14703 100644 --- a/tests/Earth/PointInTime/NowTest.php +++ b/tests/Earth/PointInTime/NowTest.php @@ -17,8 +17,8 @@ PointInTime\Second, PointInTime\Millisecond, Earth\Timezone\UTC, - Earth\Period\Year, - Earth\Period\Millisecond as MillisecondPeriod, + Period, + Period\Year, }; use PHPUnit\Framework\TestCase; @@ -131,7 +131,7 @@ public function testEquals() public function testGoForward() { $point = new Now; - $point2 = $point->goForward(new Year(1)); + $point2 = $point->goForward(Year::of(1)); $this->assertInstanceOf(PointInTime::class, $point2); $this->assertNotSame($point, $point2); @@ -141,13 +141,13 @@ public function testGoForward() public function testGoBack() { $point = new Now; - $point2 = $point->goBack(new Year(1)); + $point2 = $point->goBack(Year::of(1)); $this->assertInstanceOf(PointInTime::class, $point2); $this->assertNotSame($point, $point2); $this->assertSame($point->year()->toInt() - 1, $point2->year()->toInt()); - $point3 = $point->goBack(new MillisecondPeriod(500)); + $point3 = $point->goBack(Period\Millisecond::of(500)); if ($point->millisecond()->toInt() > 500) { $this->assertSame( diff --git a/tests/Earth/PointInTime/PointInTimeTest.php b/tests/Earth/PointInTime/PointInTimeTest.php index 7df5604..2de1549 100644 --- a/tests/Earth/PointInTime/PointInTimeTest.php +++ b/tests/Earth/PointInTime/PointInTimeTest.php @@ -17,9 +17,8 @@ PointInTime\Second, PointInTime\Millisecond, Earth\Timezone\UTC, - Earth\Period\Composite, - Earth\Period\Day, - Earth\Period\Millisecond as MillisecondPeriod, + Period, + Period\Day, }; use PHPUnit\Framework\TestCase; @@ -129,7 +128,7 @@ public function testGoForward() { $point = new PointInTime('2016-10-05T08:01:30.123+02:00'); $point2 = $point->goForward( - new Composite(1, 1, 1, 1, 1, 30, 878), + Period::of(1, 1, 1, 1, 1, 30, 878), ); $this->assertInstanceOf(PointInTimeInterface::class, $point2); @@ -153,7 +152,7 @@ public function testGoBack() { $point = new PointInTime('2016-10-05T08:01:30.123+02:00'); $point2 = $point->goBack( - new Composite(1, 1, 1, 1, 1, 30, 125), + Period::of(1, 1, 1, 1, 1, 30, 125), ); $this->assertInstanceOf(PointInTimeInterface::class, $point2); @@ -175,7 +174,7 @@ public function testGoBack() $this->assertSame( '2016-10-05T08:01:29.500000+02:00', $point - ->goBack(new MillisecondPeriod(623)) + ->goBack(Period\Millisecond::of(623)) ->format(Format::of('Y-m-d\TH:i:s.uP')), ); } @@ -183,7 +182,7 @@ public function testGoBack() public function testGoBackOneDay() { $point = new PointInTime('2018-03-04'); - $point2 = $point->goBack(new Day(1)); + $point2 = $point->goBack(Day::of(1)); $format = Format::of('Y-m-d\TH:i:s.u'); $this->assertSame( @@ -199,7 +198,7 @@ public function testGoBackOneDay() public function testGoBackOneMillisecondWhenCurrentPointIsAtPreciselyZeroMillisecond() { $point = new PointInTime('1402-07-21 02:42:53.000000'); - $point2 = $point->goBack(new MillisecondPeriod(1)); + $point2 = $point->goBack(Period\Millisecond::of(1)); $format = Format::of('Y-m-d\TH:i:s.u'); $this->assertSame( diff --git a/tests/Fixtures/Earth/PeriodTest.php b/tests/Fixtures/Earth/PeriodTest.php index 2519141..2c19a46 100644 --- a/tests/Fixtures/Earth/PeriodTest.php +++ b/tests/Fixtures/Earth/PeriodTest.php @@ -8,10 +8,7 @@ Set, Random, }; -use Innmind\TimeContinuum\{ - Period as PeriodInterface, - Earth\Period\Year, -}; +use Innmind\TimeContinuum\Period as Model; use PHPUnit\Framework\TestCase; class PeriodTest extends TestCase @@ -25,7 +22,7 @@ public function testAny() foreach ($periods->values(Random::default) as $period) { $this->assertInstanceOf(Set\Value::class, $period); - $this->assertInstanceOf(PeriodInterface::class, $period->unwrap()); + $this->assertInstanceOf(Model::class, $period->unwrap()); $this->assertTrue($period->isImmutable()); } } @@ -44,7 +41,7 @@ public function testAnyNumberOfYear() $this->assertInstanceOf(Set\Value::class, $period); $this->assertTrue($period->isImmutable()); $value = $period->unwrap(); - $this->assertInstanceOf(Year::class, $value); + $this->assertInstanceOf(Model::class, $value); $this->assertSame(0, $value->months()); $this->assertSame(0, $value->days()); $this->assertSame(0, $value->hours()); @@ -72,7 +69,7 @@ public function testLessThanAYear() $this->assertInstanceOf(Set\Value::class, $period); $this->assertTrue($period->isImmutable()); $value = $period->unwrap(); - $this->assertInstanceOf(PeriodInterface::class, $value); + $this->assertInstanceOf(Model::class, $value); $this->assertLessThan(365, $value->days()); $this->assertSame(0, $value->years()); $this->assertSame(0, $value->months()); diff --git a/tests/Earth/Period/CompositeTest.php b/tests/Period.php similarity index 59% rename from tests/Earth/Period/CompositeTest.php rename to tests/Period.php index 9938dbb..816c656 100644 --- a/tests/Earth/Period/CompositeTest.php +++ b/tests/Period.php @@ -1,22 +1,17 @@ assertInstanceOf(Period::class, $period); $this->assertSame(1, $period->years()); $this->assertSame(2, $period->months()); $this->assertSame(3, $period->days()); @@ -28,7 +23,7 @@ public function testInterface() public function testAdjustEachComponent() { - $period = new Composite( + $period = Period::of( 1, 13, 1, @@ -47,29 +42,11 @@ public function testAdjustEachComponent() $this->assertSame(1, $period->milliseconds()); } - /** - * @dataProvider wrongData - */ - public function testThrowWhenAComponentIsNegative( - int $year, - int $month, - int $day, - int $hour, - int $minute, - int $second, - int $millisecond, - ) { - $this->expectException(PeriodCantBeNegative::class); - $this->expectExceptionMessage('-1'); - - new Composite($year, $month, $day, $hour, $minute, $second, $millisecond); - } - public function testEquals() { - $period = new Composite(1, 2, 3, 4, 5, 6, 7); - $period2 = new Composite(1, 2, 3, 4, 5, 6, 8); - $period3 = new Composite(1, 2, 3, 4, 5, 6, 7); + $period = Period::of(1, 2, 3, 4, 5, 6, 7); + $period2 = Period::of(1, 2, 3, 4, 5, 6, 8); + $period3 = Period::of(1, 2, 3, 4, 5, 6, 7); $this->assertTrue($period->equals($period3)); $this->assertFalse($period->equals($period2)); @@ -77,10 +54,9 @@ public function testEquals() public function testAdd() { - $period = new Composite(1, 2, 3, 4, 5, 6, 7); + $period = Period::of(1, 2, 3, 4, 5, 6, 7); $period2 = $period->add($period); - $this->assertInstanceOf(Period::class, $period); $this->assertNotSame($period, $period2); $this->assertSame(1, $period->years()); $this->assertSame(2, $period->months()); @@ -102,20 +78,7 @@ public function testAsElapsedPeriod() { $this->assertSame( 90_061_001, - (new Composite(0, 0, 1, 1, 1, 1, 1))->asElapsedPeriod()->milliseconds(), + Period::of(0, 0, 1, 1, 1, 1, 1)->asElapsedPeriod()->milliseconds(), ); } - - public static function wrongData() - { - return [ - [-1, 0, 0, 0, 0, 0, 0], - [0, -1, 0, 0, 0, 0, 0], - [0, 0, -1, 0, 0, 0, 0], - [0, 0, 0, -1, 0, 0, 0], - [0, 0, 0, 0, -1, 0, 0], - [0, 0, 0, 0, 0, -1, 0], - [0, 0, 0, 0, 0, 0, -1], - ]; - } } diff --git a/tests/Earth/Period/DayTest.php b/tests/Period/DayTest.php similarity index 74% rename from tests/Earth/Period/DayTest.php rename to tests/Period/DayTest.php index eaa651a..b064c28 100644 --- a/tests/Earth/Period/DayTest.php +++ b/tests/Period/DayTest.php @@ -1,12 +1,11 @@ assertSame(0, $period->milliseconds()); } - public function testThrowWhenDayIsNegative() - { - $this->expectException(PeriodCantBeNegative::class); - $this->expectExceptionMessage('-1'); - - new Day(-1); - } - public function testEquals() { - $this->assertTrue((new Day(2))->equals(new Day(2))); - $this->assertFalse((new Day(2))->equals(new Day(3))); + $this->assertTrue(Day::of(2)->equals(Day::of(2))); + $this->assertFalse(Day::of(2)->equals(Day::of(3))); } public function testAdd() { - $period = new Day(1000); + $period = Day::of(1000); $period2 = $period->add($period); $this->assertInstanceOf(Period::class, $period); @@ -67,15 +58,15 @@ public function testAsElapsedPeriod() { $this->assertSame( 86_400_000, - (new Day(1))->asElapsedPeriod()->milliseconds(), + Day::of(1)->asElapsedPeriod()->milliseconds(), ); $this->assertSame( 172_800_000, - (new Day(2))->asElapsedPeriod()->milliseconds(), + Day::of(2)->asElapsedPeriod()->milliseconds(), ); $this->assertSame( 259_200_000, - (new Day(3))->asElapsedPeriod()->milliseconds(), + Day::of(3)->asElapsedPeriod()->milliseconds(), ); } } diff --git a/tests/Earth/Period/HourTest.php b/tests/Period/HourTest.php similarity index 78% rename from tests/Earth/Period/HourTest.php rename to tests/Period/HourTest.php index 70d0d01..7ab0422 100644 --- a/tests/Earth/Period/HourTest.php +++ b/tests/Period/HourTest.php @@ -1,12 +1,11 @@ assertSame(0, $period->years()); $this->assertSame(0, $period->months()); @@ -42,23 +41,15 @@ public function testConvertToDays(int $hour, int $days, int $expectedHours) $this->assertSame(0, $period->milliseconds()); } - public function testThrowWhenHourIsNegative() - { - $this->expectException(PeriodCantBeNegative::class); - $this->expectExceptionMessage('-1'); - - new Hour(-1); - } - public function testEquals() { - $this->assertTrue((new Hour(25))->equals(new Hour(25))); - $this->assertFalse((new Hour(2))->equals(new Hour(3))); + $this->assertTrue(Hour::of(25)->equals(Hour::of(25))); + $this->assertFalse(Hour::of(2)->equals(Hour::of(3))); } public function testAdd() { - $period = new Hour(20); + $period = Hour::of(20); $period2 = $period->add($period); $this->assertInstanceOf(Period::class, $period2); @@ -82,15 +73,15 @@ public function testAsElapsedPeriod() { $this->assertSame( 3_600_000, - (new Hour(1))->asElapsedPeriod()->milliseconds(), + Hour::of(1)->asElapsedPeriod()->milliseconds(), ); $this->assertSame( 7_200_000, - (new Hour(2))->asElapsedPeriod()->milliseconds(), + Hour::of(2)->asElapsedPeriod()->milliseconds(), ); $this->assertSame( 10_800_000, - (new Hour(3))->asElapsedPeriod()->milliseconds(), + Hour::of(3)->asElapsedPeriod()->milliseconds(), ); } diff --git a/tests/Earth/Period/MillisecondTest.php b/tests/Period/MillisecondTest.php similarity index 81% rename from tests/Earth/Period/MillisecondTest.php rename to tests/Period/MillisecondTest.php index fd7915a..031a454 100644 --- a/tests/Earth/Period/MillisecondTest.php +++ b/tests/Period/MillisecondTest.php @@ -1,12 +1,11 @@ assertSame(0, $period->years()); $this->assertSame(0, $period->months()); @@ -48,23 +47,15 @@ public function testConvertToSeconds( $this->assertSame($expectedMilliseconds, $period->milliseconds()); } - public function testThrowWhenMillisecondIsNegative() - { - $this->expectException(PeriodCantBeNegative::class); - $this->expectExceptionMessage('-1'); - - new Millisecond(-1); - } - public function testEquals() { - $this->assertTrue((new Millisecond(66))->equals(new Millisecond(66))); - $this->assertFalse((new Millisecond(2))->equals(new Millisecond(3))); + $this->assertTrue(Millisecond::of(66)->equals(Millisecond::of(66))); + $this->assertFalse(Millisecond::of(2)->equals(Millisecond::of(3))); } public function testAdd() { - $period = new Millisecond(20); + $period = Millisecond::of(20); $period2 = $period->add($period); $this->assertInstanceOf(Period::class, $period2); @@ -88,15 +79,15 @@ public function testAsElapsedPeriod() { $this->assertSame( 1, - (new Millisecond(1))->asElapsedPeriod()->milliseconds(), + Millisecond::of(1)->asElapsedPeriod()->milliseconds(), ); $this->assertSame( 2, - (new Millisecond(2))->asElapsedPeriod()->milliseconds(), + Millisecond::of(2)->asElapsedPeriod()->milliseconds(), ); $this->assertSame( 3, - (new Millisecond(3))->asElapsedPeriod()->milliseconds(), + Millisecond::of(3)->asElapsedPeriod()->milliseconds(), ); } diff --git a/tests/Earth/Period/MinuteTest.php b/tests/Period/MinuteTest.php similarity index 79% rename from tests/Earth/Period/MinuteTest.php rename to tests/Period/MinuteTest.php index b31706b..4ba2437 100644 --- a/tests/Earth/Period/MinuteTest.php +++ b/tests/Period/MinuteTest.php @@ -1,12 +1,11 @@ assertSame(0, $period->years()); $this->assertSame(0, $period->months()); @@ -46,23 +45,15 @@ public function testConvertToHours( $this->assertSame(0, $period->milliseconds()); } - public function testThrowWhenMinuteIsNegative() - { - $this->expectException(PeriodCantBeNegative::class); - $this->expectExceptionMessage('-1'); - - new Minute(-1); - } - public function testEquals() { - $this->assertTrue((new Minute(66))->equals(new Minute(66))); - $this->assertFalse((new Minute(2))->equals(new Minute(3))); + $this->assertTrue(Minute::of(66)->equals(Minute::of(66))); + $this->assertFalse(Minute::of(2)->equals(Minute::of(3))); } public function testAdd() { - $period = new Minute(20); + $period = Minute::of(20); $period2 = $period->add($period); $this->assertInstanceOf(Period::class, $period2); @@ -86,15 +77,15 @@ public function testAsElapsedPeriod() { $this->assertSame( 60_000, - (new Minute(1))->asElapsedPeriod()->milliseconds(), + Minute::of(1)->asElapsedPeriod()->milliseconds(), ); $this->assertSame( 120_000, - (new Minute(2))->asElapsedPeriod()->milliseconds(), + Minute::of(2)->asElapsedPeriod()->milliseconds(), ); $this->assertSame( 180_000, - (new Minute(3))->asElapsedPeriod()->milliseconds(), + Minute::of(3)->asElapsedPeriod()->milliseconds(), ); } diff --git a/tests/Earth/Period/MonthTest.php b/tests/Period/MonthTest.php similarity index 81% rename from tests/Earth/Period/MonthTest.php rename to tests/Period/MonthTest.php index 3c1198d..10c781d 100644 --- a/tests/Earth/Period/MonthTest.php +++ b/tests/Period/MonthTest.php @@ -1,12 +1,11 @@ assertSame($year, $period->years()); $this->assertSame($expectedMonths, $period->months()); @@ -42,23 +41,15 @@ public function testConvertMonthsIntoYears(int $months, int $year, int $expected $this->assertSame(0, $period->milliseconds()); } - public function testThrowWhenMonthIsNegative() - { - $this->expectException(PeriodCantBeNegative::class); - $this->expectExceptionMessage('-1'); - - new Month(-1); - } - public function testEquals() { - $this->assertTrue((new Month(20))->equals(new Month(20))); - $this->assertFalse((new Month(2))->equals(new Month(3))); + $this->assertTrue(Month::of(20)->equals(Month::of(20))); + $this->assertFalse(Month::of(2)->equals(Month::of(3))); } public function testAdd() { - $period = new Month(10); + $period = Month::of(10); $period2 = $period->add($period); $this->assertInstanceOf(Period::class, $period2); diff --git a/tests/Earth/Period/SecondTest.php b/tests/Period/SecondTest.php similarity index 80% rename from tests/Earth/Period/SecondTest.php rename to tests/Period/SecondTest.php index 3d81f5f..8de8ecf 100644 --- a/tests/Earth/Period/SecondTest.php +++ b/tests/Period/SecondTest.php @@ -1,12 +1,11 @@ assertSame(0, $period->years()); $this->assertSame(0, $period->months()); @@ -47,23 +46,15 @@ public function testConvertToMinutes( $this->assertSame(0, $period->milliseconds()); } - public function testThrowWhenSecondIsNegative() - { - $this->expectException(PeriodCantBeNegative::class); - $this->expectExceptionMessage('-1'); - - new Second(-1); - } - public function testEquals() { - $this->assertTrue((new Second(66))->equals(new Second(66))); - $this->assertFalse((new Second(2))->equals(new Second(3))); + $this->assertTrue(Second::of(66)->equals(Second::of(66))); + $this->assertFalse(Second::of(2)->equals(Second::of(3))); } public function testAdd() { - $period = new Second(20); + $period = Second::of(20); $period2 = $period->add($period); $this->assertInstanceOf(Period::class, $period2); @@ -87,15 +78,15 @@ public function testAsElapsedPeriod() { $this->assertSame( 1000, - (new Second(1))->asElapsedPeriod()->milliseconds(), + Second::of(1)->asElapsedPeriod()->milliseconds(), ); $this->assertSame( 2000, - (new Second(2))->asElapsedPeriod()->milliseconds(), + Second::of(2)->asElapsedPeriod()->milliseconds(), ); $this->assertSame( 3000, - (new Second(3))->asElapsedPeriod()->milliseconds(), + Second::of(3)->asElapsedPeriod()->milliseconds(), ); } diff --git a/tests/Earth/Period/YearTest.php b/tests/Period/YearTest.php similarity index 76% rename from tests/Earth/Period/YearTest.php rename to tests/Period/YearTest.php index b16aa6f..9920e42 100644 --- a/tests/Earth/Period/YearTest.php +++ b/tests/Period/YearTest.php @@ -1,12 +1,11 @@ assertSame(0, $period->milliseconds()); } - public function testThrowWhenYearIsNegative() - { - $this->expectException(PeriodCantBeNegative::class); - $this->expectExceptionMessage('-1'); - - new Year(-1); - } - public function testEquals() { - $this->assertTrue((new Year(2))->equals(new Year(2))); - $this->assertFalse((new Year(2))->equals(new Year(3))); + $this->assertTrue(Year::of(2)->equals(Year::of(2))); + $this->assertFalse(Year::of(2)->equals(Year::of(3))); } public function testAdd() { - $period = new Year(42); + $period = Year::of(42); $period2 = $period->add($period); $this->assertInstanceOf(Period::class, $period2); From 1ca0240905b9a46836e164a07a8caea96ff35387 Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Sun, 17 Nov 2024 19:00:57 +0100 Subject: [PATCH 10/85] make ElapsedPeriod final --- CHANGELOG.md | 3 + src/Earth/ElapsedPeriod.php | 90 --------------------- src/Earth/PointInTime/HighResolution.php | 2 +- src/Earth/PointInTime/Now.php | 7 +- src/Earth/PointInTime/PointInTime.php | 7 +- src/ElapsedPeriod.php | 89 +++++++++++++++++++- src/Period.php | 2 +- src/{Earth/Period.php => Period/Value.php} | 4 +- tests/Earth/PointInTime/NowTest.php | 2 +- tests/Earth/PointInTime/PointInTimeTest.php | 2 +- tests/{Earth => }/ElapsedPeriodTest.php | 42 ++++------ 11 files changed, 115 insertions(+), 135 deletions(-) delete mode 100644 src/Earth/ElapsedPeriod.php rename src/{Earth/Period.php => Period/Value.php} (92%) rename tests/{Earth => }/ElapsedPeriodTest.php (58%) diff --git a/CHANGELOG.md b/CHANGELOG.md index dd51b63..bfc8db1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ - Interfaces in the `Innmind\TimeContinuum\Clock` namespace are now `final class`es - Classes in the `Innmind\TimeContinuum\Clock` namespace have been moved to `Innmind\TimeContinuum\PointInTime` - `Innmind\TimeContinuum\Period` is now a `final class` +- `Innmind\TimeContinuum\ElapsedPeriod` is now a `final class` +- `Innmind\TimeContinuum\Earth\Period` has been renamed to `Innmind\TimeContinuum\Period\Value` ### Removed @@ -15,6 +17,7 @@ - Classes in the `Innmind\TimeContinuum\Earth\Format` namespaces are now named constructors of `Innmind\TimeContinuum\Format` - Classes in the `Innmind\TimeContinuum\Earth\Clock` namespace - Classes in the `Innmind\TimeContinuum\Earth\Period` namespace +- `Innmind\TimeContinuum\Earth\ElapsedPeriod` ## 3.4.1 - 2023-09-17 diff --git a/src/Earth/ElapsedPeriod.php b/src/Earth/ElapsedPeriod.php deleted file mode 100644 index 6b8b183..0000000 --- a/src/Earth/ElapsedPeriod.php +++ /dev/null @@ -1,90 +0,0 @@ -milliseconds = $milliseconds; - } - - /** - * @psalm-pure - * - * @throws ElapsedPeriodCantBeNegative - */ - public static function of(int $milliseconds): self - { - return new self($milliseconds); - } - - /** - * @psalm-pure - * - * @return Maybe - */ - public static function maybe(int $milliseconds): Maybe - { - try { - return Maybe::just(new self($milliseconds)); - } catch (ElapsedPeriodCantBeNegative $e) { - /** @var Maybe */ - return Maybe::nothing(); - } - } - - /** - * @psalm-pure - * - * @throws LogicException When using a period containing months or years - */ - public static function ofPeriod(PeriodInterface $period): self - { - if ($period->months() !== 0 || $period->years() !== 0) { - // a month or a year is not constant - throw new LogicException('Months and years can not be converted to milliseconds'); - } - - $milliseconds = Period::day->milliseconds($period->days()) + - Period::hour->milliseconds($period->hours()) + - Period::minute->milliseconds($period->minutes()) + - Period::second->milliseconds($period->seconds()) + - $period->milliseconds(); - - return new self($milliseconds); - } - - public function milliseconds(): int - { - return $this->milliseconds; - } - - public function longerThan(ElapsedPeriodInterface $period): bool - { - return $this->milliseconds > $period->milliseconds(); - } - - public function equals(ElapsedPeriodInterface $period): bool - { - return $this->milliseconds === $period->milliseconds(); - } -} diff --git a/src/Earth/PointInTime/HighResolution.php b/src/Earth/PointInTime/HighResolution.php index d528acf..9469e2a 100644 --- a/src/Earth/PointInTime/HighResolution.php +++ b/src/Earth/PointInTime/HighResolution.php @@ -3,7 +3,7 @@ namespace Innmind\TimeContinuum\Earth\PointInTime; -use Innmind\TimeContinuum\Earth\ElapsedPeriod; +use Innmind\TimeContinuum\ElapsedPeriod; /** * @psalm-immutable diff --git a/src/Earth/PointInTime/Now.php b/src/Earth/PointInTime/Now.php index 4edb364..281b41b 100644 --- a/src/Earth/PointInTime/Now.php +++ b/src/Earth/PointInTime/Now.php @@ -7,8 +7,7 @@ PointInTime as PointInTimeInterface, Format, Timezone, - Earth\ElapsedPeriod, - ElapsedPeriod as ElapsedPeriodInterface, + ElapsedPeriod, Period, PointInTime\Year, PointInTime\Month, @@ -94,13 +93,13 @@ public function timezone(): Timezone return $this->point->timezone(); } - public function elapsedSince(PointInTimeInterface $point): ElapsedPeriodInterface + public function elapsedSince(PointInTimeInterface $point): ElapsedPeriod { if ($point instanceof self) { return $this->highResolution->elapsedSince($point->highResolution); } - return new ElapsedPeriod($this->milliseconds() - $point->milliseconds()); + return ElapsedPeriod::of($this->milliseconds() - $point->milliseconds()); } public function goBack(Period $period): PointInTimeInterface diff --git a/src/Earth/PointInTime/PointInTime.php b/src/Earth/PointInTime/PointInTime.php index 555b230..afcce07 100644 --- a/src/Earth/PointInTime/PointInTime.php +++ b/src/Earth/PointInTime/PointInTime.php @@ -7,8 +7,7 @@ PointInTime as PointInTimeInterface, Format, Timezone, - Earth\ElapsedPeriod, - ElapsedPeriod as ElapsedPeriodInterface, + ElapsedPeriod, Period, PointInTime\Year, PointInTime\Month, @@ -122,9 +121,9 @@ public function timezone(): Timezone return UTC::of($this->date->format('P')); } - public function elapsedSince(PointInTimeInterface $point): ElapsedPeriodInterface + public function elapsedSince(PointInTimeInterface $point): ElapsedPeriod { - return new ElapsedPeriod($this->milliseconds() - $point->milliseconds()); + return ElapsedPeriod::of($this->milliseconds() - $point->milliseconds()); } public function goBack(Period $period): PointInTimeInterface diff --git a/src/ElapsedPeriod.php b/src/ElapsedPeriod.php index ea20bd6..5e2e512 100644 --- a/src/ElapsedPeriod.php +++ b/src/ElapsedPeriod.php @@ -3,12 +3,93 @@ namespace Innmind\TimeContinuum; +use Innmind\Immutable\Maybe; + /** * @psalm-immutable */ -interface ElapsedPeriod +final class ElapsedPeriod { - public function milliseconds(): int; - public function longerThan(self $period): bool; - public function equals(self $period): bool; + /** @var int<0, max> */ + private int $milliseconds; + + private function __construct(int $milliseconds) + { + if ($milliseconds < 0) { + throw new \RuntimeException((string) $milliseconds); + } + + $this->milliseconds = $milliseconds; + } + + /** + * @psalm-pure + * + * @throws \RuntimeException + */ + public static function of(int $milliseconds): self + { + return new self($milliseconds); + } + + /** + * @psalm-pure + * + * @param int<0, max> $milliseconds + */ + public static function literal(int $milliseconds): self + { + return new self($milliseconds); + } + + /** + * @psalm-pure + * + * @return Maybe + */ + public static function maybe(int $milliseconds): Maybe + { + try { + return Maybe::just(new self($milliseconds)); + } catch (\RuntimeException $e) { + /** @var Maybe */ + return Maybe::nothing(); + } + } + + /** + * @psalm-pure + * + * @throws \LogicException When using a period containing months or years + */ + public static function ofPeriod(Period $period): self + { + if ($period->months() !== 0 || $period->years() !== 0) { + // a month or a year is not constant + throw new \LogicException('Months and years can not be converted to milliseconds'); + } + + $milliseconds = Period\Value::day->milliseconds($period->days()) + + Period\Value::hour->milliseconds($period->hours()) + + Period\Value::minute->milliseconds($period->minutes()) + + Period\Value::second->milliseconds($period->seconds()) + + $period->milliseconds(); + + return new self($milliseconds); + } + + public function milliseconds(): int + { + return $this->milliseconds; + } + + public function longerThan(self $period): bool + { + return $this->milliseconds > $period->milliseconds(); + } + + public function equals(self $period): bool + { + return $this->milliseconds === $period->milliseconds(); + } } diff --git a/src/Period.php b/src/Period.php index d5f941c..5b56981 100644 --- a/src/Period.php +++ b/src/Period.php @@ -180,6 +180,6 @@ public function add(self $period): self public function asElapsedPeriod(): ElapsedPeriod { - return Earth\ElapsedPeriod::ofPeriod($this); + return ElapsedPeriod::ofPeriod($this); } } diff --git a/src/Earth/Period.php b/src/Period/Value.php similarity index 92% rename from src/Earth/Period.php rename to src/Period/Value.php index 44aa467..123c504 100644 --- a/src/Earth/Period.php +++ b/src/Period/Value.php @@ -1,12 +1,12 @@ assertSame(42, $period->milliseconds()); } public function testThrowWhenTryingToBuildANegativePeriod() { - $this->expectException(ElapsedPeriodCantBeNegative::class); + $this->expectException(\RuntimeException::class); $this->expectExceptionMessage('-42'); - new ElapsedPeriod(-42); + ElapsedPeriod::of(-42); } public function testMaybe() @@ -41,26 +39,16 @@ public function testMaybe() )); } - public function testOf() - { - $this->assertInstanceOf(ElapsedPeriod::class, ElapsedPeriod::of(42)); - - $this->expectException(ElapsedPeriodCantBeNegative::class); - $this->expectExceptionMessage('-42'); - - ElapsedPeriod::of(-42); - } - public function testLongerThan() { $this->assertTrue( - (new ElapsedPeriod(42))->longerThan( - new ElapsedPeriod(0), + ElapsedPeriod::of(42)->longerThan( + ElapsedPeriod::of(0), ), ); $this->assertFalse( - (new ElapsedPeriod(42))->longerThan( - new ElapsedPeriod(66), + ElapsedPeriod::of(42)->longerThan( + ElapsedPeriod::of(66), ), ); } @@ -68,27 +56,27 @@ public function testLongerThan() public function testEquals() { $this->assertTrue( - (new ElapsedPeriod(42))->equals( - new ElapsedPeriod(42), + ElapsedPeriod::of(42)->equals( + ElapsedPeriod::of(42), ), ); $this->assertFalse( - (new ElapsedPeriod(42))->equals( - new ElapsedPeriod(66), + ElapsedPeriod::of(42)->equals( + ElapsedPeriod::of(66), ), ); } public function testThrowWhenTryingToBuildFromYearPeriod() { - $this->expectException(LogicException::class); + $this->expectException(\LogicException::class); ElapsedPeriod::ofPeriod(Year::of(1)); } public function testThrowWhenTryingToBuildFromMonthPeriod() { - $this->expectException(LogicException::class); + $this->expectException(\LogicException::class); ElapsedPeriod::ofPeriod(Month::of(1)); } From 6e0da9b39d9868db9f084a6a995a19949b85dfb2 Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Wed, 20 Nov 2024 18:07:39 +0100 Subject: [PATCH 11/85] make PointInTime a final class --- CHANGELOG.md | 4 + fixtures/Earth/PointInTime.php | 8 +- src/Clock.php | 2 + src/Earth/Clock.php | 6 +- src/Earth/PointInTime/Now.php | 129 -------- src/Earth/PointInTime/PointInTime.php | 227 -------------- src/PointInTime.php | 288 ++++++++++++++++-- .../PointInTime/HighResolution.php | 31 +- tests/Earth/Move/EndOfDayTest.php | 6 +- tests/Earth/Move/EndOfMonthTest.php | 6 +- tests/Earth/Move/EndOfYearTest.php | 6 +- tests/Earth/Move/MonthTest.php | 9 +- tests/Earth/Move/StartOfDayTest.php | 6 +- tests/Earth/Move/StartOfMonthTest.php | 6 +- tests/Earth/Move/StartOfYearTest.php | 6 +- tests/Logger/ClockTest.php | 41 +-- tests/{Earth/PointInTime => }/NowTest.php | 29 +- .../PointInTime/HighResolutionTest.php | 4 +- .../PointInTime => }/PointInTimeTest.php | 39 ++- 19 files changed, 348 insertions(+), 505 deletions(-) delete mode 100644 src/Earth/PointInTime/Now.php delete mode 100644 src/Earth/PointInTime/PointInTime.php rename src/{Earth => }/PointInTime/HighResolution.php (59%) rename tests/{Earth/PointInTime => }/NowTest.php (90%) rename tests/{Earth => }/PointInTime/HighResolutionTest.php (93%) rename tests/{Earth/PointInTime => }/PointInTimeTest.php (83%) diff --git a/CHANGELOG.md b/CHANGELOG.md index bfc8db1..51c9013 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ - `Innmind\TimeContinuum\Period` is now a `final class` - `Innmind\TimeContinuum\ElapsedPeriod` is now a `final class` - `Innmind\TimeContinuum\Earth\Period` has been renamed to `Innmind\TimeContinuum\Period\Value` +- `Innmind\TimeContinuum\PointInTime` is now a `final class` ### Removed @@ -18,6 +19,9 @@ - Classes in the `Innmind\TimeContinuum\Earth\Clock` namespace - Classes in the `Innmind\TimeContinuum\Earth\Period` namespace - `Innmind\TimeContinuum\Earth\ElapsedPeriod` +- `Innmind\TimeContinuum\Earth\PointInTime\PointInTime` +- `Innmind\TimeContinuum\Earth\PointInTime\Now` +- `Innmind\TimeContinuum\Earth\PointInTime\HighResolution` ## 3.4.1 - 2023-09-17 diff --git a/fixtures/Earth/PointInTime.php b/fixtures/Earth/PointInTime.php index 3584c6b..7ee7023 100644 --- a/fixtures/Earth/PointInTime.php +++ b/fixtures/Earth/PointInTime.php @@ -3,7 +3,7 @@ namespace Fixtures\Innmind\TimeContinuum\Earth; -use Innmind\TimeContinuum\Earth\PointInTime\PointInTime as Model; +use Innmind\TimeContinuum\PointInTime as Model; use Innmind\BlackBox\Set; final class PointInTime @@ -22,7 +22,7 @@ public static function any(): Set */ public static function after(string $point): Set { - $lower = new Model($point); + $lower = Model::at($point); return self::yearRange($lower->year()->toInt(), 9999)->filter(static function($point) use ($lower): bool { return $point->aheadOf($lower); @@ -35,7 +35,7 @@ public static function after(string $point): Set */ public static function before(string $point): Set { - $upper = new Model($point); + $upper = Model::at($point); return self::yearRange(0, $upper->year()->toInt())->filter(static function($point) use ($upper): bool { return $upper->aheadOf($point); @@ -59,7 +59,7 @@ static function( int $hourOffset, string $minuteOffset, ): Model { - return new Model("$year-$month-{$day}T$hour:$minute:$second$offsetDirection$hourOffset:$minuteOffset"); + return Model::at("$year-$month-{$day}T$hour:$minute:$second$offsetDirection$hourOffset:$minuteOffset"); }, Set\Integers::between($lowerBound, $upperBound), Set\Integers::between(1, 12), diff --git a/src/Clock.php b/src/Clock.php index 2be99d8..05b9d9c 100644 --- a/src/Clock.php +++ b/src/Clock.php @@ -12,6 +12,8 @@ public function now(): PointInTime; /** * @psalm-pure * + * @param non-empty-string $date + * * @return Maybe */ public function at(string $date, Format $format = null): Maybe; diff --git a/src/Earth/Clock.php b/src/Earth/Clock.php index faf7d5e..49cdd7b 100644 --- a/src/Earth/Clock.php +++ b/src/Earth/Clock.php @@ -8,8 +8,6 @@ Timezone, PointInTime, Format, - Earth\PointInTime\PointInTime as EarthPointInTime, - Earth\PointInTime\Now, Earth\Timezone\UTC, }; use Innmind\Immutable\Maybe; @@ -30,7 +28,7 @@ public function __construct(Timezone $timezone = null) public function now(): PointInTime { - return (new Now)->changeTimezone($this->timezone); + return PointInTime::now()->changeTimezone($this->timezone); } /** @@ -64,6 +62,6 @@ public function at(string $date, Format $format = null): Maybe * @psalm-suppress ImpureVariable * @psalm-suppress ImpurePropertyFetch */ - return Maybe::just((new EarthPointInTime($date))->changeTimezone($this->timezone)); + return Maybe::just(PointInTime::at($date)->changeTimezone($this->timezone)); } } diff --git a/src/Earth/PointInTime/Now.php b/src/Earth/PointInTime/Now.php deleted file mode 100644 index 281b41b..0000000 --- a/src/Earth/PointInTime/Now.php +++ /dev/null @@ -1,129 +0,0 @@ -format('Y-m-d\TH:i:s.uP'); - /** @psalm-suppress ImpureMethodCallAcceptable since only a clock should instantiate this class */ - $highResolution = HighResolution::now(); - - $this->point = new PointInTime($date); - $this->highResolution = $highResolution; - } - - public function milliseconds(): int - { - return $this->point->milliseconds(); - } - - public function year(): Year - { - return $this->point->year(); - } - - public function month(): Month - { - return $this->point->month(); - } - - public function day(): Day - { - return $this->point->day(); - } - - public function hour(): Hour - { - return $this->point->hour(); - } - public function minute(): Minute - { - return $this->point->minute(); - } - - public function second(): Second - { - return $this->point->second(); - } - - public function millisecond(): Millisecond - { - return $this->point->millisecond(); - } - - public function format(Format $format): string - { - return $this->point->format($format); - } - - public function changeTimezone(Timezone $zone): PointInTimeInterface - { - $self = clone $this; - $self->point = $this->point->changeTimezone($zone); - - return $self; - } - - public function timezone(): Timezone - { - return $this->point->timezone(); - } - - public function elapsedSince(PointInTimeInterface $point): ElapsedPeriod - { - if ($point instanceof self) { - return $this->highResolution->elapsedSince($point->highResolution); - } - - return ElapsedPeriod::of($this->milliseconds() - $point->milliseconds()); - } - - public function goBack(Period $period): PointInTimeInterface - { - return $this->point->goBack($period); - } - - public function goForward(Period $period): PointInTimeInterface - { - return $this->point->goForward($period); - } - - public function equals(PointInTimeInterface $point): bool - { - return $this->milliseconds() === $point->milliseconds(); - } - - public function aheadOf(PointInTimeInterface $point): bool - { - return $this->milliseconds() > $point->milliseconds(); - } - - public function toString(): string - { - return $this->point->toString(); - } -} diff --git a/src/Earth/PointInTime/PointInTime.php b/src/Earth/PointInTime/PointInTime.php deleted file mode 100644 index afcce07..0000000 --- a/src/Earth/PointInTime/PointInTime.php +++ /dev/null @@ -1,227 +0,0 @@ -date = new \DateTimeImmutable($date); - $milliseconds = $this->date->getTimestamp() * 1000; - $this->milliseconds = $milliseconds + $this->millisecond()->toInt(); - } - - public function milliseconds(): int - { - return $this->milliseconds; - } - - public function year(): Year - { - return Year::of((int) $this->date->format('Y')); - } - - public function month(): Month - { - /** @var int<1, 12> */ - $month = (int) $this->date->format('n'); - - return Month::of( - $this->year(), - $month, - ); - } - - public function day(): Day - { - /** @var int<1, 31> */ - $day = (int) $this->date->format('j'); - - return Day::of( - $this->year(), - $this->month(), - $day, - ); - } - - public function hour(): Hour - { - /** @var int<0, 23> */ - $hour = (int) $this->date->format('G'); - - return Hour::of($hour); - } - public function minute(): Minute - { - /** @var int<0, 59> */ - $minute = (int) $this->date->format('i'); - - return Minute::of($minute); - } - - public function second(): Second - { - /** @var int<0, 59> */ - $second = (int) $this->date->format('s'); - - return Second::of($second); - } - - public function millisecond(): Millisecond - { - /** @var int<0, 999> */ - $millisecond = (int) ((int) $this->date->format('u') / 1000); - - return Millisecond::of($millisecond); - } - - public function format(Format $format): string - { - return $this->date->format($format->toString()); - } - - public function changeTimezone(Timezone $zone): PointInTimeInterface - { - $self = clone $this; - $self->date = $this->date->setTimezone( - new \DateTimeZone($zone->toString()), - ); - - return $self; - } - - public function timezone(): Timezone - { - return UTC::of($this->date->format('P')); - } - - public function elapsedSince(PointInTimeInterface $point): ElapsedPeriod - { - return ElapsedPeriod::of($this->milliseconds() - $point->milliseconds()); - } - - public function goBack(Period $period): PointInTimeInterface - { - if ($this->millisecond()->toInt() > 0) { - $period = $period->add( - Period\Millisecond::of(1000 - $this->millisecond()->toInt()), - ); - } - $date = $this->date; - - foreach (self::periodComponents() as $component) { - /** @var int $periodComponent */ - $periodComponent = $period->{$component}(); - - if ($periodComponent > 0) { - /** @psalm-suppress PossiblyFalseReference The input is validated so there shouldn't be any error */ - $date = $date->modify( - \sprintf( - '-%s %s', - $periodComponent, - $component, - ), - ); - } - } - - if ($this->millisecond()->toInt() === 0 && $period->milliseconds() > 0) { - /** @psalm-suppress PossiblyFalseReference The input is validated so there shouldn't be any error */ - $date = $date->modify('-1 second'); - } - - /** @psalm-suppress PossiblyFalseReference The input is validated so there shouldn't be any error */ - return new self(\sprintf( - $date->format('Y-m-d\TH:i:s.%03\sP'), - $period->milliseconds() > 0 ? 1000 - $period->milliseconds() : 0, - )); - } - - public function goForward(Period $period): PointInTimeInterface - { - $period = $period->add( - Period\Millisecond::of($this->millisecond()->toInt()), - ); - $date = $this->date; - - foreach (self::periodComponents() as $component) { - /** @var int $periodComponent */ - $periodComponent = $period->{$component}(); - - if ($periodComponent > 0) { - /** @psalm-suppress PossiblyFalseReference The input is validated so there shouldn't be any error */ - $date = $date->modify( - \sprintf( - '+%s %s', - $periodComponent, - $component, - ), - ); - } - } - - /** @psalm-suppress PossiblyFalseReference The input is validated so there shouldn't be any error */ - return new self(\sprintf( - $date->format('Y-m-d\TH:i:s.%03\sP'), - $period->milliseconds(), - )); - } - - public function equals(PointInTimeInterface $point): bool - { - return $this->milliseconds() === $point->milliseconds(); - } - - public function aheadOf(PointInTimeInterface $point): bool - { - return $this->milliseconds() > $point->milliseconds(); - } - - public function toString(): string - { - return $this->date->format(\DateTime::ATOM); - } - - /** - * @psalm-pure - * - * @return list - */ - private static function periodComponents(): array - { - return [ - 'years', - 'months', - 'days', - 'hours', - 'minutes', - 'seconds', - ]; - } -} diff --git a/src/PointInTime.php b/src/PointInTime.php index 23547f1..f3d32ea 100644 --- a/src/PointInTime.php +++ b/src/PointInTime.php @@ -3,39 +3,275 @@ namespace Innmind\TimeContinuum; -use Innmind\TimeContinuum\PointInTime\{ - Year, - Month, - Day, - Hour, - Minute, - Second, - Millisecond, +use Innmind\TimeContinuum\{ + PointInTime\Year, + PointInTime\Month, + PointInTime\Day, + PointInTime\Hour, + PointInTime\Minute, + PointInTime\Second, + PointInTime\Millisecond, + PointInTime\HighResolution, + Earth\Timezone\UTC, }; /** * @psalm-immutable */ -interface PointInTime +final class PointInTime { + /** + * @param int<0, max> $milliseconds + */ + private function __construct( + private \DateTimeImmutable $date, + private ?HighResolution $highResolution, + private int $milliseconds, + ) { + } + + /** + * @psalm-pure + * @internal + * + * @param non-empty-string $date + */ + public static function at(string $date): self + { + $datetime = new \DateTimeImmutable($date); + /** @var int<0, max> */ + $milliseconds = $datetime->getTimestamp() * 1000; + + return new self( + $datetime, + null, + $milliseconds + self::millisecondOf($datetime), + ); + } + + /** + * @internal + */ + public static function now(): self + { + $now = new \DateTimeImmutable('now'); + /** @psalm-suppress ImpureMethodCallAcceptable since only a clock should instantiate this class */ + $highResolution = HighResolution::now(); + /** @var int<0, max> */ + $milliseconds = $now->getTimestamp() * 1000; + + return new self( + $now, + $highResolution, + $milliseconds + self::millisecondOf($now), + ); + } + /** * Since 1970-01-01T00:00:00+00:00 + * + * @return int<0, max> + */ + public function milliseconds(): int + { + return $this->milliseconds; + } + + public function year(): Year + { + return Year::of((int) $this->date->format('Y')); + } + + public function month(): Month + { + /** @var int<1, 12> */ + $month = (int) $this->date->format('n'); + + return Month::of( + $this->year(), + $month, + ); + } + + public function day(): Day + { + /** @var int<1, 31> */ + $day = (int) $this->date->format('j'); + + return Day::of( + $this->year(), + $this->month(), + $day, + ); + } + + public function hour(): Hour + { + /** @var int<0, 23> */ + $hour = (int) $this->date->format('G'); + + return Hour::of($hour); + } + public function minute(): Minute + { + /** @var int<0, 59> */ + $minute = (int) $this->date->format('i'); + + return Minute::of($minute); + } + + public function second(): Second + { + /** @var int<0, 59> */ + $second = (int) $this->date->format('s'); + + return Second::of($second); + } + + public function millisecond(): Millisecond + { + return Millisecond::of(self::millisecondOf($this->date)); + } + + public function format(Format $format): string + { + return $this->date->format($format->toString()); + } + + public function changeTimezone(Timezone $zone): self + { + return new self( + $this->date->setTimezone( + new \DateTimeZone($zone->toString()), + ), + $this->highResolution, + $this->milliseconds, + ); + } + + public function timezone(): Timezone + { + return UTC::of($this->date->format('P')); + } + + public function elapsedSince(self $point): ElapsedPeriod + { + if (!\is_null($this->highResolution) && !\is_null($point->highResolution)) { + return $this->highResolution->elapsedSince($point->highResolution); + } + + return ElapsedPeriod::of($this->milliseconds() - $point->milliseconds()); + } + + public function goBack(Period $period): self + { + if ($this->millisecond()->toInt() > 0) { + $period = $period->add( + Period\Millisecond::of(1000 - $this->millisecond()->toInt()), + ); + } + $date = $this->date; + + foreach (self::periodComponents() as $component) { + /** @var int $periodComponent */ + $periodComponent = $period->{$component}(); + + if ($periodComponent > 0) { + /** @psalm-suppress PossiblyFalseReference The input is validated so there shouldn't be any error */ + $date = $date->modify( + \sprintf( + '-%s %s', + $periodComponent, + $component, + ), + ); + } + } + + if ($this->millisecond()->toInt() === 0 && $period->milliseconds() > 0) { + /** @psalm-suppress PossiblyFalseReference The input is validated so there shouldn't be any error */ + $date = $date->modify('-1 second'); + } + + /** @psalm-suppress PossiblyFalseReference The input is validated so there shouldn't be any error */ + // todo avoid using the string representation + return self::at(\sprintf( + $date->format('Y-m-d\TH:i:s.%03\sP'), + $period->milliseconds() > 0 ? 1000 - $period->milliseconds() : 0, + )); + } + + public function goForward(Period $period): self + { + $period = $period->add( + Period\Millisecond::of($this->millisecond()->toInt()), + ); + $date = $this->date; + + foreach (self::periodComponents() as $component) { + /** @var int $periodComponent */ + $periodComponent = $period->{$component}(); + + if ($periodComponent > 0) { + /** @psalm-suppress PossiblyFalseReference The input is validated so there shouldn't be any error */ + $date = $date->modify( + \sprintf( + '+%s %s', + $periodComponent, + $component, + ), + ); + } + } + + /** @psalm-suppress PossiblyFalseReference The input is validated so there shouldn't be any error */ + // todo avoid using the string representation + return self::at(\sprintf( + $date->format('Y-m-d\TH:i:s.%03\sP'), + $period->milliseconds(), + )); + } + + public function equals(self $point): bool + { + return $this->milliseconds() === $point->milliseconds(); + } + + public function aheadOf(self $point): bool + { + return $this->milliseconds() > $point->milliseconds(); + } + + public function toString(): string + { + return $this->date->format(\DateTime::ATOM); + } + + /** + * @psalm-pure + * + * @return list + */ + private static function periodComponents(): array + { + return [ + 'years', + 'months', + 'days', + 'hours', + 'minutes', + 'seconds', + ]; + } + + /** + * @psalm-pure + * + * @return int<0, 999> */ - public function milliseconds(): int; - public function year(): Year; - public function month(): Month; - public function day(): Day; - public function hour(): Hour; - public function minute(): Minute; - public function second(): Second; - public function millisecond(): Millisecond; - public function format(Format $format): string; - public function changeTimezone(Timezone $zone): self; - public function timezone(): Timezone; - public function elapsedSince(self $point): ElapsedPeriod; - public function goBack(Period $period): self; - public function goForward(Period $period): self; - public function equals(self $point): bool; - public function aheadOf(self $point): bool; - public function toString(): string; + private static function millisecondOf(\DateTimeImmutable $date): int + { + /** @var int<0, 999> */ + return (int) ((int) $date->format('u') / 1000); + } } diff --git a/src/Earth/PointInTime/HighResolution.php b/src/PointInTime/HighResolution.php similarity index 59% rename from src/Earth/PointInTime/HighResolution.php rename to src/PointInTime/HighResolution.php index 9469e2a..9bdd7e2 100644 --- a/src/Earth/PointInTime/HighResolution.php +++ b/src/PointInTime/HighResolution.php @@ -1,35 +1,34 @@ $seconds + * @param int<0, max> $nanoseconds */ - private function __construct(int $seconds, int $nanoseconds) - { - $this->seconds = $seconds; - $this->nanoseconds = $nanoseconds; + private function __construct( + private int $seconds, + private int $nanoseconds, + ) { } + /** + * @internal + */ public static function now(): self { /** - * @var 0|positive-int $seconds - * @var 0|positive-int $nanoseconds + * @var int<0, max> $seconds + * @var int<0, max> $nanoseconds */ [$seconds, $nanoseconds] = \hrtime(); @@ -39,8 +38,8 @@ public static function now(): self /** * @internal * - * @param 0|positive-int $seconds - * @param 0|positive-int $nanoseconds + * @param int<0, max> $seconds + * @param int<0, max> $nanoseconds */ public static function of(int $seconds, int $nanoseconds): self { diff --git a/tests/Earth/Move/EndOfDayTest.php b/tests/Earth/Move/EndOfDayTest.php index c79686c..bc90e75 100644 --- a/tests/Earth/Move/EndOfDayTest.php +++ b/tests/Earth/Move/EndOfDayTest.php @@ -5,8 +5,7 @@ use Innmind\TimeContinuum\{ Earth\Move\EndOfDay, - PointInTime as PointInTimeInterface, - Earth\PointInTime\PointInTime, + PointInTime, Format, }; use PHPUnit\Framework\TestCase; @@ -20,9 +19,8 @@ public function testInterface($time, $expected) { $endOfDay = new EndOfDay; - $point = $endOfDay(new PointInTime($time)); + $point = $endOfDay(PointInTime::at($time)); - $this->assertInstanceOf(PointInTimeInterface::class, $point); $this->assertSame($expected, $point->format(Format::of('Y-m-d H:i:s.u'))); } diff --git a/tests/Earth/Move/EndOfMonthTest.php b/tests/Earth/Move/EndOfMonthTest.php index 5bc668d..4da6c2b 100644 --- a/tests/Earth/Move/EndOfMonthTest.php +++ b/tests/Earth/Move/EndOfMonthTest.php @@ -5,8 +5,7 @@ use Innmind\TimeContinuum\{ Earth\Move\EndOfMonth, - PointInTime as PointInTimeInterface, - Earth\PointInTime\PointInTime, + PointInTime, Format, }; use PHPUnit\Framework\TestCase; @@ -20,9 +19,8 @@ public function testInterface($time, $expected) { $endOfMonth = new EndOfMonth; - $point = $endOfMonth(new PointInTime($time)); + $point = $endOfMonth(PointInTime::at($time)); - $this->assertInstanceOf(PointInTimeInterface::class, $point); $this->assertSame($expected, $point->format(Format::of('Y-m-d H:i:s.u'))); } diff --git a/tests/Earth/Move/EndOfYearTest.php b/tests/Earth/Move/EndOfYearTest.php index 1ebf8bc..0a35b6f 100644 --- a/tests/Earth/Move/EndOfYearTest.php +++ b/tests/Earth/Move/EndOfYearTest.php @@ -5,8 +5,7 @@ use Innmind\TimeContinuum\{ Earth\Move\EndOfYear, - PointInTime as PointInTimeInterface, - Earth\PointInTime\PointInTime, + PointInTime, Format, }; use PHPUnit\Framework\TestCase; @@ -20,9 +19,8 @@ public function testInterface($time, $expected) { $endOfYear = new EndOfYear; - $point = $endOfYear(new PointInTime($time)); + $point = $endOfYear(PointInTime::at($time)); - $this->assertInstanceOf(PointInTimeInterface::class, $point); $this->assertSame($expected, $point->format(Format::of('Y-m-d H:i:s.u'))); } diff --git a/tests/Earth/Move/MonthTest.php b/tests/Earth/Move/MonthTest.php index 34dba8a..612133a 100644 --- a/tests/Earth/Move/MonthTest.php +++ b/tests/Earth/Move/MonthTest.php @@ -5,8 +5,7 @@ use Innmind\TimeContinuum\{ Earth\Move\Month, - PointInTime as PointInTimeInterface, - Earth\PointInTime\PointInTime, + PointInTime, Format, }; use PHPUnit\Framework\TestCase; @@ -22,14 +21,12 @@ public function testInterface($time, $expectedForward, $expectedBackward) $forward = Month::forward(1); $backward = Month::backward(1); - $point = $forward(new PointInTime($time)); + $point = $forward(PointInTime::at($time)); - $this->assertInstanceOf(PointInTimeInterface::class, $point); $this->assertSame($expectedForward, $point->format($format)); - $point = $backward(new PointInTime($time)); + $point = $backward(PointInTime::at($time)); - $this->assertInstanceOf(PointInTimeInterface::class, $point); $this->assertSame($expectedBackward, $point->format($format)); } diff --git a/tests/Earth/Move/StartOfDayTest.php b/tests/Earth/Move/StartOfDayTest.php index 08f7067..2f90c81 100644 --- a/tests/Earth/Move/StartOfDayTest.php +++ b/tests/Earth/Move/StartOfDayTest.php @@ -5,8 +5,7 @@ use Innmind\TimeContinuum\{ Earth\Move\StartOfDay, - PointInTime as PointInTimeInterface, - Earth\PointInTime\PointInTime, + PointInTime, Format, }; use PHPUnit\Framework\TestCase; @@ -20,9 +19,8 @@ public function testInterface($time, $expected) { $startOfDay = new StartOfDay; - $point = $startOfDay(new PointInTime($time)); + $point = $startOfDay(PointInTime::at($time)); - $this->assertInstanceOf(PointInTimeInterface::class, $point); $this->assertSame($expected, $point->format(Format::of('Y-m-d H:i:s.u'))); } diff --git a/tests/Earth/Move/StartOfMonthTest.php b/tests/Earth/Move/StartOfMonthTest.php index 6366f52..a6f7b8a 100644 --- a/tests/Earth/Move/StartOfMonthTest.php +++ b/tests/Earth/Move/StartOfMonthTest.php @@ -5,8 +5,7 @@ use Innmind\TimeContinuum\{ Earth\Move\StartOfMonth, - PointInTime as PointInTimeInterface, - Earth\PointInTime\PointInTime, + PointInTime, Format, }; use PHPUnit\Framework\TestCase; @@ -20,9 +19,8 @@ public function testInterface($time, $expected) { $startOfMonth = new StartOfMonth; - $point = $startOfMonth(new PointInTime($time)); + $point = $startOfMonth(PointInTime::at($time)); - $this->assertInstanceOf(PointInTimeInterface::class, $point); $this->assertSame($expected, $point->format(Format::of('Y-m-d H:i:s.u'))); } diff --git a/tests/Earth/Move/StartOfYearTest.php b/tests/Earth/Move/StartOfYearTest.php index 801bd13..7cc1013 100644 --- a/tests/Earth/Move/StartOfYearTest.php +++ b/tests/Earth/Move/StartOfYearTest.php @@ -5,8 +5,7 @@ use Innmind\TimeContinuum\{ Earth\Move\StartOfYear, - PointInTime as PointInTimeInterface, - Earth\PointInTime\PointInTime, + PointInTime, Format, }; use PHPUnit\Framework\TestCase; @@ -20,9 +19,8 @@ public function testInterface($time, $expected) { $startOfYear = new StartOfYear; - $point = $startOfYear(new PointInTime($time)); + $point = $startOfYear(PointInTime::at($time)); - $this->assertInstanceOf(PointInTimeInterface::class, $point); $this->assertSame($expected, $point->format(Format::of('Y-m-d H:i:s.u'))); } diff --git a/tests/Logger/ClockTest.php b/tests/Logger/ClockTest.php index abc5718..5808288 100644 --- a/tests/Logger/ClockTest.php +++ b/tests/Logger/ClockTest.php @@ -6,9 +6,9 @@ use Innmind\TimeContinuum\{ Logger\Clock, Clock as ClockInterface, - PointInTime, Format, }; +use Fixtures\Innmind\TimeContinuum\Earth\PointInTime; use Innmind\Immutable\Maybe; use Psr\Log\LoggerInterface; use PHPUnit\Framework\TestCase; @@ -35,25 +35,20 @@ public function testInterface() public function testGeneratedNowIsLogged() { $this - ->forAll(Set\Strings::any()) - ->then(function($value) { + ->forAll(PointInTime::any()) + ->then(function($now) { $concrete = $this->createMock(ClockInterface::class); $concrete ->expects($this->once()) ->method('now') - ->willReturn($now = $this->createMock(PointInTime::class)); - $now - ->expects($this->once()) - ->method('format') - ->with(Format::iso8601()) - ->willReturn($value); + ->willReturn($now); $logger = $this->createMock(LoggerInterface::class); $logger ->expects($this->once()) ->method('debug') ->with( 'Current time is {point}', - ['point' => $value], + ['point' => $now->format(Format::iso8601())], ); $clock = new Clock($concrete, $logger); @@ -67,20 +62,15 @@ public function testAskedDateIsLogged() $this ->forAll( Set\Strings::any(), - Set\Strings::any(), + PointInTime::any(), ) - ->then(function($date, $value) { + ->then(function($date, $point) { $concrete = $this->createMock(ClockInterface::class); $concrete ->expects($this->once()) ->method('at') ->with($date) - ->willReturn(Maybe::just($point = $this->createMock(PointInTime::class))); - $point - ->expects($this->once()) - ->method('format') - ->with(Format::iso8601()) - ->willReturn($value); + ->willReturn(Maybe::just($point)); $logger = $this->createMock(LoggerInterface::class); $logger ->expects($this->once()) @@ -90,7 +80,7 @@ public function testAskedDateIsLogged() [ 'date' => $date, 'format' => 'unknown', - 'point' => $value, + 'point' => $point->format(Format::iso8601()), ], ); @@ -111,7 +101,7 @@ public function testAskedDateWithSpecificFormatIsLogged() $this ->forAll( Set\Strings::any(), - Set\Strings::any(), + PointInTime::any(), Set\Elements::of( Format::cookie(), Format::iso8601(), @@ -124,18 +114,13 @@ public function testAskedDateWithSpecificFormatIsLogged() Format::w3c(), ), ) - ->then(function($date, $value, $format) { + ->then(function($date, $point, $format) { $concrete = $this->createMock(ClockInterface::class); $concrete ->expects($this->once()) ->method('at') ->with($date) - ->willReturn(Maybe::just($point = $this->createMock(PointInTime::class))); - $point - ->expects($this->once()) - ->method('format') - ->with(Format::iso8601()) - ->willReturn($value); + ->willReturn(Maybe::just($point)); $logger = $this->createMock(LoggerInterface::class); $logger ->expects($this->once()) @@ -145,7 +130,7 @@ public function testAskedDateWithSpecificFormatIsLogged() [ 'date' => $date, 'format' => $format->toString(), - 'point' => $value, + 'point' => $point->format(Format::iso8601()), ], ); diff --git a/tests/Earth/PointInTime/NowTest.php b/tests/NowTest.php similarity index 90% rename from tests/Earth/PointInTime/NowTest.php rename to tests/NowTest.php index 51a67e7..3bb6c58 100644 --- a/tests/Earth/PointInTime/NowTest.php +++ b/tests/NowTest.php @@ -1,10 +1,9 @@ assertInstanceOf(PointInTime::class, $point); $this->assertInstanceOf(YearInterface::class, $point->year()); $this->assertInstanceOf(Month::class, $point->month()); $this->assertInstanceOf(Day::class, $point->day()); @@ -61,7 +59,7 @@ public function testInterface() public function testFormat() { - $point = new Now; + $point = PointInTime::now(); $this->assertSame( \date('H:i:s d/m/Y'), @@ -73,10 +71,9 @@ public function testChangeTimezone() { $now = new \DateTimeImmutable; $now = $now->setTimezone(new \DateTimeZone('-02:30')); - $point = new Now; + $point = PointInTime::now(); $point2 = $point->changeTimezone(new UTC(-2, 30)); - $this->assertInstanceOf(PointInTime::class, $point2); $this->assertNotSame($point, $point2); $this->assertNotSame($point->year(), $point2->year()); $this->assertNotSame($point->month(), $point2->month()); @@ -97,9 +94,9 @@ public function testChangeTimezone() public function testElapsedSince() { - $point = new Now; + $point = PointInTime::now(); \sleep(1); - $point2 = new Now; + $point2 = PointInTime::now(); $elapsed = $point2->elapsedSince($point); $this->assertInstanceOf(ElapsedPeriod::class, $elapsed); @@ -109,9 +106,9 @@ public function testElapsedSince() public function testAheadOf() { - $point = new Now; + $point = PointInTime::now(); \sleep(1); - $point2 = new Now; + $point2 = PointInTime::now(); $this->assertTrue($point2->aheadOf($point)); $this->assertFalse($point->aheadOf($point2)); @@ -119,9 +116,9 @@ public function testAheadOf() public function testEquals() { - $point = new Now; + $point = PointInTime::now(); \sleep(1); - $point2 = new Now; + $point2 = PointInTime::now(); $point3 = clone $point; $this->assertTrue($point->equals($point3)); @@ -130,20 +127,18 @@ public function testEquals() public function testGoForward() { - $point = new Now; + $point = PointInTime::now(); $point2 = $point->goForward(Year::of(1)); - $this->assertInstanceOf(PointInTime::class, $point2); $this->assertNotSame($point, $point2); $this->assertSame($point->year()->toInt() + 1, $point2->year()->toInt()); } public function testGoBack() { - $point = new Now; + $point = PointInTime::now(); $point2 = $point->goBack(Year::of(1)); - $this->assertInstanceOf(PointInTime::class, $point2); $this->assertNotSame($point, $point2); $this->assertSame($point->year()->toInt() - 1, $point2->year()->toInt()); diff --git a/tests/Earth/PointInTime/HighResolutionTest.php b/tests/PointInTime/HighResolutionTest.php similarity index 93% rename from tests/Earth/PointInTime/HighResolutionTest.php rename to tests/PointInTime/HighResolutionTest.php index b0da1ef..187dd78 100644 --- a/tests/Earth/PointInTime/HighResolutionTest.php +++ b/tests/PointInTime/HighResolutionTest.php @@ -1,9 +1,9 @@ assertInstanceOf(PointInTimeInterface::class, $point); $this->assertInstanceOf(Year::class, $point->year()); $this->assertInstanceOf(Month::class, $point->month()); $this->assertInstanceOf(DayInterface::class, $point->day()); @@ -54,7 +52,7 @@ public function testInterface() public function testPreserveMillisecondsWhenNanosecondsInString() { - $point = new PointInTime('2016-10-05T08:01:30.999678+02:00'); + $point = PointInTime::at('2016-10-05T08:01:30.999678+02:00'); $this->assertSame(999, $point->millisecond()->toInt()); $this->assertSame(30, $point->second()->toInt()); @@ -62,7 +60,7 @@ public function testPreserveMillisecondsWhenNanosecondsInString() public function testFormat() { - $point = new PointInTime('2016-10-05T08:01:30.123+02:00'); + $point = PointInTime::at('2016-10-05T08:01:30.123+02:00'); $this->assertSame( '08:01:30 05/10/2016', @@ -72,10 +70,9 @@ public function testFormat() public function testChangeTimezone() { - $point = new PointInTime('2016-10-05T08:01:30.123+02:00'); + $point = PointInTime::at('2016-10-05T08:01:30.123+02:00'); $point2 = $point->changeTimezone(new UTC(-2, 30)); - $this->assertInstanceOf(PointInTimeInterface::class, $point2); $this->assertNotSame($point, $point2); $this->assertNotSame($point->year(), $point2->year()); $this->assertNotSame($point->month(), $point2->month()); @@ -97,8 +94,8 @@ public function testChangeTimezone() public function testElapsedSince() { - $point = new PointInTime('2016-10-05T08:01:30.123+02:00'); - $point2 = new PointInTime('2016-10-05T08:03:30.234+02:00'); + $point = PointInTime::at('2016-10-05T08:01:30.123+02:00'); + $point2 = PointInTime::at('2016-10-05T08:03:30.234+02:00'); $elapsed = $point2->elapsedSince($point); $this->assertInstanceOf(ElapsedPeriod::class, $elapsed); @@ -107,8 +104,8 @@ public function testElapsedSince() public function testAheadOf() { - $point = new PointInTime('2016-10-05T08:01:30.123+02:00'); - $point2 = new PointInTime('2016-10-05T08:03:30.234+02:00'); + $point = PointInTime::at('2016-10-05T08:01:30.123+02:00'); + $point2 = PointInTime::at('2016-10-05T08:03:30.234+02:00'); $this->assertTrue($point2->aheadOf($point)); $this->assertFalse($point->aheadOf($point2)); @@ -116,9 +113,9 @@ public function testAheadOf() public function testEquals() { - $point = new PointInTime('2016-10-05T08:01:30.123+02:00'); - $point2 = new PointInTime('2016-10-05T08:03:30.234+02:00'); - $point3 = new PointInTime('2016-10-05T08:01:30.123+02:00'); + $point = PointInTime::at('2016-10-05T08:01:30.123+02:00'); + $point2 = PointInTime::at('2016-10-05T08:03:30.234+02:00'); + $point3 = PointInTime::at('2016-10-05T08:01:30.123+02:00'); $this->assertTrue($point->equals($point3)); $this->assertFalse($point->equals($point2)); @@ -126,12 +123,11 @@ public function testEquals() public function testGoForward() { - $point = new PointInTime('2016-10-05T08:01:30.123+02:00'); + $point = PointInTime::at('2016-10-05T08:01:30.123+02:00'); $point2 = $point->goForward( Period::of(1, 1, 1, 1, 1, 30, 878), ); - $this->assertInstanceOf(PointInTimeInterface::class, $point2); $this->assertSame(2016, $point->year()->toInt()); $this->assertSame(10, $point->month()->toInt()); $this->assertSame(5, $point->day()->toInt()); @@ -150,12 +146,11 @@ public function testGoForward() public function testGoBack() { - $point = new PointInTime('2016-10-05T08:01:30.123+02:00'); + $point = PointInTime::at('2016-10-05T08:01:30.123+02:00'); $point2 = $point->goBack( Period::of(1, 1, 1, 1, 1, 30, 125), ); - $this->assertInstanceOf(PointInTimeInterface::class, $point2); $this->assertSame(2016, $point->year()->toInt()); $this->assertSame(10, $point->month()->toInt()); $this->assertSame(5, $point->day()->toInt()); @@ -181,7 +176,7 @@ public function testGoBack() public function testGoBackOneDay() { - $point = new PointInTime('2018-03-04'); + $point = PointInTime::at('2018-03-04'); $point2 = $point->goBack(Day::of(1)); $format = Format::of('Y-m-d\TH:i:s.u'); @@ -197,7 +192,7 @@ public function testGoBackOneDay() public function testGoBackOneMillisecondWhenCurrentPointIsAtPreciselyZeroMillisecond() { - $point = new PointInTime('1402-07-21 02:42:53.000000'); + $point = PointInTime::at('1402-07-21 02:42:53.000000'); $point2 = $point->goBack(Period\Millisecond::of(1)); $format = Format::of('Y-m-d\TH:i:s.u'); From b4b483ab6519663f5cbdf2e1b14f4a7fc781e967 Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Wed, 20 Nov 2024 18:10:47 +0100 Subject: [PATCH 12/85] remove Earth from the fixtures namespace --- CHANGELOG.md | 1 + fixtures/{Earth => }/Period.php | 2 +- fixtures/{Earth => }/PointInTime.php | 2 +- tests/Earth/FrozenClockTest.php | 2 +- tests/Fixtures/{Earth => }/PeriodTest.php | 4 ++-- tests/Fixtures/{Earth => }/PointInTimeTest.php | 4 ++-- tests/Logger/ClockTest.php | 2 +- 7 files changed, 9 insertions(+), 8 deletions(-) rename fixtures/{Earth => }/Period.php (97%) rename fixtures/{Earth => }/PointInTime.php (97%) rename tests/Fixtures/{Earth => }/PeriodTest.php (96%) rename tests/Fixtures/{Earth => }/PointInTimeTest.php (94%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 51c9013..8822b2d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ - `Innmind\TimeContinuum\ElapsedPeriod` is now a `final class` - `Innmind\TimeContinuum\Earth\Period` has been renamed to `Innmind\TimeContinuum\Period\Value` - `Innmind\TimeContinuum\PointInTime` is now a `final class` +- Classes in the `Fixtures\Innmind\TimeContinuum\Earth` namespace have been moved to `Fixtures\Innmind\TimeContinuum` ### Removed diff --git a/fixtures/Earth/Period.php b/fixtures/Period.php similarity index 97% rename from fixtures/Earth/Period.php rename to fixtures/Period.php index a2ce9ee..cd28de8 100644 --- a/fixtures/Earth/Period.php +++ b/fixtures/Period.php @@ -1,7 +1,7 @@ Date: Wed, 20 Nov 2024 18:17:19 +0100 Subject: [PATCH 13/85] move clock in the same namespace --- CHANGELOG.md | 3 ++ .../FrozenClock.php => Clock/Frozen.php} | 8 +++--- src/{Earth/Clock.php => Clock/Live.php} | 6 ++-- src/{Logger/Clock.php => Clock/Logger.php} | 10 +++---- .../FrozenTest.php} | 12 ++++---- .../ClockTest.php => Clock/LiveTest.php} | 28 +++++++++---------- .../ClockTest.php => Clock/LoggerTest.php} | 26 ++++++++--------- 7 files changed, 48 insertions(+), 45 deletions(-) rename src/{Earth/FrozenClock.php => Clock/Frozen.php} (82%) rename src/{Earth/Clock.php => Clock/Live.php} (93%) rename src/{Logger/Clock.php => Clock/Logger.php} (87%) rename tests/{Earth/FrozenClockTest.php => Clock/FrozenTest.php} (83%) rename tests/{Earth/ClockTest.php => Clock/LiveTest.php} (84%) rename tests/{Logger/ClockTest.php => Clock/LoggerTest.php} (86%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8822b2d..c90a270 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,9 @@ - `Innmind\TimeContinuum\Earth\Period` has been renamed to `Innmind\TimeContinuum\Period\Value` - `Innmind\TimeContinuum\PointInTime` is now a `final class` - Classes in the `Fixtures\Innmind\TimeContinuum\Earth` namespace have been moved to `Fixtures\Innmind\TimeContinuum` +- `Innmind\TimeContinuum\Earth\Clock` as been renamed `Innmind\TimeContinuum\Clock\Live` +- `Innmind\TimeContinuum\Earth\FrozenClock` as been renamed `Innmind\TimeContinuum\Clock\Frozen` +- `Innmind\TimeContinuum\Logger\Clock` as been renamed `Innmind\TimeContinuum\Clock\Logger` ### Removed diff --git a/src/Earth/FrozenClock.php b/src/Clock/Frozen.php similarity index 82% rename from src/Earth/FrozenClock.php rename to src/Clock/Frozen.php index e83b69f..927291a 100644 --- a/src/Earth/FrozenClock.php +++ b/src/Clock/Frozen.php @@ -1,16 +1,16 @@ now = $now; - $this->concrete = new Clock; + $this->concrete = new Live; } public function now(): PointInTime diff --git a/src/Earth/Clock.php b/src/Clock/Live.php similarity index 93% rename from src/Earth/Clock.php rename to src/Clock/Live.php index 49cdd7b..bead585 100644 --- a/src/Earth/Clock.php +++ b/src/Clock/Live.php @@ -1,10 +1,10 @@ clock = $clock; $this->logger = $logger; diff --git a/tests/Earth/FrozenClockTest.php b/tests/Clock/FrozenTest.php similarity index 83% rename from tests/Earth/FrozenClockTest.php rename to tests/Clock/FrozenTest.php index 1ab464c..1afe264 100644 --- a/tests/Earth/FrozenClockTest.php +++ b/tests/Clock/FrozenTest.php @@ -1,10 +1,10 @@ forAll(PointInTime::any()) ->then(function($now) { - $this->assertInstanceOf(Clock::class, new FrozenClock($now)); + $this->assertInstanceOf(Clock::class, new Frozen($now)); }); } @@ -31,7 +31,7 @@ public function testNow() $this ->forAll(PointInTime::any()) ->then(function($now) { - $this->assertSame($now, (new FrozenClock($now))->now()); + $this->assertSame($now, (new Frozen($now))->now()); }); } @@ -43,7 +43,7 @@ public function testAtReturnWithTheSameTimezoneAsNow() PointInTime::any(), ) ->then(function($now, $at) { - $clock = new FrozenClock($now); + $clock = new Frozen($now); $point = $clock->at($at->format(Format::iso8601()))->match( static fn($point) => $point, diff --git a/tests/Earth/ClockTest.php b/tests/Clock/LiveTest.php similarity index 84% rename from tests/Earth/ClockTest.php rename to tests/Clock/LiveTest.php index 764e7b8..c75bb09 100644 --- a/tests/Earth/ClockTest.php +++ b/tests/Clock/LiveTest.php @@ -1,11 +1,11 @@ assertInstanceOf( - ClockInterface::class, - new Clock, + Clock::class, + new Live, ); } @@ -32,7 +32,7 @@ public function testNow() { $this->assertInstanceOf( PointInTime::class, - $now = (new Clock)->now(), + $now = (new Live)->now(), ); $timezone = \date('P'); $timezone = $timezone === '+00:00' ? 'Z' : $timezone; @@ -46,7 +46,7 @@ public function testAt() { $this->assertInstanceOf( PointInTime::class, - $point = (new Clock)->at('2016-10-08T16:08:30+02:00')->match( + $point = (new Live)->at('2016-10-08T16:08:30+02:00')->match( static fn($point) => $point, static fn() => null, ), @@ -63,7 +63,7 @@ public function testNowAtGivenExpectedTimezone() { $this->assertInstanceOf( PointInTime::class, - $now = (new Clock(new UTC(6, 42)))->now(), + $now = (new Live(new UTC(6, 42)))->now(), ); $this->assertSame('+06:42', $now->timezone()->toString()); } @@ -72,7 +72,7 @@ public function testAtWithExpectedTimezone() { $this->assertInstanceOf( PointInTime::class, - $point = (new Clock(new UTC(6, 42)))->at('2016-10-08T16:08:30+02:00')->match( + $point = (new Live(new UTC(6, 42)))->at('2016-10-08T16:08:30+02:00')->match( static fn($point) => $point, static fn() => null, ), @@ -84,7 +84,7 @@ public function testAtWithSpecificFormat() { $this->assertInstanceOf( PointInTime::class, - $point = (new Clock)->at('+02:00 2016-10-08 16:08:30', Format::of('P Y-m-d H:i:s'))->match( + $point = (new Live)->at('+02:00 2016-10-08 16:08:30', Format::of('P Y-m-d H:i:s'))->match( static fn($point) => $point, static fn() => null, ), @@ -102,7 +102,7 @@ public function testAtWithDateNotOfExpectedFormat() $this ->forAll(Set\Strings::any()) ->then(function($date) { - $clock = new Clock; + $clock = new Live; $this->assertNull($clock->at($date, Format::iso8601())->match( static fn($point) => $point, @@ -113,7 +113,7 @@ public function testAtWithDateNotOfExpectedFormat() public function testAtWithNullDate() { - $clock = new Clock; + $clock = new Live; $this->assertNull($clock->at("\x00", Format::iso8601())->match( static fn($point) => $point, static fn() => null, @@ -132,7 +132,7 @@ public function testDateCorrectlyRespectTheFormatGiven() $date = "$year-0$month-$day"; $this->assertNull( - (new Clock) + (new Live) ->at($date, Format::of('Y-m-d')) ->match( static fn($point) => $point, diff --git a/tests/Logger/ClockTest.php b/tests/Clock/LoggerTest.php similarity index 86% rename from tests/Logger/ClockTest.php rename to tests/Clock/LoggerTest.php index dce512a..2a31dbb 100644 --- a/tests/Logger/ClockTest.php +++ b/tests/Clock/LoggerTest.php @@ -1,11 +1,11 @@ assertInstanceOf( - ClockInterface::class, - new Clock( - $this->createMock(ClockInterface::class), + Clock::class, + new Logger( + $this->createMock(Clock::class), $this->createMock(LoggerInterface::class), ), ); @@ -37,7 +37,7 @@ public function testGeneratedNowIsLogged() $this ->forAll(PointInTime::any()) ->then(function($now) { - $concrete = $this->createMock(ClockInterface::class); + $concrete = $this->createMock(Clock::class); $concrete ->expects($this->once()) ->method('now') @@ -51,7 +51,7 @@ public function testGeneratedNowIsLogged() ['point' => $now->format(Format::iso8601())], ); - $clock = new Clock($concrete, $logger); + $clock = new Logger($concrete, $logger); $this->assertSame($now, $clock->now()); }); @@ -65,7 +65,7 @@ public function testAskedDateIsLogged() PointInTime::any(), ) ->then(function($date, $point) { - $concrete = $this->createMock(ClockInterface::class); + $concrete = $this->createMock(Clock::class); $concrete ->expects($this->once()) ->method('at') @@ -84,7 +84,7 @@ public function testAskedDateIsLogged() ], ); - $clock = new Clock($concrete, $logger); + $clock = new Logger($concrete, $logger); $this->assertSame( $point, @@ -115,7 +115,7 @@ public function testAskedDateWithSpecificFormatIsLogged() ), ) ->then(function($date, $point, $format) { - $concrete = $this->createMock(ClockInterface::class); + $concrete = $this->createMock(Clock::class); $concrete ->expects($this->once()) ->method('at') @@ -134,7 +134,7 @@ public function testAskedDateWithSpecificFormatIsLogged() ], ); - $clock = new Clock($concrete, $logger); + $clock = new Logger($concrete, $logger); $this->assertSame( $point, From 6862d6d2f858dead77b1796afc658622b4a102bb Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Wed, 20 Nov 2024 18:20:10 +0100 Subject: [PATCH 14/85] move Earth\Move to Move --- CHANGELOG.md | 1 + src/{Earth => }/Move/EndOfDay.php | 2 +- src/{Earth => }/Move/EndOfMonth.php | 2 +- src/{Earth => }/Move/EndOfYear.php | 2 +- src/{Earth => }/Move/Month.php | 2 +- src/{Earth => }/Move/StartOfDay.php | 2 +- src/{Earth => }/Move/StartOfMonth.php | 2 +- src/{Earth => }/Move/StartOfYear.php | 2 +- tests/{Earth => }/Move/EndOfDayTest.php | 4 ++-- tests/{Earth => }/Move/EndOfMonthTest.php | 4 ++-- tests/{Earth => }/Move/EndOfYearTest.php | 4 ++-- tests/{Earth => }/Move/MonthTest.php | 4 ++-- tests/{Earth => }/Move/StartOfDayTest.php | 4 ++-- tests/{Earth => }/Move/StartOfMonthTest.php | 4 ++-- tests/{Earth => }/Move/StartOfYearTest.php | 4 ++-- 15 files changed, 22 insertions(+), 21 deletions(-) rename src/{Earth => }/Move/EndOfDay.php (92%) rename src/{Earth => }/Move/EndOfMonth.php (91%) rename src/{Earth => }/Move/EndOfYear.php (89%) rename src/{Earth => }/Move/Month.php (97%) rename src/{Earth => }/Move/StartOfDay.php (94%) rename src/{Earth => }/Move/StartOfMonth.php (87%) rename src/{Earth => }/Move/StartOfYear.php (87%) rename tests/{Earth => }/Move/EndOfDayTest.php (91%) rename tests/{Earth => }/Move/EndOfMonthTest.php (92%) rename tests/{Earth => }/Move/EndOfYearTest.php (92%) rename tests/{Earth => }/Move/MonthTest.php (93%) rename tests/{Earth => }/Move/StartOfDayTest.php (91%) rename tests/{Earth => }/Move/StartOfMonthTest.php (90%) rename tests/{Earth => }/Move/StartOfYearTest.php (91%) diff --git a/CHANGELOG.md b/CHANGELOG.md index c90a270..69b3b54 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ - `Innmind\TimeContinuum\Earth\Clock` as been renamed `Innmind\TimeContinuum\Clock\Live` - `Innmind\TimeContinuum\Earth\FrozenClock` as been renamed `Innmind\TimeContinuum\Clock\Frozen` - `Innmind\TimeContinuum\Logger\Clock` as been renamed `Innmind\TimeContinuum\Clock\Logger` +- Classes in the `Innmind\TimeContinuum\Earth\Move` namespace have been moved to `Innmind\TimeContinuum\Move` ### Removed diff --git a/src/Earth/Move/EndOfDay.php b/src/Move/EndOfDay.php similarity index 92% rename from src/Earth/Move/EndOfDay.php rename to src/Move/EndOfDay.php index 2ebd51d..7a0e43a 100644 --- a/src/Earth/Move/EndOfDay.php +++ b/src/Move/EndOfDay.php @@ -1,7 +1,7 @@ Date: Wed, 20 Nov 2024 20:28:05 +0100 Subject: [PATCH 15/85] delete earth timezones --- CHANGELOG.md | 1 + src/Earth/Timezone.php | 51 --------- src/Earth/Timezone/Africa/Abidjan.php | 17 --- src/Earth/Timezone/Africa/Accra.php | 17 --- src/Earth/Timezone/Africa/AddisAbaba.php | 17 --- src/Earth/Timezone/Africa/Algiers.php | 17 --- src/Earth/Timezone/Africa/Asmara.php | 17 --- src/Earth/Timezone/Africa/Asmera.php | 17 --- src/Earth/Timezone/Africa/Bamako.php | 17 --- src/Earth/Timezone/Africa/Bangui.php | 17 --- src/Earth/Timezone/Africa/Banjul.php | 17 --- src/Earth/Timezone/Africa/Bissau.php | 17 --- src/Earth/Timezone/Africa/Blantyre.php | 17 --- src/Earth/Timezone/Africa/Brazzaville.php | 17 --- src/Earth/Timezone/Africa/Bujumbura.php | 17 --- src/Earth/Timezone/Africa/Cairo.php | 17 --- src/Earth/Timezone/Africa/Casablanca.php | 17 --- src/Earth/Timezone/Africa/Ceuta.php | 17 --- src/Earth/Timezone/Africa/Conakry.php | 17 --- src/Earth/Timezone/Africa/Dakar.php | 17 --- src/Earth/Timezone/Africa/DarEsSalaam.php | 17 --- src/Earth/Timezone/Africa/Djibouti.php | 17 --- src/Earth/Timezone/Africa/Douala.php | 17 --- src/Earth/Timezone/Africa/ElAaiun.php | 17 --- src/Earth/Timezone/Africa/Freetown.php | 17 --- src/Earth/Timezone/Africa/Gaborone.php | 17 --- src/Earth/Timezone/Africa/Harare.php | 17 --- src/Earth/Timezone/Africa/Johannesburg.php | 17 --- src/Earth/Timezone/Africa/Juba.php | 17 --- src/Earth/Timezone/Africa/Kampala.php | 17 --- src/Earth/Timezone/Africa/Khartoum.php | 17 --- src/Earth/Timezone/Africa/Kigali.php | 17 --- src/Earth/Timezone/Africa/Kinshasa.php | 17 --- src/Earth/Timezone/Africa/Lagos.php | 17 --- src/Earth/Timezone/Africa/Libreville.php | 17 --- src/Earth/Timezone/Africa/Lome.php | 17 --- src/Earth/Timezone/Africa/Luanda.php | 17 --- src/Earth/Timezone/Africa/Lubumbashi.php | 17 --- src/Earth/Timezone/Africa/Lusaka.php | 17 --- src/Earth/Timezone/Africa/Malabo.php | 17 --- src/Earth/Timezone/Africa/Maputo.php | 17 --- src/Earth/Timezone/Africa/Maseru.php | 17 --- src/Earth/Timezone/Africa/Mbabane.php | 17 --- src/Earth/Timezone/Africa/Mogadishu.php | 17 --- src/Earth/Timezone/Africa/Monrovia.php | 17 --- src/Earth/Timezone/Africa/Nairobi.php | 17 --- src/Earth/Timezone/Africa/Ndjamena.php | 17 --- src/Earth/Timezone/Africa/Niamey.php | 17 --- src/Earth/Timezone/Africa/Nouakchott.php | 17 --- src/Earth/Timezone/Africa/Ouagadougou.php | 17 --- src/Earth/Timezone/Africa/PortoNovo.php | 17 --- src/Earth/Timezone/Africa/SaoTome.php | 17 --- src/Earth/Timezone/Africa/Timbuktu.php | 17 --- src/Earth/Timezone/Africa/Tripoli.php | 17 --- src/Earth/Timezone/Africa/Tunis.php | 17 --- src/Earth/Timezone/Africa/Windhoek.php | 17 --- src/Earth/Timezone/America/Adak.php | 17 --- src/Earth/Timezone/America/Anchorage.php | 17 --- src/Earth/Timezone/America/Anguilla.php | 17 --- src/Earth/Timezone/America/Antigua.php | 17 --- src/Earth/Timezone/America/Araguaina.php | 17 --- .../America/Argentina/BuenosAires.php | 17 --- .../Timezone/America/Argentina/Catamarca.php | 17 --- .../America/Argentina/ComodRivadavia.php | 17 --- .../Timezone/America/Argentina/Cordoba.php | 17 --- .../Timezone/America/Argentina/Jujuy.php | 17 --- .../Timezone/America/Argentina/LaRioja.php | 17 --- .../Timezone/America/Argentina/Mendoza.php | 17 --- .../America/Argentina/RioGallegos.php | 17 --- .../Timezone/America/Argentina/Salta.php | 17 --- .../Timezone/America/Argentina/SanJuan.php | 17 --- .../Timezone/America/Argentina/SanLuis.php | 17 --- .../Timezone/America/Argentina/Tucuman.php | 17 --- .../Timezone/America/Argentina/Ushuaia.php | 17 --- src/Earth/Timezone/America/Aruba.php | 17 --- src/Earth/Timezone/America/Asuncion.php | 17 --- src/Earth/Timezone/America/Atikokan.php | 17 --- src/Earth/Timezone/America/Atka.php | 17 --- src/Earth/Timezone/America/Bahia.php | 17 --- src/Earth/Timezone/America/BahiaBanderas.php | 17 --- src/Earth/Timezone/America/Barbados.php | 17 --- src/Earth/Timezone/America/Belem.php | 17 --- src/Earth/Timezone/America/Belize.php | 17 --- src/Earth/Timezone/America/BlancSablon.php | 17 --- src/Earth/Timezone/America/BoaVista.php | 17 --- src/Earth/Timezone/America/Bogota.php | 17 --- src/Earth/Timezone/America/Boise.php | 17 --- src/Earth/Timezone/America/CambridgeBay.php | 17 --- src/Earth/Timezone/America/CampoGrande.php | 17 --- src/Earth/Timezone/America/Cancun.php | 17 --- src/Earth/Timezone/America/Caracas.php | 17 --- src/Earth/Timezone/America/Catamarca.php | 17 --- src/Earth/Timezone/America/Cayenne.php | 17 --- src/Earth/Timezone/America/Cayman.php | 17 --- src/Earth/Timezone/America/Chicago.php | 17 --- src/Earth/Timezone/America/Chihuahua.php | 17 --- src/Earth/Timezone/America/CoralHarbour.php | 17 --- src/Earth/Timezone/America/CostaRica.php | 17 --- src/Earth/Timezone/America/Creston.php | 17 --- src/Earth/Timezone/America/Cuiaba.php | 17 --- src/Earth/Timezone/America/Curacao.php | 17 --- src/Earth/Timezone/America/Danmarkshavn.php | 17 --- src/Earth/Timezone/America/Dawson.php | 17 --- src/Earth/Timezone/America/DawsonCreek.php | 17 --- src/Earth/Timezone/America/Denver.php | 17 --- src/Earth/Timezone/America/Detroit.php | 17 --- src/Earth/Timezone/America/Dominica.php | 17 --- src/Earth/Timezone/America/Edmonton.php | 17 --- src/Earth/Timezone/America/Eirunepe.php | 17 --- src/Earth/Timezone/America/ElSalvador.php | 17 --- src/Earth/Timezone/America/Ensenada.php | 17 --- src/Earth/Timezone/America/FortWayne.php | 17 --- src/Earth/Timezone/America/Fortaleza.php | 17 --- src/Earth/Timezone/America/GlaceBay.php | 17 --- src/Earth/Timezone/America/Godthab.php | 17 --- src/Earth/Timezone/America/GooseBay.php | 17 --- src/Earth/Timezone/America/GrandTurk.php | 17 --- src/Earth/Timezone/America/Grenada.php | 17 --- src/Earth/Timezone/America/Guadeloupe.php | 17 --- src/Earth/Timezone/America/Guatemala.php | 17 --- src/Earth/Timezone/America/Guayaquil.php | 17 --- src/Earth/Timezone/America/Guyana.php | 17 --- src/Earth/Timezone/America/Halifax.php | 17 --- src/Earth/Timezone/America/Havana.php | 17 --- src/Earth/Timezone/America/Hermosillo.php | 17 --- .../Timezone/America/Indiana/Indianapolis.php | 17 --- src/Earth/Timezone/America/Indiana/Knox.php | 17 --- .../Timezone/America/Indiana/Marengo.php | 17 --- .../Timezone/America/Indiana/Petersburg.php | 17 --- .../Timezone/America/Indiana/TellCity.php | 17 --- src/Earth/Timezone/America/Indiana/Vevay.php | 17 --- .../Timezone/America/Indiana/Vincennes.php | 17 --- .../Timezone/America/Indiana/Winamac.php | 17 --- src/Earth/Timezone/America/Inuvik.php | 17 --- src/Earth/Timezone/America/Iqaluit.php | 17 --- src/Earth/Timezone/America/Jamaica.php | 17 --- src/Earth/Timezone/America/Juneau.php | 17 --- src/Earth/Timezone/America/Kralendijk.php | 17 --- src/Earth/Timezone/America/LaPaz.php | 17 --- src/Earth/Timezone/America/Lima.php | 17 --- src/Earth/Timezone/America/LosAngeles.php | 17 --- src/Earth/Timezone/America/Louisville.php | 17 --- src/Earth/Timezone/America/LowerPrinces.php | 17 --- src/Earth/Timezone/America/Maceio.php | 17 --- src/Earth/Timezone/America/Managua.php | 17 --- src/Earth/Timezone/America/Manaus.php | 17 --- src/Earth/Timezone/America/Marigot.php | 17 --- src/Earth/Timezone/America/Martinique.php | 17 --- src/Earth/Timezone/America/Matamoros.php | 17 --- src/Earth/Timezone/America/Mazatlan.php | 17 --- src/Earth/Timezone/America/Menominee.php | 17 --- src/Earth/Timezone/America/Merida.php | 17 --- src/Earth/Timezone/America/Metlakatla.php | 17 --- src/Earth/Timezone/America/MexicoCity.php | 17 --- src/Earth/Timezone/America/Miquelon.php | 17 --- src/Earth/Timezone/America/Moncton.php | 17 --- src/Earth/Timezone/America/Monterrey.php | 17 --- src/Earth/Timezone/America/Montevideo.php | 17 --- src/Earth/Timezone/America/Monticello.php | 17 --- src/Earth/Timezone/America/Montreal.php | 17 --- src/Earth/Timezone/America/Montserrat.php | 17 --- src/Earth/Timezone/America/Nassau.php | 17 --- src/Earth/Timezone/America/NewYork.php | 17 --- src/Earth/Timezone/America/Nipigon.php | 17 --- src/Earth/Timezone/America/Nome.php | 17 --- src/Earth/Timezone/America/Noronha.php | 17 --- .../Timezone/America/NorthDakota/Beulah.php | 17 --- .../Timezone/America/NorthDakota/Center.php | 17 --- .../Timezone/America/NorthDakota/NewSalem.php | 17 --- src/Earth/Timezone/America/Ojinaga.php | 17 --- src/Earth/Timezone/America/Panama.php | 17 --- src/Earth/Timezone/America/Pangnirtung.php | 17 --- src/Earth/Timezone/America/Paramaribo.php | 17 --- src/Earth/Timezone/America/Phoenix.php | 17 --- src/Earth/Timezone/America/PortAuPrince.php | 17 --- src/Earth/Timezone/America/PortOfSpain.php | 17 --- src/Earth/Timezone/America/PortoAcre.php | 17 --- src/Earth/Timezone/America/PortoVelho.php | 17 --- src/Earth/Timezone/America/PuertoRico.php | 17 --- src/Earth/Timezone/America/RainyRiver.php | 17 --- src/Earth/Timezone/America/RankinInlet.php | 17 --- src/Earth/Timezone/America/Recife.php | 17 --- src/Earth/Timezone/America/Regina.php | 17 --- src/Earth/Timezone/America/Resolute.php | 17 --- src/Earth/Timezone/America/RioBranco.php | 17 --- src/Earth/Timezone/America/Rosario.php | 17 --- .../Timezone/America/SaintBarthelemy.php | 17 --- src/Earth/Timezone/America/SaintJohns.php | 17 --- src/Earth/Timezone/America/SaintKitts.php | 17 --- src/Earth/Timezone/America/SaintLucia.php | 17 --- src/Earth/Timezone/America/SaintThomas.php | 17 --- src/Earth/Timezone/America/SaintVincent.php | 17 --- src/Earth/Timezone/America/SantaIsabel.php | 17 --- src/Earth/Timezone/America/Santarem.php | 17 --- src/Earth/Timezone/America/Santiago.php | 17 --- src/Earth/Timezone/America/SantoDomingo.php | 18 --- src/Earth/Timezone/America/SaoPaulo.php | 17 --- src/Earth/Timezone/America/Scoresbysund.php | 17 --- src/Earth/Timezone/America/Shiprock.php | 17 --- src/Earth/Timezone/America/Sitka.php | 17 --- src/Earth/Timezone/America/SwiftCurrent.php | 17 --- src/Earth/Timezone/America/Tegucigalpa.php | 17 --- src/Earth/Timezone/America/Thule.php | 17 --- src/Earth/Timezone/America/ThunderBay.php | 17 --- src/Earth/Timezone/America/Tijuana.php | 17 --- src/Earth/Timezone/America/Toronto.php | 17 --- src/Earth/Timezone/America/Tortola.php | 17 --- src/Earth/Timezone/America/Vancouver.php | 17 --- src/Earth/Timezone/America/Virgin.php | 17 --- src/Earth/Timezone/America/Whitehorse.php | 17 --- src/Earth/Timezone/America/Winnipeg.php | 17 --- src/Earth/Timezone/America/Yakutat.php | 17 --- src/Earth/Timezone/America/Yellowknife.php | 17 --- src/Earth/Timezone/Antarctica/Casey.php | 17 --- src/Earth/Timezone/Antarctica/Davis.php | 17 --- .../Timezone/Antarctica/DumontDUrville.php | 17 --- src/Earth/Timezone/Antarctica/Macquarie.php | 17 --- src/Earth/Timezone/Antarctica/Mawson.php | 17 --- src/Earth/Timezone/Antarctica/McMurdo.php | 17 --- src/Earth/Timezone/Antarctica/Palmer.php | 17 --- src/Earth/Timezone/Antarctica/Rothera.php | 17 --- src/Earth/Timezone/Antarctica/SouthPole.php | 17 --- src/Earth/Timezone/Antarctica/Syowa.php | 17 --- src/Earth/Timezone/Antarctica/Troll.php | 17 --- src/Earth/Timezone/Antarctica/Vostok.php | 17 --- src/Earth/Timezone/Arctic/Longyearbyen.php | 17 --- src/Earth/Timezone/Asia/Aden.php | 17 --- src/Earth/Timezone/Asia/Almaty.php | 17 --- src/Earth/Timezone/Asia/Amman.php | 17 --- src/Earth/Timezone/Asia/Anadyr.php | 17 --- src/Earth/Timezone/Asia/Aqtau.php | 17 --- src/Earth/Timezone/Asia/Aqtobe.php | 17 --- src/Earth/Timezone/Asia/Ashgabat.php | 17 --- src/Earth/Timezone/Asia/Ashkhabad.php | 17 --- src/Earth/Timezone/Asia/Baghdad.php | 17 --- src/Earth/Timezone/Asia/Bahrain.php | 17 --- src/Earth/Timezone/Asia/Baku.php | 17 --- src/Earth/Timezone/Asia/Bangkok.php | 17 --- src/Earth/Timezone/Asia/Beirut.php | 17 --- src/Earth/Timezone/Asia/Bishkek.php | 17 --- src/Earth/Timezone/Asia/Brunei.php | 17 --- src/Earth/Timezone/Asia/Calcutta.php | 17 --- src/Earth/Timezone/Asia/Chita.php | 17 --- src/Earth/Timezone/Asia/Choibalsan.php | 17 --- src/Earth/Timezone/Asia/Chongqing.php | 17 --- src/Earth/Timezone/Asia/Chungking.php | 17 --- src/Earth/Timezone/Asia/Colombo.php | 17 --- src/Earth/Timezone/Asia/Dacca.php | 17 --- src/Earth/Timezone/Asia/Damascus.php | 17 --- src/Earth/Timezone/Asia/Dhaka.php | 17 --- src/Earth/Timezone/Asia/Dili.php | 17 --- src/Earth/Timezone/Asia/Dubai.php | 17 --- src/Earth/Timezone/Asia/Dushanbe.php | 17 --- src/Earth/Timezone/Asia/Gaza.php | 17 --- src/Earth/Timezone/Asia/Harbin.php | 17 --- src/Earth/Timezone/Asia/Hebron.php | 17 --- src/Earth/Timezone/Asia/HoChiMinh.php | 17 --- src/Earth/Timezone/Asia/HongKong.php | 17 --- src/Earth/Timezone/Asia/Hovd.php | 17 --- src/Earth/Timezone/Asia/Irkutsk.php | 17 --- src/Earth/Timezone/Asia/Istanbul.php | 17 --- src/Earth/Timezone/Asia/Jakarta.php | 17 --- src/Earth/Timezone/Asia/Jayapura.php | 17 --- src/Earth/Timezone/Asia/Jerusalem.php | 17 --- src/Earth/Timezone/Asia/Kabul.php | 17 --- src/Earth/Timezone/Asia/Kamchatka.php | 17 --- src/Earth/Timezone/Asia/Karachi.php | 17 --- src/Earth/Timezone/Asia/Kathmandu.php | 17 --- src/Earth/Timezone/Asia/Katmandu.php | 17 --- src/Earth/Timezone/Asia/Khandyga.php | 17 --- src/Earth/Timezone/Asia/Kolkata.php | 17 --- src/Earth/Timezone/Asia/Krasnoyarsk.php | 17 --- src/Earth/Timezone/Asia/KualaLumpur.php | 17 --- src/Earth/Timezone/Asia/Kuching.php | 17 --- src/Earth/Timezone/Asia/Kuwait.php | 17 --- src/Earth/Timezone/Asia/Macao.php | 17 --- src/Earth/Timezone/Asia/Macau.php | 17 --- src/Earth/Timezone/Asia/Magadan.php | 17 --- src/Earth/Timezone/Asia/Makassar.php | 17 --- src/Earth/Timezone/Asia/Manila.php | 17 --- src/Earth/Timezone/Asia/Muscat.php | 17 --- src/Earth/Timezone/Asia/Nicosia.php | 17 --- src/Earth/Timezone/Asia/Novokuznetsk.php | 17 --- src/Earth/Timezone/Asia/Novosibirsk.php | 17 --- src/Earth/Timezone/Asia/Omsk.php | 17 --- src/Earth/Timezone/Asia/Oral.php | 17 --- src/Earth/Timezone/Asia/PhnomPenh.php | 17 --- src/Earth/Timezone/Asia/Pontianak.php | 17 --- src/Earth/Timezone/Asia/Pyongyang.php | 17 --- src/Earth/Timezone/Asia/Qatar.php | 17 --- src/Earth/Timezone/Asia/Qyzylorda.php | 17 --- src/Earth/Timezone/Asia/Rangoon.php | 17 --- src/Earth/Timezone/Asia/Riyadh.php | 17 --- src/Earth/Timezone/Asia/Saigon.php | 17 --- src/Earth/Timezone/Asia/Sakhalin.php | 17 --- src/Earth/Timezone/Asia/Samarkand.php | 17 --- src/Earth/Timezone/Asia/Seoul.php | 17 --- src/Earth/Timezone/Asia/Shanghai.php | 17 --- src/Earth/Timezone/Asia/Singapore.php | 17 --- src/Earth/Timezone/Asia/Srednekolymsk.php | 17 --- src/Earth/Timezone/Asia/Taipei.php | 17 --- src/Earth/Timezone/Asia/Tashkent.php | 17 --- src/Earth/Timezone/Asia/Tbilisi.php | 17 --- src/Earth/Timezone/Asia/Tehran.php | 17 --- src/Earth/Timezone/Asia/TelAviv.php | 17 --- src/Earth/Timezone/Asia/Thimbu.php | 17 --- src/Earth/Timezone/Asia/Thimphu.php | 17 --- src/Earth/Timezone/Asia/Tokyo.php | 17 --- src/Earth/Timezone/Asia/UjungPandang.php | 17 --- src/Earth/Timezone/Asia/Ulaanbaatar.php | 17 --- src/Earth/Timezone/Asia/UlanBator.php | 17 --- src/Earth/Timezone/Asia/UstNera.php | 17 --- src/Earth/Timezone/Asia/Vientiane.php | 17 --- src/Earth/Timezone/Asia/Vladivostok.php | 17 --- src/Earth/Timezone/Asia/Yakutsk.php | 17 --- src/Earth/Timezone/Asia/Yekaterinburg.php | 17 --- src/Earth/Timezone/Asia/Yerevan.php | 17 --- src/Earth/Timezone/Atlantic/Azores.php | 17 --- src/Earth/Timezone/Atlantic/Bermuda.php | 17 --- src/Earth/Timezone/Atlantic/Canary.php | 17 --- src/Earth/Timezone/Atlantic/CapeVerde.php | 17 --- src/Earth/Timezone/Atlantic/Faeroe.php | 17 --- src/Earth/Timezone/Atlantic/Faroe.php | 17 --- src/Earth/Timezone/Atlantic/JanMayen.php | 17 --- src/Earth/Timezone/Atlantic/Madeira.php | 17 --- src/Earth/Timezone/Atlantic/Reykjavik.php | 17 --- src/Earth/Timezone/Atlantic/SaintHelena.php | 17 --- src/Earth/Timezone/Atlantic/SouthGeorgia.php | 17 --- src/Earth/Timezone/Atlantic/Stanley.php | 17 --- src/Earth/Timezone/Australia/Adelaide.php | 17 --- .../Australia/AustralianCapitalTerritory.php | 17 --- src/Earth/Timezone/Australia/Brisbane.php | 17 --- src/Earth/Timezone/Australia/BrokenHill.php | 17 --- src/Earth/Timezone/Australia/Canberra.php | 17 --- src/Earth/Timezone/Australia/Currie.php | 17 --- src/Earth/Timezone/Australia/Darwin.php | 17 --- src/Earth/Timezone/Australia/Eucla.php | 17 --- src/Earth/Timezone/Australia/Hobart.php | 17 --- src/Earth/Timezone/Australia/Lindeman.php | 17 --- .../Timezone/Australia/LordeHoweIsland.php | 17 --- src/Earth/Timezone/Australia/Melbourne.php | 17 --- .../Timezone/Australia/NewSouthWales.php | 17 --- src/Earth/Timezone/Australia/North.php | 17 --- src/Earth/Timezone/Australia/Perth.php | 17 --- src/Earth/Timezone/Australia/Queensland.php | 17 --- src/Earth/Timezone/Australia/South.php | 17 --- src/Earth/Timezone/Australia/Sydney.php | 17 --- src/Earth/Timezone/Australia/Tasmania.php | 17 --- src/Earth/Timezone/Australia/Victoria.php | 17 --- src/Earth/Timezone/Australia/West.php | 17 --- src/Earth/Timezone/Australia/Yancowinna.php | 17 --- src/Earth/Timezone/Europe/Amsterdam.php | 17 --- src/Earth/Timezone/Europe/Andorra.php | 17 --- src/Earth/Timezone/Europe/Athens.php | 17 --- src/Earth/Timezone/Europe/Belfast.php | 17 --- src/Earth/Timezone/Europe/Belgrade.php | 17 --- src/Earth/Timezone/Europe/Berlin.php | 17 --- src/Earth/Timezone/Europe/Bratislava.php | 17 --- src/Earth/Timezone/Europe/Brussels.php | 17 --- src/Earth/Timezone/Europe/Bucharest.php | 17 --- src/Earth/Timezone/Europe/Budapest.php | 17 --- src/Earth/Timezone/Europe/Busingen.php | 17 --- src/Earth/Timezone/Europe/Chisinau.php | 17 --- src/Earth/Timezone/Europe/Copenhagen.php | 17 --- src/Earth/Timezone/Europe/Dublin.php | 17 --- src/Earth/Timezone/Europe/Gibraltar.php | 17 --- src/Earth/Timezone/Europe/Guernsey.php | 17 --- src/Earth/Timezone/Europe/Helsinki.php | 17 --- src/Earth/Timezone/Europe/IsleOfMan.php | 17 --- src/Earth/Timezone/Europe/Istanbul.php | 17 --- src/Earth/Timezone/Europe/Jersey.php | 17 --- src/Earth/Timezone/Europe/Kaliningrad.php | 17 --- src/Earth/Timezone/Europe/Kiev.php | 17 --- src/Earth/Timezone/Europe/Lisbon.php | 17 --- src/Earth/Timezone/Europe/Ljubljana.php | 17 --- src/Earth/Timezone/Europe/London.php | 17 --- src/Earth/Timezone/Europe/Luxembourg.php | 17 --- src/Earth/Timezone/Europe/Madrid.php | 17 --- src/Earth/Timezone/Europe/Malta.php | 17 --- src/Earth/Timezone/Europe/Mariehamn.php | 17 --- src/Earth/Timezone/Europe/Minsk.php | 17 --- src/Earth/Timezone/Europe/Monaco.php | 17 --- src/Earth/Timezone/Europe/Moscow.php | 17 --- src/Earth/Timezone/Europe/Nicosia.php | 17 --- src/Earth/Timezone/Europe/Oslo.php | 17 --- src/Earth/Timezone/Europe/Paris.php | 17 --- src/Earth/Timezone/Europe/Podgorica.php | 17 --- src/Earth/Timezone/Europe/Prague.php | 17 --- src/Earth/Timezone/Europe/Riga.php | 17 --- src/Earth/Timezone/Europe/Rome.php | 17 --- src/Earth/Timezone/Europe/Samara.php | 17 --- src/Earth/Timezone/Europe/SanMarino.php | 17 --- src/Earth/Timezone/Europe/Sarajevo.php | 17 --- src/Earth/Timezone/Europe/Simferopol.php | 17 --- src/Earth/Timezone/Europe/Skopje.php | 17 --- src/Earth/Timezone/Europe/Sofia.php | 17 --- src/Earth/Timezone/Europe/Stockholm.php | 17 --- src/Earth/Timezone/Europe/Tallinn.php | 17 --- src/Earth/Timezone/Europe/Tirane.php | 17 --- src/Earth/Timezone/Europe/Tiraspol.php | 17 --- src/Earth/Timezone/Europe/Uzhgorod.php | 17 --- src/Earth/Timezone/Europe/Vaduz.php | 17 --- src/Earth/Timezone/Europe/Vatican.php | 17 --- src/Earth/Timezone/Europe/Vienna.php | 17 --- src/Earth/Timezone/Europe/Vilnius.php | 17 --- src/Earth/Timezone/Europe/Volgograd.php | 17 --- src/Earth/Timezone/Europe/Warsaw.php | 17 --- src/Earth/Timezone/Europe/Zagreb.php | 17 --- src/Earth/Timezone/Europe/Zaporozhye.php | 17 --- src/Earth/Timezone/Europe/Zurich.php | 17 --- src/Earth/Timezone/Indian/Antananarivo.php | 17 --- src/Earth/Timezone/Indian/Chagos.php | 17 --- src/Earth/Timezone/Indian/Christmas.php | 17 --- src/Earth/Timezone/Indian/Cocos.php | 17 --- src/Earth/Timezone/Indian/Comoro.php | 17 --- src/Earth/Timezone/Indian/Kerguelen.php | 17 --- src/Earth/Timezone/Indian/Mahe.php | 17 --- src/Earth/Timezone/Indian/Maldives.php | 17 --- src/Earth/Timezone/Indian/Mauritius.php | 17 --- src/Earth/Timezone/Indian/Mayotte.php | 17 --- src/Earth/Timezone/Indian/Reunion.php | 17 --- src/Earth/Timezone/Pacific/Apia.php | 17 --- src/Earth/Timezone/Pacific/Auckland.php | 17 --- src/Earth/Timezone/Pacific/Bougainville.php | 17 --- src/Earth/Timezone/Pacific/Chatham.php | 17 --- src/Earth/Timezone/Pacific/Chuuk.php | 17 --- src/Earth/Timezone/Pacific/Easter.php | 17 --- src/Earth/Timezone/Pacific/Efate.php | 17 --- src/Earth/Timezone/Pacific/Enderbury.php | 17 --- src/Earth/Timezone/Pacific/Fakaofo.php | 17 --- src/Earth/Timezone/Pacific/Fiji.php | 17 --- src/Earth/Timezone/Pacific/Funafuti.php | 17 --- src/Earth/Timezone/Pacific/Galapagos.php | 17 --- src/Earth/Timezone/Pacific/Gambier.php | 17 --- src/Earth/Timezone/Pacific/Guadalcanal.php | 17 --- src/Earth/Timezone/Pacific/Guam.php | 17 --- src/Earth/Timezone/Pacific/Honolulu.php | 17 --- src/Earth/Timezone/Pacific/Johnston.php | 17 --- src/Earth/Timezone/Pacific/Kiritimati.php | 17 --- src/Earth/Timezone/Pacific/Kosrae.php | 17 --- src/Earth/Timezone/Pacific/Kwajalein.php | 17 --- src/Earth/Timezone/Pacific/Majuro.php | 17 --- src/Earth/Timezone/Pacific/Marquesas.php | 17 --- src/Earth/Timezone/Pacific/Midway.php | 17 --- src/Earth/Timezone/Pacific/Nauru.php | 17 --- src/Earth/Timezone/Pacific/Niue.php | 17 --- src/Earth/Timezone/Pacific/Norfolk.php | 17 --- src/Earth/Timezone/Pacific/Noumea.php | 17 --- src/Earth/Timezone/Pacific/PagoPago.php | 17 --- src/Earth/Timezone/Pacific/Palau.php | 17 --- src/Earth/Timezone/Pacific/Pitcairn.php | 17 --- src/Earth/Timezone/Pacific/Pohnpei.php | 17 --- src/Earth/Timezone/Pacific/Ponape.php | 17 --- src/Earth/Timezone/Pacific/PortMoresby.php | 17 --- src/Earth/Timezone/Pacific/Rarotonga.php | 17 --- src/Earth/Timezone/Pacific/Saipan.php | 17 --- src/Earth/Timezone/Pacific/Tahiti.php | 17 --- src/Earth/Timezone/Pacific/Tarawa.php | 17 --- src/Earth/Timezone/Pacific/Tongatapu.php | 17 --- src/Earth/Timezone/Pacific/Truk.php | 17 --- src/Earth/Timezone/Pacific/Wake.php | 17 --- src/Earth/Timezone/Pacific/Wallis.php | 17 --- src/Earth/Timezone/Pacific/Yap.php | 17 --- src/Earth/Timezone/UTC.php | 100 ----------------- tests/Earth/Timezone/Africa/AbidjanTest.php | 20 ---- tests/Earth/Timezone/Africa/AccraTest.php | 20 ---- .../Earth/Timezone/Africa/AddisAbabaTest.php | 20 ---- tests/Earth/Timezone/Africa/AlgiersTest.php | 20 ---- tests/Earth/Timezone/Africa/AsmaraTest.php | 20 ---- tests/Earth/Timezone/Africa/AsmeraTest.php | 20 ---- tests/Earth/Timezone/Africa/BamakoTest.php | 20 ---- tests/Earth/Timezone/Africa/BanguiTest.php | 20 ---- tests/Earth/Timezone/Africa/BanjulTest.php | 20 ---- tests/Earth/Timezone/Africa/BissauTest.php | 20 ---- tests/Earth/Timezone/Africa/BlantyreTest.php | 20 ---- .../Earth/Timezone/Africa/BrazzavilleTest.php | 20 ---- tests/Earth/Timezone/Africa/BujumburaTest.php | 20 ---- tests/Earth/Timezone/Africa/CairoTest.php | 20 ---- .../Earth/Timezone/Africa/CasablancaTest.php | 20 ---- tests/Earth/Timezone/Africa/CeutaTest.php | 20 ---- tests/Earth/Timezone/Africa/ConakryTest.php | 20 ---- tests/Earth/Timezone/Africa/DakarTest.php | 20 ---- .../Earth/Timezone/Africa/DarEsSalaamTest.php | 20 ---- tests/Earth/Timezone/Africa/DjiboutiTest.php | 20 ---- tests/Earth/Timezone/Africa/DoualaTest.php | 20 ---- tests/Earth/Timezone/Africa/ElAaiunTest.php | 20 ---- tests/Earth/Timezone/Africa/FreetownTest.php | 20 ---- tests/Earth/Timezone/Africa/GaboroneTest.php | 20 ---- tests/Earth/Timezone/Africa/HarareTest.php | 20 ---- .../Timezone/Africa/JohannesburgTest.php | 20 ---- tests/Earth/Timezone/Africa/JubaTest.php | 20 ---- tests/Earth/Timezone/Africa/KampalaTest.php | 20 ---- tests/Earth/Timezone/Africa/KhartoumTest.php | 20 ---- tests/Earth/Timezone/Africa/KigaliTest.php | 20 ---- tests/Earth/Timezone/Africa/KinshasaTest.php | 20 ---- tests/Earth/Timezone/Africa/LagosTest.php | 20 ---- .../Earth/Timezone/Africa/LibrevilleTest.php | 20 ---- tests/Earth/Timezone/Africa/LomeTest.php | 20 ---- tests/Earth/Timezone/Africa/LuandaTest.php | 20 ---- .../Earth/Timezone/Africa/LubumbashiTest.php | 20 ---- tests/Earth/Timezone/Africa/LusakaTest.php | 20 ---- tests/Earth/Timezone/Africa/MalaboTest.php | 20 ---- tests/Earth/Timezone/Africa/MaputoTest.php | 20 ---- tests/Earth/Timezone/Africa/MaseruTest.php | 20 ---- tests/Earth/Timezone/Africa/MbabaneTest.php | 20 ---- tests/Earth/Timezone/Africa/MogadishuTest.php | 20 ---- tests/Earth/Timezone/Africa/MonroviaTest.php | 20 ---- tests/Earth/Timezone/Africa/NairobiTest.php | 20 ---- tests/Earth/Timezone/Africa/NdjamenaTest.php | 20 ---- tests/Earth/Timezone/Africa/NiameyTest.php | 20 ---- .../Earth/Timezone/Africa/NouakchottTest.php | 20 ---- .../Earth/Timezone/Africa/OuagadougouTest.php | 20 ---- tests/Earth/Timezone/Africa/PortoNovoTest.php | 20 ---- tests/Earth/Timezone/Africa/SaoTomeTest.php | 20 ---- tests/Earth/Timezone/Africa/TimbuktuTest.php | 20 ---- tests/Earth/Timezone/Africa/TripoliTest.php | 20 ---- tests/Earth/Timezone/Africa/TunisTest.php | 20 ---- tests/Earth/Timezone/Africa/WindhoekTest.php | 20 ---- tests/Earth/Timezone/America/AdakTest.php | 20 ---- .../Earth/Timezone/America/AnchorageTest.php | 20 ---- tests/Earth/Timezone/America/AnguillaTest.php | 20 ---- tests/Earth/Timezone/America/AntiguaTest.php | 20 ---- .../Earth/Timezone/America/AraguainaTest.php | 20 ---- .../America/Argentina/BuenosAiresTest.php | 20 ---- .../America/Argentina/CatamarcaTest.php | 20 ---- .../America/Argentina/ComodRivadaviaTest.php | 20 ---- .../America/Argentina/CordobaTest.php | 20 ---- .../Timezone/America/Argentina/JujuyTest.php | 20 ---- .../America/Argentina/LaRiojaTest.php | 20 ---- .../America/Argentina/MendozaTest.php | 20 ---- .../America/Argentina/RioGallegosTest.php | 20 ---- .../Timezone/America/Argentina/SaltaTest.php | 20 ---- .../America/Argentina/SanJuanTest.php | 20 ---- .../America/Argentina/SanLuisTest.php | 20 ---- .../America/Argentina/TucumanTest.php | 20 ---- .../America/Argentina/UshuaiaTest.php | 20 ---- tests/Earth/Timezone/America/ArubaTest.php | 20 ---- tests/Earth/Timezone/America/AsuncionTest.php | 20 ---- tests/Earth/Timezone/America/AtikokanTest.php | 20 ---- tests/Earth/Timezone/America/AtkaTest.php | 20 ---- .../Timezone/America/BahiaBanderasTest.php | 20 ---- tests/Earth/Timezone/America/BahiaTest.php | 20 ---- tests/Earth/Timezone/America/BarbadosTest.php | 20 ---- tests/Earth/Timezone/America/BelemTest.php | 20 ---- tests/Earth/Timezone/America/BelizeTest.php | 20 ---- .../Timezone/America/BlancSablonTest.php | 20 ---- tests/Earth/Timezone/America/BoaVistaTest.php | 20 ---- tests/Earth/Timezone/America/BogotaTest.php | 20 ---- tests/Earth/Timezone/America/BoiseTest.php | 20 ---- .../Timezone/America/CambridgeBayTest.php | 20 ---- .../Timezone/America/CampoGrandeTest.php | 20 ---- tests/Earth/Timezone/America/CancunTest.php | 20 ---- tests/Earth/Timezone/America/CaracasTest.php | 20 ---- .../Earth/Timezone/America/CatamarcaTest.php | 20 ---- tests/Earth/Timezone/America/CayenneTest.php | 20 ---- tests/Earth/Timezone/America/CaymanTest.php | 20 ---- tests/Earth/Timezone/America/ChicagoTest.php | 20 ---- .../Earth/Timezone/America/ChihuahuaTest.php | 20 ---- .../Timezone/America/CoralHarbourTest.php | 20 ---- .../Earth/Timezone/America/CostaRicaTest.php | 20 ---- tests/Earth/Timezone/America/CrestonTest.php | 20 ---- tests/Earth/Timezone/America/CuiabaTest.php | 20 ---- tests/Earth/Timezone/America/CuracaoTest.php | 20 ---- .../Timezone/America/DanmarkshavnTest.php | 20 ---- .../Timezone/America/DawsonCreekTest.php | 20 ---- tests/Earth/Timezone/America/DawsonTest.php | 20 ---- tests/Earth/Timezone/America/DenverTest.php | 20 ---- tests/Earth/Timezone/America/DetroitTest.php | 20 ---- tests/Earth/Timezone/America/DominicaTest.php | 20 ---- tests/Earth/Timezone/America/EdmontonTest.php | 20 ---- tests/Earth/Timezone/America/EirunepeTest.php | 20 ---- .../Earth/Timezone/America/ElSalvadorTest.php | 20 ---- tests/Earth/Timezone/America/EnsenadaTest.php | 20 ---- .../Earth/Timezone/America/FortWayneTest.php | 20 ---- .../Earth/Timezone/America/FortalezaTest.php | 20 ---- tests/Earth/Timezone/America/GlaceBayTest.php | 20 ---- tests/Earth/Timezone/America/GodthabTest.php | 20 ---- tests/Earth/Timezone/America/GooseBayTest.php | 20 ---- .../Earth/Timezone/America/GrandTurkTest.php | 20 ---- tests/Earth/Timezone/America/GrenadaTest.php | 20 ---- .../Earth/Timezone/America/GuadeloupeTest.php | 20 ---- .../Earth/Timezone/America/GuatemalaTest.php | 20 ---- .../Earth/Timezone/America/GuayaquilTest.php | 20 ---- tests/Earth/Timezone/America/GuyanaTest.php | 20 ---- tests/Earth/Timezone/America/HalifaxTest.php | 20 ---- tests/Earth/Timezone/America/HavanaTest.php | 20 ---- .../Earth/Timezone/America/HermosilloTest.php | 20 ---- .../America/Indiana/IndianapolisTest.php | 20 ---- .../Timezone/America/Indiana/KnoxTest.php | 20 ---- .../Timezone/America/Indiana/MarengoTest.php | 20 ---- .../America/Indiana/PetersburgTest.php | 20 ---- .../Timezone/America/Indiana/TellCityTest.php | 20 ---- .../Timezone/America/Indiana/VevayTest.php | 20 ---- .../America/Indiana/VincennesTest.php | 20 ---- .../Timezone/America/Indiana/WinamacTest.php | 20 ---- tests/Earth/Timezone/America/InuvikTest.php | 20 ---- tests/Earth/Timezone/America/IqaluitTest.php | 20 ---- tests/Earth/Timezone/America/JamaicaTest.php | 20 ---- tests/Earth/Timezone/America/JuneauTest.php | 20 ---- .../Earth/Timezone/America/KralendijkTest.php | 20 ---- tests/Earth/Timezone/America/LaPazTest.php | 20 ---- tests/Earth/Timezone/America/LimaTest.php | 20 ---- .../Earth/Timezone/America/LosAngelesTest.php | 20 ---- .../Earth/Timezone/America/LouisvilleTest.php | 20 ---- .../Timezone/America/LowerPrincesTest.php | 20 ---- tests/Earth/Timezone/America/MaceioTest.php | 20 ---- tests/Earth/Timezone/America/ManaguaTest.php | 20 ---- tests/Earth/Timezone/America/ManausTest.php | 20 ---- tests/Earth/Timezone/America/MarigotTest.php | 20 ---- .../Earth/Timezone/America/MartiniqueTest.php | 20 ---- .../Earth/Timezone/America/MatamorosTest.php | 20 ---- tests/Earth/Timezone/America/MazatlanTest.php | 20 ---- .../Earth/Timezone/America/MenomineeTest.php | 20 ---- tests/Earth/Timezone/America/MeridaTest.php | 20 ---- .../Earth/Timezone/America/MetlakatlaTest.php | 20 ---- .../Earth/Timezone/America/MexicoCityTest.php | 20 ---- tests/Earth/Timezone/America/MiquelonTest.php | 20 ---- tests/Earth/Timezone/America/MonctonTest.php | 20 ---- .../Earth/Timezone/America/MonterreyTest.php | 20 ---- .../Earth/Timezone/America/MontevideoTest.php | 20 ---- .../Earth/Timezone/America/MonticelloTest.php | 20 ---- tests/Earth/Timezone/America/MontrealTest.php | 20 ---- .../Earth/Timezone/America/MontserratTest.php | 20 ---- tests/Earth/Timezone/America/NassauTest.php | 20 ---- tests/Earth/Timezone/America/NewYorkTest.php | 20 ---- tests/Earth/Timezone/America/NipigonTest.php | 20 ---- tests/Earth/Timezone/America/NomeTest.php | 20 ---- tests/Earth/Timezone/America/NoronhaTest.php | 20 ---- .../America/NorthDakota/BeulahTest.php | 20 ---- .../America/NorthDakota/CenterTest.php | 20 ---- .../America/NorthDakota/NewSalemTest.php | 20 ---- tests/Earth/Timezone/America/OjinagaTest.php | 20 ---- tests/Earth/Timezone/America/PanamaTest.php | 20 ---- .../Timezone/America/PangnirtungTest.php | 20 ---- .../Earth/Timezone/America/ParamariboTest.php | 20 ---- tests/Earth/Timezone/America/PhoenixTest.php | 20 ---- .../Timezone/America/PortAuPrinceTest.php | 20 ---- .../Timezone/America/PortOfSpainTest.php | 20 ---- .../Earth/Timezone/America/PortoAcreTest.php | 20 ---- .../Earth/Timezone/America/PortoVelhoTest.php | 20 ---- .../Earth/Timezone/America/PuertoRicoTest.php | 20 ---- .../Earth/Timezone/America/RainyRiverTest.php | 20 ---- .../Timezone/America/RankinInletTest.php | 20 ---- tests/Earth/Timezone/America/RecifeTest.php | 20 ---- tests/Earth/Timezone/America/ReginaTest.php | 20 ---- tests/Earth/Timezone/America/ResoluteTest.php | 20 ---- .../Earth/Timezone/America/RioBrancoTest.php | 20 ---- tests/Earth/Timezone/America/RosarioTest.php | 20 ---- .../Timezone/America/SaintBarthelemyTest.php | 20 ---- .../Earth/Timezone/America/SaintJohnsTest.php | 20 ---- .../Earth/Timezone/America/SaintKittsTest.php | 20 ---- .../Earth/Timezone/America/SaintLuciaTest.php | 20 ---- .../Timezone/America/SaintThomasTest.php | 20 ---- .../Timezone/America/SaintVincentTest.php | 20 ---- .../Timezone/America/SantaIsabelTest.php | 20 ---- tests/Earth/Timezone/America/SantaremTest.php | 20 ---- tests/Earth/Timezone/America/SantiagoTest.php | 20 ---- .../Timezone/America/SantoDomingoTest.php | 20 ---- tests/Earth/Timezone/America/SaoPauloTest.php | 20 ---- .../Timezone/America/ScoresbysundTest.php | 20 ---- tests/Earth/Timezone/America/ShiprockTest.php | 20 ---- tests/Earth/Timezone/America/SitkaTest.php | 20 ---- .../Timezone/America/SwiftCurrentTest.php | 20 ---- .../Timezone/America/TegucigalpaTest.php | 20 ---- tests/Earth/Timezone/America/ThuleTest.php | 20 ---- .../Earth/Timezone/America/ThunderBayTest.php | 20 ---- tests/Earth/Timezone/America/TijuanaTest.php | 20 ---- tests/Earth/Timezone/America/TorontoTest.php | 20 ---- tests/Earth/Timezone/America/TortolaTest.php | 20 ---- .../Earth/Timezone/America/VancouverTest.php | 20 ---- tests/Earth/Timezone/America/VirginTest.php | 20 ---- .../Earth/Timezone/America/WhitehorseTest.php | 20 ---- tests/Earth/Timezone/America/WinnipegTest.php | 20 ---- tests/Earth/Timezone/America/YakutatTest.php | 20 ---- .../Timezone/America/YellowknifeTest.php | 20 ---- tests/Earth/Timezone/Antarctica/CaseyTest.php | 20 ---- tests/Earth/Timezone/Antarctica/DavisTest.php | 20 ---- .../Antarctica/DumontDUrvilleTest.php | 20 ---- .../Timezone/Antarctica/MacquarieTest.php | 20 ---- .../Earth/Timezone/Antarctica/MawsonTest.php | 20 ---- .../Earth/Timezone/Antarctica/McMurdoTest.php | 20 ---- .../Earth/Timezone/Antarctica/PalmerTest.php | 20 ---- .../Earth/Timezone/Antarctica/RotheraTest.php | 20 ---- .../Timezone/Antarctica/SouthPoleTest.php | 20 ---- tests/Earth/Timezone/Antarctica/SyowaTest.php | 20 ---- tests/Earth/Timezone/Antarctica/TrollTest.php | 20 ---- .../Earth/Timezone/Antarctica/VostokTest.php | 20 ---- .../Timezone/Arctic/LongyearbyenTest.php | 20 ---- tests/Earth/Timezone/Asia/AdenTest.php | 20 ---- tests/Earth/Timezone/Asia/AlmatyTest.php | 20 ---- tests/Earth/Timezone/Asia/AmmanTest.php | 20 ---- tests/Earth/Timezone/Asia/AnadyrTest.php | 20 ---- tests/Earth/Timezone/Asia/AqtauTest.php | 20 ---- tests/Earth/Timezone/Asia/AqtobeTest.php | 20 ---- tests/Earth/Timezone/Asia/AshgabatTest.php | 20 ---- tests/Earth/Timezone/Asia/AshkhabadTest.php | 20 ---- tests/Earth/Timezone/Asia/BaghdadTest.php | 20 ---- tests/Earth/Timezone/Asia/BahrainTest.php | 20 ---- tests/Earth/Timezone/Asia/BakuTest.php | 20 ---- tests/Earth/Timezone/Asia/BangkokTest.php | 20 ---- tests/Earth/Timezone/Asia/BeirutTest.php | 20 ---- tests/Earth/Timezone/Asia/BishkekTest.php | 20 ---- tests/Earth/Timezone/Asia/BruneiTest.php | 20 ---- tests/Earth/Timezone/Asia/CalcuttaTest.php | 20 ---- tests/Earth/Timezone/Asia/ChitaTest.php | 20 ---- tests/Earth/Timezone/Asia/ChoibalsanTest.php | 20 ---- tests/Earth/Timezone/Asia/ChongqingTest.php | 20 ---- tests/Earth/Timezone/Asia/ChungkingTest.php | 20 ---- tests/Earth/Timezone/Asia/ColomboTest.php | 20 ---- tests/Earth/Timezone/Asia/DaccaTest.php | 20 ---- tests/Earth/Timezone/Asia/DamascusTest.php | 20 ---- tests/Earth/Timezone/Asia/DhakaTest.php | 20 ---- tests/Earth/Timezone/Asia/DiliTest.php | 20 ---- tests/Earth/Timezone/Asia/DubaiTest.php | 20 ---- tests/Earth/Timezone/Asia/DushanbeTest.php | 20 ---- tests/Earth/Timezone/Asia/GazaTest.php | 20 ---- tests/Earth/Timezone/Asia/HarbinTest.php | 20 ---- tests/Earth/Timezone/Asia/HebronTest.php | 20 ---- tests/Earth/Timezone/Asia/HoChiMinhTest.php | 20 ---- tests/Earth/Timezone/Asia/HongKongTest.php | 20 ---- tests/Earth/Timezone/Asia/HovdTest.php | 20 ---- tests/Earth/Timezone/Asia/IrkutskTest.php | 20 ---- tests/Earth/Timezone/Asia/IstanbulTest.php | 20 ---- tests/Earth/Timezone/Asia/JakartaTest.php | 20 ---- tests/Earth/Timezone/Asia/JayapuraTest.php | 20 ---- tests/Earth/Timezone/Asia/JerusalemTest.php | 20 ---- tests/Earth/Timezone/Asia/KabulTest.php | 20 ---- tests/Earth/Timezone/Asia/KamchatkaTest.php | 20 ---- tests/Earth/Timezone/Asia/KarachiTest.php | 20 ---- tests/Earth/Timezone/Asia/KathmanduTest.php | 20 ---- tests/Earth/Timezone/Asia/KatmanduTest.php | 20 ---- tests/Earth/Timezone/Asia/KhandygaTest.php | 20 ---- tests/Earth/Timezone/Asia/KolkataTest.php | 20 ---- tests/Earth/Timezone/Asia/KrasnoyarskTest.php | 20 ---- tests/Earth/Timezone/Asia/KualaLumpurTest.php | 20 ---- tests/Earth/Timezone/Asia/KuchingTest.php | 20 ---- tests/Earth/Timezone/Asia/KuwaitTest.php | 20 ---- tests/Earth/Timezone/Asia/MacaoTest.php | 20 ---- tests/Earth/Timezone/Asia/MacauTest.php | 20 ---- tests/Earth/Timezone/Asia/MagadanTest.php | 20 ---- tests/Earth/Timezone/Asia/MakassarTest.php | 20 ---- tests/Earth/Timezone/Asia/ManilaTest.php | 20 ---- tests/Earth/Timezone/Asia/MuscatTest.php | 20 ---- tests/Earth/Timezone/Asia/NicosiaTest.php | 20 ---- .../Earth/Timezone/Asia/NovokuznetskTest.php | 20 ---- tests/Earth/Timezone/Asia/NovosibirskTest.php | 20 ---- tests/Earth/Timezone/Asia/OmskTest.php | 20 ---- tests/Earth/Timezone/Asia/OralTest.php | 20 ---- tests/Earth/Timezone/Asia/PhnomPenhTest.php | 20 ---- tests/Earth/Timezone/Asia/PontianakTest.php | 20 ---- tests/Earth/Timezone/Asia/PyongyangTest.php | 20 ---- tests/Earth/Timezone/Asia/QatarTest.php | 20 ---- tests/Earth/Timezone/Asia/QyzylordaTest.php | 20 ---- tests/Earth/Timezone/Asia/RangoonTest.php | 20 ---- tests/Earth/Timezone/Asia/RiyadhTest.php | 20 ---- tests/Earth/Timezone/Asia/SaigonTest.php | 20 ---- tests/Earth/Timezone/Asia/SakhalinTest.php | 20 ---- tests/Earth/Timezone/Asia/SamarkandTest.php | 20 ---- tests/Earth/Timezone/Asia/SeoulTest.php | 20 ---- tests/Earth/Timezone/Asia/ShanghaiTest.php | 20 ---- tests/Earth/Timezone/Asia/SingaporeTest.php | 20 ---- .../Earth/Timezone/Asia/SrednekolymskTest.php | 20 ---- tests/Earth/Timezone/Asia/TaipeiTest.php | 20 ---- tests/Earth/Timezone/Asia/TashkentTest.php | 20 ---- tests/Earth/Timezone/Asia/TbilisiTest.php | 20 ---- tests/Earth/Timezone/Asia/TehranTest.php | 20 ---- tests/Earth/Timezone/Asia/TelAvivTest.php | 20 ---- tests/Earth/Timezone/Asia/ThimbuTest.php | 20 ---- tests/Earth/Timezone/Asia/ThimphuTest.php | 20 ---- tests/Earth/Timezone/Asia/TokyoTest.php | 20 ---- .../Earth/Timezone/Asia/UjungPandangTest.php | 20 ---- tests/Earth/Timezone/Asia/UlaanbaatarTest.php | 20 ---- tests/Earth/Timezone/Asia/UlanBatorTest.php | 20 ---- tests/Earth/Timezone/Asia/UstNeraTest.php | 20 ---- tests/Earth/Timezone/Asia/VientianeTest.php | 20 ---- tests/Earth/Timezone/Asia/VladivostokTest.php | 20 ---- tests/Earth/Timezone/Asia/YakutskTest.php | 20 ---- .../Earth/Timezone/Asia/YekaterinburgTest.php | 20 ---- tests/Earth/Timezone/Asia/YerevanTest.php | 20 ---- tests/Earth/Timezone/Atlantic/AzoresTest.php | 20 ---- tests/Earth/Timezone/Atlantic/BermudaTest.php | 20 ---- tests/Earth/Timezone/Atlantic/CanaryTest.php | 20 ---- .../Earth/Timezone/Atlantic/CapeVerdeTest.php | 20 ---- tests/Earth/Timezone/Atlantic/FaeroeTest.php | 20 ---- tests/Earth/Timezone/Atlantic/FaroeTest.php | 20 ---- .../Earth/Timezone/Atlantic/JanMayenTest.php | 20 ---- tests/Earth/Timezone/Atlantic/MadeiraTest.php | 20 ---- .../Earth/Timezone/Atlantic/ReykjavikTest.php | 20 ---- .../Timezone/Atlantic/SaintHelenaTest.php | 20 ---- .../Timezone/Atlantic/SouthGeorgiaTest.php | 20 ---- tests/Earth/Timezone/Atlantic/StanleyTest.php | 20 ---- .../Earth/Timezone/Australia/AdelaideTest.php | 20 ---- .../AustralianCapitalTerritoryTest.php | 20 ---- .../Earth/Timezone/Australia/BrisbaneTest.php | 20 ---- .../Timezone/Australia/BrokenHillTest.php | 20 ---- .../Earth/Timezone/Australia/CanberraTest.php | 20 ---- tests/Earth/Timezone/Australia/CurrieTest.php | 20 ---- tests/Earth/Timezone/Australia/DarwinTest.php | 20 ---- tests/Earth/Timezone/Australia/EuclaTest.php | 20 ---- tests/Earth/Timezone/Australia/HobartTest.php | 20 ---- .../Earth/Timezone/Australia/LindemanTest.php | 20 ---- .../Australia/LordeHoweIslandTest.php | 20 ---- .../Timezone/Australia/MelbourneTest.php | 20 ---- .../Timezone/Australia/NewSouthWalesTest.php | 20 ---- tests/Earth/Timezone/Australia/NorthTest.php | 20 ---- tests/Earth/Timezone/Australia/PerthTest.php | 20 ---- .../Timezone/Australia/QueenslandTest.php | 20 ---- tests/Earth/Timezone/Australia/SouthTest.php | 20 ---- tests/Earth/Timezone/Australia/SydneyTest.php | 20 ---- .../Earth/Timezone/Australia/TasmaniaTest.php | 20 ---- .../Earth/Timezone/Australia/VictoriaTest.php | 20 ---- tests/Earth/Timezone/Australia/WestTest.php | 20 ---- .../Timezone/Australia/YancowinnaTest.php | 20 ---- tests/Earth/Timezone/Europe/AmsterdamTest.php | 20 ---- tests/Earth/Timezone/Europe/AndorraTest.php | 20 ---- tests/Earth/Timezone/Europe/AthensTest.php | 20 ---- tests/Earth/Timezone/Europe/BelfastTest.php | 20 ---- tests/Earth/Timezone/Europe/BelgradeTest.php | 20 ---- tests/Earth/Timezone/Europe/BerlinTest.php | 20 ---- .../Earth/Timezone/Europe/BratislavaTest.php | 20 ---- tests/Earth/Timezone/Europe/BrusselsTest.php | 20 ---- tests/Earth/Timezone/Europe/BucharestTest.php | 20 ---- tests/Earth/Timezone/Europe/BudapestTest.php | 20 ---- tests/Earth/Timezone/Europe/BusingenTest.php | 20 ---- tests/Earth/Timezone/Europe/ChisinauTest.php | 20 ---- .../Earth/Timezone/Europe/CopenhagenTest.php | 20 ---- tests/Earth/Timezone/Europe/DublinTest.php | 20 ---- tests/Earth/Timezone/Europe/GibraltarTest.php | 20 ---- tests/Earth/Timezone/Europe/GuernseyTest.php | 20 ---- tests/Earth/Timezone/Europe/HelsinkiTest.php | 20 ---- tests/Earth/Timezone/Europe/IsleOfManTest.php | 20 ---- tests/Earth/Timezone/Europe/IstanbulTest.php | 20 ---- tests/Earth/Timezone/Europe/JerseyTest.php | 20 ---- .../Earth/Timezone/Europe/KaliningradTest.php | 20 ---- tests/Earth/Timezone/Europe/KievTest.php | 20 ---- tests/Earth/Timezone/Europe/LisbonTest.php | 20 ---- tests/Earth/Timezone/Europe/LjubljanaTest.php | 20 ---- tests/Earth/Timezone/Europe/LondonTest.php | 20 ---- .../Earth/Timezone/Europe/LuxembourgTest.php | 20 ---- tests/Earth/Timezone/Europe/MadridTest.php | 20 ---- tests/Earth/Timezone/Europe/MaltaTest.php | 20 ---- tests/Earth/Timezone/Europe/MariehamnTest.php | 20 ---- tests/Earth/Timezone/Europe/MinskTest.php | 20 ---- tests/Earth/Timezone/Europe/MonacoTest.php | 20 ---- tests/Earth/Timezone/Europe/MoscowTest.php | 20 ---- tests/Earth/Timezone/Europe/NicosiaTest.php | 20 ---- tests/Earth/Timezone/Europe/OsloTest.php | 20 ---- tests/Earth/Timezone/Europe/ParisTest.php | 20 ---- tests/Earth/Timezone/Europe/PodgoricaTest.php | 20 ---- tests/Earth/Timezone/Europe/PragueTest.php | 20 ---- tests/Earth/Timezone/Europe/RigaTest.php | 20 ---- tests/Earth/Timezone/Europe/RomeTest.php | 20 ---- tests/Earth/Timezone/Europe/SamaraTest.php | 20 ---- tests/Earth/Timezone/Europe/SanMarinoTest.php | 20 ---- tests/Earth/Timezone/Europe/SarajevoTest.php | 20 ---- .../Earth/Timezone/Europe/SimferopolTest.php | 20 ---- tests/Earth/Timezone/Europe/SkopjeTest.php | 20 ---- tests/Earth/Timezone/Europe/SofiaTest.php | 20 ---- tests/Earth/Timezone/Europe/StockholmTest.php | 20 ---- tests/Earth/Timezone/Europe/TallinnTest.php | 20 ---- tests/Earth/Timezone/Europe/TiraneTest.php | 20 ---- tests/Earth/Timezone/Europe/TiraspolTest.php | 20 ---- tests/Earth/Timezone/Europe/UzhgorodTest.php | 20 ---- tests/Earth/Timezone/Europe/VaduzTest.php | 20 ---- tests/Earth/Timezone/Europe/VaticanTest.php | 20 ---- tests/Earth/Timezone/Europe/ViennaTest.php | 20 ---- tests/Earth/Timezone/Europe/VilniusTest.php | 20 ---- tests/Earth/Timezone/Europe/VolgogradTest.php | 20 ---- tests/Earth/Timezone/Europe/WarsawTest.php | 20 ---- tests/Earth/Timezone/Europe/ZagrebTest.php | 20 ---- .../Earth/Timezone/Europe/ZaporozhyeTest.php | 20 ---- tests/Earth/Timezone/Europe/ZurichTest.php | 20 ---- .../Timezone/Indian/AntananarivoTest.php | 20 ---- tests/Earth/Timezone/Indian/ChagosTest.php | 20 ---- tests/Earth/Timezone/Indian/ChristmasTest.php | 20 ---- tests/Earth/Timezone/Indian/CocosTest.php | 20 ---- tests/Earth/Timezone/Indian/ComoroTest.php | 20 ---- tests/Earth/Timezone/Indian/KerguelenTest.php | 20 ---- tests/Earth/Timezone/Indian/MaheTest.php | 20 ---- tests/Earth/Timezone/Indian/MaldivesTest.php | 20 ---- tests/Earth/Timezone/Indian/MauritiusTest.php | 20 ---- tests/Earth/Timezone/Indian/MayotteTest.php | 20 ---- tests/Earth/Timezone/Indian/ReunionTest.php | 20 ---- tests/Earth/Timezone/Pacific/ApiaTest.php | 20 ---- tests/Earth/Timezone/Pacific/AucklandTest.php | 20 ---- .../Timezone/Pacific/BougainvilleTest.php | 20 ---- tests/Earth/Timezone/Pacific/ChathamTest.php | 20 ---- tests/Earth/Timezone/Pacific/ChuukTest.php | 20 ---- tests/Earth/Timezone/Pacific/EasterTest.php | 20 ---- tests/Earth/Timezone/Pacific/EfateTest.php | 20 ---- .../Earth/Timezone/Pacific/EnderburyTest.php | 20 ---- tests/Earth/Timezone/Pacific/FakaofoTest.php | 20 ---- tests/Earth/Timezone/Pacific/FijiTest.php | 20 ---- tests/Earth/Timezone/Pacific/FunafutiTest.php | 20 ---- .../Earth/Timezone/Pacific/GalapagosTest.php | 20 ---- tests/Earth/Timezone/Pacific/GambierTest.php | 20 ---- .../Timezone/Pacific/GuadalcanalTest.php | 20 ---- tests/Earth/Timezone/Pacific/GuamTest.php | 20 ---- tests/Earth/Timezone/Pacific/HonoluluTest.php | 20 ---- tests/Earth/Timezone/Pacific/JohnstonTest.php | 20 ---- .../Earth/Timezone/Pacific/KiritimatiTest.php | 20 ---- tests/Earth/Timezone/Pacific/KosraeTest.php | 20 ---- .../Earth/Timezone/Pacific/KwajaleinTest.php | 20 ---- tests/Earth/Timezone/Pacific/MajuroTest.php | 20 ---- .../Earth/Timezone/Pacific/MarquesasTest.php | 20 ---- tests/Earth/Timezone/Pacific/MidwayTest.php | 20 ---- tests/Earth/Timezone/Pacific/NauruTest.php | 20 ---- tests/Earth/Timezone/Pacific/NiueTest.php | 20 ---- tests/Earth/Timezone/Pacific/NorfolkTest.php | 20 ---- tests/Earth/Timezone/Pacific/NoumeaTest.php | 20 ---- tests/Earth/Timezone/Pacific/PagoPagoTest.php | 20 ---- tests/Earth/Timezone/Pacific/PalauTest.php | 20 ---- tests/Earth/Timezone/Pacific/PitcairnTest.php | 20 ---- tests/Earth/Timezone/Pacific/PohnpeiTest.php | 20 ---- tests/Earth/Timezone/Pacific/PonapeTest.php | 20 ---- .../Timezone/Pacific/PortMoresbyTest.php | 20 ---- .../Earth/Timezone/Pacific/RarotongaTest.php | 20 ---- tests/Earth/Timezone/Pacific/SaipanTest.php | 20 ---- tests/Earth/Timezone/Pacific/TahitiTest.php | 20 ---- tests/Earth/Timezone/Pacific/TarawaTest.php | 20 ---- .../Earth/Timezone/Pacific/TongatapuTest.php | 20 ---- tests/Earth/Timezone/Pacific/TrukTest.php | 20 ---- tests/Earth/Timezone/Pacific/WakeTest.php | 20 ---- tests/Earth/Timezone/Pacific/WallisTest.php | 20 ---- tests/Earth/Timezone/Pacific/YapTest.php | 20 ---- tests/Earth/Timezone/UTCTest.php | 104 ------------------ 926 files changed, 1 insertion(+), 17313 deletions(-) delete mode 100644 src/Earth/Timezone.php delete mode 100644 src/Earth/Timezone/Africa/Abidjan.php delete mode 100644 src/Earth/Timezone/Africa/Accra.php delete mode 100644 src/Earth/Timezone/Africa/AddisAbaba.php delete mode 100644 src/Earth/Timezone/Africa/Algiers.php delete mode 100644 src/Earth/Timezone/Africa/Asmara.php delete mode 100644 src/Earth/Timezone/Africa/Asmera.php delete mode 100644 src/Earth/Timezone/Africa/Bamako.php delete mode 100644 src/Earth/Timezone/Africa/Bangui.php delete mode 100644 src/Earth/Timezone/Africa/Banjul.php delete mode 100644 src/Earth/Timezone/Africa/Bissau.php delete mode 100644 src/Earth/Timezone/Africa/Blantyre.php delete mode 100644 src/Earth/Timezone/Africa/Brazzaville.php delete mode 100644 src/Earth/Timezone/Africa/Bujumbura.php delete mode 100644 src/Earth/Timezone/Africa/Cairo.php delete mode 100644 src/Earth/Timezone/Africa/Casablanca.php delete mode 100644 src/Earth/Timezone/Africa/Ceuta.php delete mode 100644 src/Earth/Timezone/Africa/Conakry.php delete mode 100644 src/Earth/Timezone/Africa/Dakar.php delete mode 100644 src/Earth/Timezone/Africa/DarEsSalaam.php delete mode 100644 src/Earth/Timezone/Africa/Djibouti.php delete mode 100644 src/Earth/Timezone/Africa/Douala.php delete mode 100644 src/Earth/Timezone/Africa/ElAaiun.php delete mode 100644 src/Earth/Timezone/Africa/Freetown.php delete mode 100644 src/Earth/Timezone/Africa/Gaborone.php delete mode 100644 src/Earth/Timezone/Africa/Harare.php delete mode 100644 src/Earth/Timezone/Africa/Johannesburg.php delete mode 100644 src/Earth/Timezone/Africa/Juba.php delete mode 100644 src/Earth/Timezone/Africa/Kampala.php delete mode 100644 src/Earth/Timezone/Africa/Khartoum.php delete mode 100644 src/Earth/Timezone/Africa/Kigali.php delete mode 100644 src/Earth/Timezone/Africa/Kinshasa.php delete mode 100644 src/Earth/Timezone/Africa/Lagos.php delete mode 100644 src/Earth/Timezone/Africa/Libreville.php delete mode 100644 src/Earth/Timezone/Africa/Lome.php delete mode 100644 src/Earth/Timezone/Africa/Luanda.php delete mode 100644 src/Earth/Timezone/Africa/Lubumbashi.php delete mode 100644 src/Earth/Timezone/Africa/Lusaka.php delete mode 100644 src/Earth/Timezone/Africa/Malabo.php delete mode 100644 src/Earth/Timezone/Africa/Maputo.php delete mode 100644 src/Earth/Timezone/Africa/Maseru.php delete mode 100644 src/Earth/Timezone/Africa/Mbabane.php delete mode 100644 src/Earth/Timezone/Africa/Mogadishu.php delete mode 100644 src/Earth/Timezone/Africa/Monrovia.php delete mode 100644 src/Earth/Timezone/Africa/Nairobi.php delete mode 100644 src/Earth/Timezone/Africa/Ndjamena.php delete mode 100644 src/Earth/Timezone/Africa/Niamey.php delete mode 100644 src/Earth/Timezone/Africa/Nouakchott.php delete mode 100644 src/Earth/Timezone/Africa/Ouagadougou.php delete mode 100644 src/Earth/Timezone/Africa/PortoNovo.php delete mode 100644 src/Earth/Timezone/Africa/SaoTome.php delete mode 100644 src/Earth/Timezone/Africa/Timbuktu.php delete mode 100644 src/Earth/Timezone/Africa/Tripoli.php delete mode 100644 src/Earth/Timezone/Africa/Tunis.php delete mode 100644 src/Earth/Timezone/Africa/Windhoek.php delete mode 100644 src/Earth/Timezone/America/Adak.php delete mode 100644 src/Earth/Timezone/America/Anchorage.php delete mode 100644 src/Earth/Timezone/America/Anguilla.php delete mode 100644 src/Earth/Timezone/America/Antigua.php delete mode 100644 src/Earth/Timezone/America/Araguaina.php delete mode 100644 src/Earth/Timezone/America/Argentina/BuenosAires.php delete mode 100644 src/Earth/Timezone/America/Argentina/Catamarca.php delete mode 100644 src/Earth/Timezone/America/Argentina/ComodRivadavia.php delete mode 100644 src/Earth/Timezone/America/Argentina/Cordoba.php delete mode 100644 src/Earth/Timezone/America/Argentina/Jujuy.php delete mode 100644 src/Earth/Timezone/America/Argentina/LaRioja.php delete mode 100644 src/Earth/Timezone/America/Argentina/Mendoza.php delete mode 100644 src/Earth/Timezone/America/Argentina/RioGallegos.php delete mode 100644 src/Earth/Timezone/America/Argentina/Salta.php delete mode 100644 src/Earth/Timezone/America/Argentina/SanJuan.php delete mode 100644 src/Earth/Timezone/America/Argentina/SanLuis.php delete mode 100644 src/Earth/Timezone/America/Argentina/Tucuman.php delete mode 100644 src/Earth/Timezone/America/Argentina/Ushuaia.php delete mode 100644 src/Earth/Timezone/America/Aruba.php delete mode 100644 src/Earth/Timezone/America/Asuncion.php delete mode 100644 src/Earth/Timezone/America/Atikokan.php delete mode 100644 src/Earth/Timezone/America/Atka.php delete mode 100644 src/Earth/Timezone/America/Bahia.php delete mode 100644 src/Earth/Timezone/America/BahiaBanderas.php delete mode 100644 src/Earth/Timezone/America/Barbados.php delete mode 100644 src/Earth/Timezone/America/Belem.php delete mode 100644 src/Earth/Timezone/America/Belize.php delete mode 100644 src/Earth/Timezone/America/BlancSablon.php delete mode 100644 src/Earth/Timezone/America/BoaVista.php delete mode 100644 src/Earth/Timezone/America/Bogota.php delete mode 100644 src/Earth/Timezone/America/Boise.php delete mode 100644 src/Earth/Timezone/America/CambridgeBay.php delete mode 100644 src/Earth/Timezone/America/CampoGrande.php delete mode 100644 src/Earth/Timezone/America/Cancun.php delete mode 100644 src/Earth/Timezone/America/Caracas.php delete mode 100644 src/Earth/Timezone/America/Catamarca.php delete mode 100644 src/Earth/Timezone/America/Cayenne.php delete mode 100644 src/Earth/Timezone/America/Cayman.php delete mode 100644 src/Earth/Timezone/America/Chicago.php delete mode 100644 src/Earth/Timezone/America/Chihuahua.php delete mode 100644 src/Earth/Timezone/America/CoralHarbour.php delete mode 100644 src/Earth/Timezone/America/CostaRica.php delete mode 100644 src/Earth/Timezone/America/Creston.php delete mode 100644 src/Earth/Timezone/America/Cuiaba.php delete mode 100644 src/Earth/Timezone/America/Curacao.php delete mode 100644 src/Earth/Timezone/America/Danmarkshavn.php delete mode 100644 src/Earth/Timezone/America/Dawson.php delete mode 100644 src/Earth/Timezone/America/DawsonCreek.php delete mode 100644 src/Earth/Timezone/America/Denver.php delete mode 100644 src/Earth/Timezone/America/Detroit.php delete mode 100644 src/Earth/Timezone/America/Dominica.php delete mode 100644 src/Earth/Timezone/America/Edmonton.php delete mode 100644 src/Earth/Timezone/America/Eirunepe.php delete mode 100644 src/Earth/Timezone/America/ElSalvador.php delete mode 100644 src/Earth/Timezone/America/Ensenada.php delete mode 100644 src/Earth/Timezone/America/FortWayne.php delete mode 100644 src/Earth/Timezone/America/Fortaleza.php delete mode 100644 src/Earth/Timezone/America/GlaceBay.php delete mode 100644 src/Earth/Timezone/America/Godthab.php delete mode 100644 src/Earth/Timezone/America/GooseBay.php delete mode 100644 src/Earth/Timezone/America/GrandTurk.php delete mode 100644 src/Earth/Timezone/America/Grenada.php delete mode 100644 src/Earth/Timezone/America/Guadeloupe.php delete mode 100644 src/Earth/Timezone/America/Guatemala.php delete mode 100644 src/Earth/Timezone/America/Guayaquil.php delete mode 100644 src/Earth/Timezone/America/Guyana.php delete mode 100644 src/Earth/Timezone/America/Halifax.php delete mode 100644 src/Earth/Timezone/America/Havana.php delete mode 100644 src/Earth/Timezone/America/Hermosillo.php delete mode 100644 src/Earth/Timezone/America/Indiana/Indianapolis.php delete mode 100644 src/Earth/Timezone/America/Indiana/Knox.php delete mode 100644 src/Earth/Timezone/America/Indiana/Marengo.php delete mode 100644 src/Earth/Timezone/America/Indiana/Petersburg.php delete mode 100644 src/Earth/Timezone/America/Indiana/TellCity.php delete mode 100644 src/Earth/Timezone/America/Indiana/Vevay.php delete mode 100644 src/Earth/Timezone/America/Indiana/Vincennes.php delete mode 100644 src/Earth/Timezone/America/Indiana/Winamac.php delete mode 100644 src/Earth/Timezone/America/Inuvik.php delete mode 100644 src/Earth/Timezone/America/Iqaluit.php delete mode 100644 src/Earth/Timezone/America/Jamaica.php delete mode 100644 src/Earth/Timezone/America/Juneau.php delete mode 100644 src/Earth/Timezone/America/Kralendijk.php delete mode 100644 src/Earth/Timezone/America/LaPaz.php delete mode 100644 src/Earth/Timezone/America/Lima.php delete mode 100644 src/Earth/Timezone/America/LosAngeles.php delete mode 100644 src/Earth/Timezone/America/Louisville.php delete mode 100644 src/Earth/Timezone/America/LowerPrinces.php delete mode 100644 src/Earth/Timezone/America/Maceio.php delete mode 100644 src/Earth/Timezone/America/Managua.php delete mode 100644 src/Earth/Timezone/America/Manaus.php delete mode 100644 src/Earth/Timezone/America/Marigot.php delete mode 100644 src/Earth/Timezone/America/Martinique.php delete mode 100644 src/Earth/Timezone/America/Matamoros.php delete mode 100644 src/Earth/Timezone/America/Mazatlan.php delete mode 100644 src/Earth/Timezone/America/Menominee.php delete mode 100644 src/Earth/Timezone/America/Merida.php delete mode 100644 src/Earth/Timezone/America/Metlakatla.php delete mode 100644 src/Earth/Timezone/America/MexicoCity.php delete mode 100644 src/Earth/Timezone/America/Miquelon.php delete mode 100644 src/Earth/Timezone/America/Moncton.php delete mode 100644 src/Earth/Timezone/America/Monterrey.php delete mode 100644 src/Earth/Timezone/America/Montevideo.php delete mode 100644 src/Earth/Timezone/America/Monticello.php delete mode 100644 src/Earth/Timezone/America/Montreal.php delete mode 100644 src/Earth/Timezone/America/Montserrat.php delete mode 100644 src/Earth/Timezone/America/Nassau.php delete mode 100644 src/Earth/Timezone/America/NewYork.php delete mode 100644 src/Earth/Timezone/America/Nipigon.php delete mode 100644 src/Earth/Timezone/America/Nome.php delete mode 100644 src/Earth/Timezone/America/Noronha.php delete mode 100644 src/Earth/Timezone/America/NorthDakota/Beulah.php delete mode 100644 src/Earth/Timezone/America/NorthDakota/Center.php delete mode 100644 src/Earth/Timezone/America/NorthDakota/NewSalem.php delete mode 100644 src/Earth/Timezone/America/Ojinaga.php delete mode 100644 src/Earth/Timezone/America/Panama.php delete mode 100644 src/Earth/Timezone/America/Pangnirtung.php delete mode 100644 src/Earth/Timezone/America/Paramaribo.php delete mode 100644 src/Earth/Timezone/America/Phoenix.php delete mode 100644 src/Earth/Timezone/America/PortAuPrince.php delete mode 100644 src/Earth/Timezone/America/PortOfSpain.php delete mode 100644 src/Earth/Timezone/America/PortoAcre.php delete mode 100644 src/Earth/Timezone/America/PortoVelho.php delete mode 100644 src/Earth/Timezone/America/PuertoRico.php delete mode 100644 src/Earth/Timezone/America/RainyRiver.php delete mode 100644 src/Earth/Timezone/America/RankinInlet.php delete mode 100644 src/Earth/Timezone/America/Recife.php delete mode 100644 src/Earth/Timezone/America/Regina.php delete mode 100644 src/Earth/Timezone/America/Resolute.php delete mode 100644 src/Earth/Timezone/America/RioBranco.php delete mode 100644 src/Earth/Timezone/America/Rosario.php delete mode 100644 src/Earth/Timezone/America/SaintBarthelemy.php delete mode 100644 src/Earth/Timezone/America/SaintJohns.php delete mode 100644 src/Earth/Timezone/America/SaintKitts.php delete mode 100644 src/Earth/Timezone/America/SaintLucia.php delete mode 100644 src/Earth/Timezone/America/SaintThomas.php delete mode 100644 src/Earth/Timezone/America/SaintVincent.php delete mode 100644 src/Earth/Timezone/America/SantaIsabel.php delete mode 100644 src/Earth/Timezone/America/Santarem.php delete mode 100644 src/Earth/Timezone/America/Santiago.php delete mode 100644 src/Earth/Timezone/America/SantoDomingo.php delete mode 100644 src/Earth/Timezone/America/SaoPaulo.php delete mode 100644 src/Earth/Timezone/America/Scoresbysund.php delete mode 100644 src/Earth/Timezone/America/Shiprock.php delete mode 100644 src/Earth/Timezone/America/Sitka.php delete mode 100644 src/Earth/Timezone/America/SwiftCurrent.php delete mode 100644 src/Earth/Timezone/America/Tegucigalpa.php delete mode 100644 src/Earth/Timezone/America/Thule.php delete mode 100644 src/Earth/Timezone/America/ThunderBay.php delete mode 100644 src/Earth/Timezone/America/Tijuana.php delete mode 100644 src/Earth/Timezone/America/Toronto.php delete mode 100644 src/Earth/Timezone/America/Tortola.php delete mode 100644 src/Earth/Timezone/America/Vancouver.php delete mode 100644 src/Earth/Timezone/America/Virgin.php delete mode 100644 src/Earth/Timezone/America/Whitehorse.php delete mode 100644 src/Earth/Timezone/America/Winnipeg.php delete mode 100644 src/Earth/Timezone/America/Yakutat.php delete mode 100644 src/Earth/Timezone/America/Yellowknife.php delete mode 100644 src/Earth/Timezone/Antarctica/Casey.php delete mode 100644 src/Earth/Timezone/Antarctica/Davis.php delete mode 100644 src/Earth/Timezone/Antarctica/DumontDUrville.php delete mode 100644 src/Earth/Timezone/Antarctica/Macquarie.php delete mode 100644 src/Earth/Timezone/Antarctica/Mawson.php delete mode 100644 src/Earth/Timezone/Antarctica/McMurdo.php delete mode 100644 src/Earth/Timezone/Antarctica/Palmer.php delete mode 100644 src/Earth/Timezone/Antarctica/Rothera.php delete mode 100644 src/Earth/Timezone/Antarctica/SouthPole.php delete mode 100644 src/Earth/Timezone/Antarctica/Syowa.php delete mode 100644 src/Earth/Timezone/Antarctica/Troll.php delete mode 100644 src/Earth/Timezone/Antarctica/Vostok.php delete mode 100644 src/Earth/Timezone/Arctic/Longyearbyen.php delete mode 100644 src/Earth/Timezone/Asia/Aden.php delete mode 100644 src/Earth/Timezone/Asia/Almaty.php delete mode 100644 src/Earth/Timezone/Asia/Amman.php delete mode 100644 src/Earth/Timezone/Asia/Anadyr.php delete mode 100644 src/Earth/Timezone/Asia/Aqtau.php delete mode 100644 src/Earth/Timezone/Asia/Aqtobe.php delete mode 100644 src/Earth/Timezone/Asia/Ashgabat.php delete mode 100644 src/Earth/Timezone/Asia/Ashkhabad.php delete mode 100644 src/Earth/Timezone/Asia/Baghdad.php delete mode 100644 src/Earth/Timezone/Asia/Bahrain.php delete mode 100644 src/Earth/Timezone/Asia/Baku.php delete mode 100644 src/Earth/Timezone/Asia/Bangkok.php delete mode 100644 src/Earth/Timezone/Asia/Beirut.php delete mode 100644 src/Earth/Timezone/Asia/Bishkek.php delete mode 100644 src/Earth/Timezone/Asia/Brunei.php delete mode 100644 src/Earth/Timezone/Asia/Calcutta.php delete mode 100644 src/Earth/Timezone/Asia/Chita.php delete mode 100644 src/Earth/Timezone/Asia/Choibalsan.php delete mode 100644 src/Earth/Timezone/Asia/Chongqing.php delete mode 100644 src/Earth/Timezone/Asia/Chungking.php delete mode 100644 src/Earth/Timezone/Asia/Colombo.php delete mode 100644 src/Earth/Timezone/Asia/Dacca.php delete mode 100644 src/Earth/Timezone/Asia/Damascus.php delete mode 100644 src/Earth/Timezone/Asia/Dhaka.php delete mode 100644 src/Earth/Timezone/Asia/Dili.php delete mode 100644 src/Earth/Timezone/Asia/Dubai.php delete mode 100644 src/Earth/Timezone/Asia/Dushanbe.php delete mode 100644 src/Earth/Timezone/Asia/Gaza.php delete mode 100644 src/Earth/Timezone/Asia/Harbin.php delete mode 100644 src/Earth/Timezone/Asia/Hebron.php delete mode 100644 src/Earth/Timezone/Asia/HoChiMinh.php delete mode 100644 src/Earth/Timezone/Asia/HongKong.php delete mode 100644 src/Earth/Timezone/Asia/Hovd.php delete mode 100644 src/Earth/Timezone/Asia/Irkutsk.php delete mode 100644 src/Earth/Timezone/Asia/Istanbul.php delete mode 100644 src/Earth/Timezone/Asia/Jakarta.php delete mode 100644 src/Earth/Timezone/Asia/Jayapura.php delete mode 100644 src/Earth/Timezone/Asia/Jerusalem.php delete mode 100644 src/Earth/Timezone/Asia/Kabul.php delete mode 100644 src/Earth/Timezone/Asia/Kamchatka.php delete mode 100644 src/Earth/Timezone/Asia/Karachi.php delete mode 100644 src/Earth/Timezone/Asia/Kathmandu.php delete mode 100644 src/Earth/Timezone/Asia/Katmandu.php delete mode 100644 src/Earth/Timezone/Asia/Khandyga.php delete mode 100644 src/Earth/Timezone/Asia/Kolkata.php delete mode 100644 src/Earth/Timezone/Asia/Krasnoyarsk.php delete mode 100644 src/Earth/Timezone/Asia/KualaLumpur.php delete mode 100644 src/Earth/Timezone/Asia/Kuching.php delete mode 100644 src/Earth/Timezone/Asia/Kuwait.php delete mode 100644 src/Earth/Timezone/Asia/Macao.php delete mode 100644 src/Earth/Timezone/Asia/Macau.php delete mode 100644 src/Earth/Timezone/Asia/Magadan.php delete mode 100644 src/Earth/Timezone/Asia/Makassar.php delete mode 100644 src/Earth/Timezone/Asia/Manila.php delete mode 100644 src/Earth/Timezone/Asia/Muscat.php delete mode 100644 src/Earth/Timezone/Asia/Nicosia.php delete mode 100644 src/Earth/Timezone/Asia/Novokuznetsk.php delete mode 100644 src/Earth/Timezone/Asia/Novosibirsk.php delete mode 100644 src/Earth/Timezone/Asia/Omsk.php delete mode 100644 src/Earth/Timezone/Asia/Oral.php delete mode 100644 src/Earth/Timezone/Asia/PhnomPenh.php delete mode 100644 src/Earth/Timezone/Asia/Pontianak.php delete mode 100644 src/Earth/Timezone/Asia/Pyongyang.php delete mode 100644 src/Earth/Timezone/Asia/Qatar.php delete mode 100644 src/Earth/Timezone/Asia/Qyzylorda.php delete mode 100644 src/Earth/Timezone/Asia/Rangoon.php delete mode 100644 src/Earth/Timezone/Asia/Riyadh.php delete mode 100644 src/Earth/Timezone/Asia/Saigon.php delete mode 100644 src/Earth/Timezone/Asia/Sakhalin.php delete mode 100644 src/Earth/Timezone/Asia/Samarkand.php delete mode 100644 src/Earth/Timezone/Asia/Seoul.php delete mode 100644 src/Earth/Timezone/Asia/Shanghai.php delete mode 100644 src/Earth/Timezone/Asia/Singapore.php delete mode 100644 src/Earth/Timezone/Asia/Srednekolymsk.php delete mode 100644 src/Earth/Timezone/Asia/Taipei.php delete mode 100644 src/Earth/Timezone/Asia/Tashkent.php delete mode 100644 src/Earth/Timezone/Asia/Tbilisi.php delete mode 100644 src/Earth/Timezone/Asia/Tehran.php delete mode 100644 src/Earth/Timezone/Asia/TelAviv.php delete mode 100644 src/Earth/Timezone/Asia/Thimbu.php delete mode 100644 src/Earth/Timezone/Asia/Thimphu.php delete mode 100644 src/Earth/Timezone/Asia/Tokyo.php delete mode 100644 src/Earth/Timezone/Asia/UjungPandang.php delete mode 100644 src/Earth/Timezone/Asia/Ulaanbaatar.php delete mode 100644 src/Earth/Timezone/Asia/UlanBator.php delete mode 100644 src/Earth/Timezone/Asia/UstNera.php delete mode 100644 src/Earth/Timezone/Asia/Vientiane.php delete mode 100644 src/Earth/Timezone/Asia/Vladivostok.php delete mode 100644 src/Earth/Timezone/Asia/Yakutsk.php delete mode 100644 src/Earth/Timezone/Asia/Yekaterinburg.php delete mode 100644 src/Earth/Timezone/Asia/Yerevan.php delete mode 100644 src/Earth/Timezone/Atlantic/Azores.php delete mode 100644 src/Earth/Timezone/Atlantic/Bermuda.php delete mode 100644 src/Earth/Timezone/Atlantic/Canary.php delete mode 100644 src/Earth/Timezone/Atlantic/CapeVerde.php delete mode 100644 src/Earth/Timezone/Atlantic/Faeroe.php delete mode 100644 src/Earth/Timezone/Atlantic/Faroe.php delete mode 100644 src/Earth/Timezone/Atlantic/JanMayen.php delete mode 100644 src/Earth/Timezone/Atlantic/Madeira.php delete mode 100644 src/Earth/Timezone/Atlantic/Reykjavik.php delete mode 100644 src/Earth/Timezone/Atlantic/SaintHelena.php delete mode 100644 src/Earth/Timezone/Atlantic/SouthGeorgia.php delete mode 100644 src/Earth/Timezone/Atlantic/Stanley.php delete mode 100644 src/Earth/Timezone/Australia/Adelaide.php delete mode 100644 src/Earth/Timezone/Australia/AustralianCapitalTerritory.php delete mode 100644 src/Earth/Timezone/Australia/Brisbane.php delete mode 100644 src/Earth/Timezone/Australia/BrokenHill.php delete mode 100644 src/Earth/Timezone/Australia/Canberra.php delete mode 100644 src/Earth/Timezone/Australia/Currie.php delete mode 100644 src/Earth/Timezone/Australia/Darwin.php delete mode 100644 src/Earth/Timezone/Australia/Eucla.php delete mode 100644 src/Earth/Timezone/Australia/Hobart.php delete mode 100644 src/Earth/Timezone/Australia/Lindeman.php delete mode 100644 src/Earth/Timezone/Australia/LordeHoweIsland.php delete mode 100644 src/Earth/Timezone/Australia/Melbourne.php delete mode 100644 src/Earth/Timezone/Australia/NewSouthWales.php delete mode 100644 src/Earth/Timezone/Australia/North.php delete mode 100644 src/Earth/Timezone/Australia/Perth.php delete mode 100644 src/Earth/Timezone/Australia/Queensland.php delete mode 100644 src/Earth/Timezone/Australia/South.php delete mode 100644 src/Earth/Timezone/Australia/Sydney.php delete mode 100644 src/Earth/Timezone/Australia/Tasmania.php delete mode 100644 src/Earth/Timezone/Australia/Victoria.php delete mode 100644 src/Earth/Timezone/Australia/West.php delete mode 100644 src/Earth/Timezone/Australia/Yancowinna.php delete mode 100644 src/Earth/Timezone/Europe/Amsterdam.php delete mode 100644 src/Earth/Timezone/Europe/Andorra.php delete mode 100644 src/Earth/Timezone/Europe/Athens.php delete mode 100644 src/Earth/Timezone/Europe/Belfast.php delete mode 100644 src/Earth/Timezone/Europe/Belgrade.php delete mode 100644 src/Earth/Timezone/Europe/Berlin.php delete mode 100644 src/Earth/Timezone/Europe/Bratislava.php delete mode 100644 src/Earth/Timezone/Europe/Brussels.php delete mode 100644 src/Earth/Timezone/Europe/Bucharest.php delete mode 100644 src/Earth/Timezone/Europe/Budapest.php delete mode 100644 src/Earth/Timezone/Europe/Busingen.php delete mode 100644 src/Earth/Timezone/Europe/Chisinau.php delete mode 100644 src/Earth/Timezone/Europe/Copenhagen.php delete mode 100644 src/Earth/Timezone/Europe/Dublin.php delete mode 100644 src/Earth/Timezone/Europe/Gibraltar.php delete mode 100644 src/Earth/Timezone/Europe/Guernsey.php delete mode 100644 src/Earth/Timezone/Europe/Helsinki.php delete mode 100644 src/Earth/Timezone/Europe/IsleOfMan.php delete mode 100644 src/Earth/Timezone/Europe/Istanbul.php delete mode 100644 src/Earth/Timezone/Europe/Jersey.php delete mode 100644 src/Earth/Timezone/Europe/Kaliningrad.php delete mode 100644 src/Earth/Timezone/Europe/Kiev.php delete mode 100644 src/Earth/Timezone/Europe/Lisbon.php delete mode 100644 src/Earth/Timezone/Europe/Ljubljana.php delete mode 100644 src/Earth/Timezone/Europe/London.php delete mode 100644 src/Earth/Timezone/Europe/Luxembourg.php delete mode 100644 src/Earth/Timezone/Europe/Madrid.php delete mode 100644 src/Earth/Timezone/Europe/Malta.php delete mode 100644 src/Earth/Timezone/Europe/Mariehamn.php delete mode 100644 src/Earth/Timezone/Europe/Minsk.php delete mode 100644 src/Earth/Timezone/Europe/Monaco.php delete mode 100644 src/Earth/Timezone/Europe/Moscow.php delete mode 100644 src/Earth/Timezone/Europe/Nicosia.php delete mode 100644 src/Earth/Timezone/Europe/Oslo.php delete mode 100644 src/Earth/Timezone/Europe/Paris.php delete mode 100644 src/Earth/Timezone/Europe/Podgorica.php delete mode 100644 src/Earth/Timezone/Europe/Prague.php delete mode 100644 src/Earth/Timezone/Europe/Riga.php delete mode 100644 src/Earth/Timezone/Europe/Rome.php delete mode 100644 src/Earth/Timezone/Europe/Samara.php delete mode 100644 src/Earth/Timezone/Europe/SanMarino.php delete mode 100644 src/Earth/Timezone/Europe/Sarajevo.php delete mode 100644 src/Earth/Timezone/Europe/Simferopol.php delete mode 100644 src/Earth/Timezone/Europe/Skopje.php delete mode 100644 src/Earth/Timezone/Europe/Sofia.php delete mode 100644 src/Earth/Timezone/Europe/Stockholm.php delete mode 100644 src/Earth/Timezone/Europe/Tallinn.php delete mode 100644 src/Earth/Timezone/Europe/Tirane.php delete mode 100644 src/Earth/Timezone/Europe/Tiraspol.php delete mode 100644 src/Earth/Timezone/Europe/Uzhgorod.php delete mode 100644 src/Earth/Timezone/Europe/Vaduz.php delete mode 100644 src/Earth/Timezone/Europe/Vatican.php delete mode 100644 src/Earth/Timezone/Europe/Vienna.php delete mode 100644 src/Earth/Timezone/Europe/Vilnius.php delete mode 100644 src/Earth/Timezone/Europe/Volgograd.php delete mode 100644 src/Earth/Timezone/Europe/Warsaw.php delete mode 100644 src/Earth/Timezone/Europe/Zagreb.php delete mode 100644 src/Earth/Timezone/Europe/Zaporozhye.php delete mode 100644 src/Earth/Timezone/Europe/Zurich.php delete mode 100644 src/Earth/Timezone/Indian/Antananarivo.php delete mode 100644 src/Earth/Timezone/Indian/Chagos.php delete mode 100644 src/Earth/Timezone/Indian/Christmas.php delete mode 100644 src/Earth/Timezone/Indian/Cocos.php delete mode 100644 src/Earth/Timezone/Indian/Comoro.php delete mode 100644 src/Earth/Timezone/Indian/Kerguelen.php delete mode 100644 src/Earth/Timezone/Indian/Mahe.php delete mode 100644 src/Earth/Timezone/Indian/Maldives.php delete mode 100644 src/Earth/Timezone/Indian/Mauritius.php delete mode 100644 src/Earth/Timezone/Indian/Mayotte.php delete mode 100644 src/Earth/Timezone/Indian/Reunion.php delete mode 100644 src/Earth/Timezone/Pacific/Apia.php delete mode 100644 src/Earth/Timezone/Pacific/Auckland.php delete mode 100644 src/Earth/Timezone/Pacific/Bougainville.php delete mode 100644 src/Earth/Timezone/Pacific/Chatham.php delete mode 100644 src/Earth/Timezone/Pacific/Chuuk.php delete mode 100644 src/Earth/Timezone/Pacific/Easter.php delete mode 100644 src/Earth/Timezone/Pacific/Efate.php delete mode 100644 src/Earth/Timezone/Pacific/Enderbury.php delete mode 100644 src/Earth/Timezone/Pacific/Fakaofo.php delete mode 100644 src/Earth/Timezone/Pacific/Fiji.php delete mode 100644 src/Earth/Timezone/Pacific/Funafuti.php delete mode 100644 src/Earth/Timezone/Pacific/Galapagos.php delete mode 100644 src/Earth/Timezone/Pacific/Gambier.php delete mode 100644 src/Earth/Timezone/Pacific/Guadalcanal.php delete mode 100644 src/Earth/Timezone/Pacific/Guam.php delete mode 100644 src/Earth/Timezone/Pacific/Honolulu.php delete mode 100644 src/Earth/Timezone/Pacific/Johnston.php delete mode 100644 src/Earth/Timezone/Pacific/Kiritimati.php delete mode 100644 src/Earth/Timezone/Pacific/Kosrae.php delete mode 100644 src/Earth/Timezone/Pacific/Kwajalein.php delete mode 100644 src/Earth/Timezone/Pacific/Majuro.php delete mode 100644 src/Earth/Timezone/Pacific/Marquesas.php delete mode 100644 src/Earth/Timezone/Pacific/Midway.php delete mode 100644 src/Earth/Timezone/Pacific/Nauru.php delete mode 100644 src/Earth/Timezone/Pacific/Niue.php delete mode 100644 src/Earth/Timezone/Pacific/Norfolk.php delete mode 100644 src/Earth/Timezone/Pacific/Noumea.php delete mode 100644 src/Earth/Timezone/Pacific/PagoPago.php delete mode 100644 src/Earth/Timezone/Pacific/Palau.php delete mode 100644 src/Earth/Timezone/Pacific/Pitcairn.php delete mode 100644 src/Earth/Timezone/Pacific/Pohnpei.php delete mode 100644 src/Earth/Timezone/Pacific/Ponape.php delete mode 100644 src/Earth/Timezone/Pacific/PortMoresby.php delete mode 100644 src/Earth/Timezone/Pacific/Rarotonga.php delete mode 100644 src/Earth/Timezone/Pacific/Saipan.php delete mode 100644 src/Earth/Timezone/Pacific/Tahiti.php delete mode 100644 src/Earth/Timezone/Pacific/Tarawa.php delete mode 100644 src/Earth/Timezone/Pacific/Tongatapu.php delete mode 100644 src/Earth/Timezone/Pacific/Truk.php delete mode 100644 src/Earth/Timezone/Pacific/Wake.php delete mode 100644 src/Earth/Timezone/Pacific/Wallis.php delete mode 100644 src/Earth/Timezone/Pacific/Yap.php delete mode 100644 src/Earth/Timezone/UTC.php delete mode 100644 tests/Earth/Timezone/Africa/AbidjanTest.php delete mode 100644 tests/Earth/Timezone/Africa/AccraTest.php delete mode 100644 tests/Earth/Timezone/Africa/AddisAbabaTest.php delete mode 100644 tests/Earth/Timezone/Africa/AlgiersTest.php delete mode 100644 tests/Earth/Timezone/Africa/AsmaraTest.php delete mode 100644 tests/Earth/Timezone/Africa/AsmeraTest.php delete mode 100644 tests/Earth/Timezone/Africa/BamakoTest.php delete mode 100644 tests/Earth/Timezone/Africa/BanguiTest.php delete mode 100644 tests/Earth/Timezone/Africa/BanjulTest.php delete mode 100644 tests/Earth/Timezone/Africa/BissauTest.php delete mode 100644 tests/Earth/Timezone/Africa/BlantyreTest.php delete mode 100644 tests/Earth/Timezone/Africa/BrazzavilleTest.php delete mode 100644 tests/Earth/Timezone/Africa/BujumburaTest.php delete mode 100644 tests/Earth/Timezone/Africa/CairoTest.php delete mode 100644 tests/Earth/Timezone/Africa/CasablancaTest.php delete mode 100644 tests/Earth/Timezone/Africa/CeutaTest.php delete mode 100644 tests/Earth/Timezone/Africa/ConakryTest.php delete mode 100644 tests/Earth/Timezone/Africa/DakarTest.php delete mode 100644 tests/Earth/Timezone/Africa/DarEsSalaamTest.php delete mode 100644 tests/Earth/Timezone/Africa/DjiboutiTest.php delete mode 100644 tests/Earth/Timezone/Africa/DoualaTest.php delete mode 100644 tests/Earth/Timezone/Africa/ElAaiunTest.php delete mode 100644 tests/Earth/Timezone/Africa/FreetownTest.php delete mode 100644 tests/Earth/Timezone/Africa/GaboroneTest.php delete mode 100644 tests/Earth/Timezone/Africa/HarareTest.php delete mode 100644 tests/Earth/Timezone/Africa/JohannesburgTest.php delete mode 100644 tests/Earth/Timezone/Africa/JubaTest.php delete mode 100644 tests/Earth/Timezone/Africa/KampalaTest.php delete mode 100644 tests/Earth/Timezone/Africa/KhartoumTest.php delete mode 100644 tests/Earth/Timezone/Africa/KigaliTest.php delete mode 100644 tests/Earth/Timezone/Africa/KinshasaTest.php delete mode 100644 tests/Earth/Timezone/Africa/LagosTest.php delete mode 100644 tests/Earth/Timezone/Africa/LibrevilleTest.php delete mode 100644 tests/Earth/Timezone/Africa/LomeTest.php delete mode 100644 tests/Earth/Timezone/Africa/LuandaTest.php delete mode 100644 tests/Earth/Timezone/Africa/LubumbashiTest.php delete mode 100644 tests/Earth/Timezone/Africa/LusakaTest.php delete mode 100644 tests/Earth/Timezone/Africa/MalaboTest.php delete mode 100644 tests/Earth/Timezone/Africa/MaputoTest.php delete mode 100644 tests/Earth/Timezone/Africa/MaseruTest.php delete mode 100644 tests/Earth/Timezone/Africa/MbabaneTest.php delete mode 100644 tests/Earth/Timezone/Africa/MogadishuTest.php delete mode 100644 tests/Earth/Timezone/Africa/MonroviaTest.php delete mode 100644 tests/Earth/Timezone/Africa/NairobiTest.php delete mode 100644 tests/Earth/Timezone/Africa/NdjamenaTest.php delete mode 100644 tests/Earth/Timezone/Africa/NiameyTest.php delete mode 100644 tests/Earth/Timezone/Africa/NouakchottTest.php delete mode 100644 tests/Earth/Timezone/Africa/OuagadougouTest.php delete mode 100644 tests/Earth/Timezone/Africa/PortoNovoTest.php delete mode 100644 tests/Earth/Timezone/Africa/SaoTomeTest.php delete mode 100644 tests/Earth/Timezone/Africa/TimbuktuTest.php delete mode 100644 tests/Earth/Timezone/Africa/TripoliTest.php delete mode 100644 tests/Earth/Timezone/Africa/TunisTest.php delete mode 100644 tests/Earth/Timezone/Africa/WindhoekTest.php delete mode 100644 tests/Earth/Timezone/America/AdakTest.php delete mode 100644 tests/Earth/Timezone/America/AnchorageTest.php delete mode 100644 tests/Earth/Timezone/America/AnguillaTest.php delete mode 100644 tests/Earth/Timezone/America/AntiguaTest.php delete mode 100644 tests/Earth/Timezone/America/AraguainaTest.php delete mode 100644 tests/Earth/Timezone/America/Argentina/BuenosAiresTest.php delete mode 100644 tests/Earth/Timezone/America/Argentina/CatamarcaTest.php delete mode 100644 tests/Earth/Timezone/America/Argentina/ComodRivadaviaTest.php delete mode 100644 tests/Earth/Timezone/America/Argentina/CordobaTest.php delete mode 100644 tests/Earth/Timezone/America/Argentina/JujuyTest.php delete mode 100644 tests/Earth/Timezone/America/Argentina/LaRiojaTest.php delete mode 100644 tests/Earth/Timezone/America/Argentina/MendozaTest.php delete mode 100644 tests/Earth/Timezone/America/Argentina/RioGallegosTest.php delete mode 100644 tests/Earth/Timezone/America/Argentina/SaltaTest.php delete mode 100644 tests/Earth/Timezone/America/Argentina/SanJuanTest.php delete mode 100644 tests/Earth/Timezone/America/Argentina/SanLuisTest.php delete mode 100644 tests/Earth/Timezone/America/Argentina/TucumanTest.php delete mode 100644 tests/Earth/Timezone/America/Argentina/UshuaiaTest.php delete mode 100644 tests/Earth/Timezone/America/ArubaTest.php delete mode 100644 tests/Earth/Timezone/America/AsuncionTest.php delete mode 100644 tests/Earth/Timezone/America/AtikokanTest.php delete mode 100644 tests/Earth/Timezone/America/AtkaTest.php delete mode 100644 tests/Earth/Timezone/America/BahiaBanderasTest.php delete mode 100644 tests/Earth/Timezone/America/BahiaTest.php delete mode 100644 tests/Earth/Timezone/America/BarbadosTest.php delete mode 100644 tests/Earth/Timezone/America/BelemTest.php delete mode 100644 tests/Earth/Timezone/America/BelizeTest.php delete mode 100644 tests/Earth/Timezone/America/BlancSablonTest.php delete mode 100644 tests/Earth/Timezone/America/BoaVistaTest.php delete mode 100644 tests/Earth/Timezone/America/BogotaTest.php delete mode 100644 tests/Earth/Timezone/America/BoiseTest.php delete mode 100644 tests/Earth/Timezone/America/CambridgeBayTest.php delete mode 100644 tests/Earth/Timezone/America/CampoGrandeTest.php delete mode 100644 tests/Earth/Timezone/America/CancunTest.php delete mode 100644 tests/Earth/Timezone/America/CaracasTest.php delete mode 100644 tests/Earth/Timezone/America/CatamarcaTest.php delete mode 100644 tests/Earth/Timezone/America/CayenneTest.php delete mode 100644 tests/Earth/Timezone/America/CaymanTest.php delete mode 100644 tests/Earth/Timezone/America/ChicagoTest.php delete mode 100644 tests/Earth/Timezone/America/ChihuahuaTest.php delete mode 100644 tests/Earth/Timezone/America/CoralHarbourTest.php delete mode 100644 tests/Earth/Timezone/America/CostaRicaTest.php delete mode 100644 tests/Earth/Timezone/America/CrestonTest.php delete mode 100644 tests/Earth/Timezone/America/CuiabaTest.php delete mode 100644 tests/Earth/Timezone/America/CuracaoTest.php delete mode 100644 tests/Earth/Timezone/America/DanmarkshavnTest.php delete mode 100644 tests/Earth/Timezone/America/DawsonCreekTest.php delete mode 100644 tests/Earth/Timezone/America/DawsonTest.php delete mode 100644 tests/Earth/Timezone/America/DenverTest.php delete mode 100644 tests/Earth/Timezone/America/DetroitTest.php delete mode 100644 tests/Earth/Timezone/America/DominicaTest.php delete mode 100644 tests/Earth/Timezone/America/EdmontonTest.php delete mode 100644 tests/Earth/Timezone/America/EirunepeTest.php delete mode 100644 tests/Earth/Timezone/America/ElSalvadorTest.php delete mode 100644 tests/Earth/Timezone/America/EnsenadaTest.php delete mode 100644 tests/Earth/Timezone/America/FortWayneTest.php delete mode 100644 tests/Earth/Timezone/America/FortalezaTest.php delete mode 100644 tests/Earth/Timezone/America/GlaceBayTest.php delete mode 100644 tests/Earth/Timezone/America/GodthabTest.php delete mode 100644 tests/Earth/Timezone/America/GooseBayTest.php delete mode 100644 tests/Earth/Timezone/America/GrandTurkTest.php delete mode 100644 tests/Earth/Timezone/America/GrenadaTest.php delete mode 100644 tests/Earth/Timezone/America/GuadeloupeTest.php delete mode 100644 tests/Earth/Timezone/America/GuatemalaTest.php delete mode 100644 tests/Earth/Timezone/America/GuayaquilTest.php delete mode 100644 tests/Earth/Timezone/America/GuyanaTest.php delete mode 100644 tests/Earth/Timezone/America/HalifaxTest.php delete mode 100644 tests/Earth/Timezone/America/HavanaTest.php delete mode 100644 tests/Earth/Timezone/America/HermosilloTest.php delete mode 100644 tests/Earth/Timezone/America/Indiana/IndianapolisTest.php delete mode 100644 tests/Earth/Timezone/America/Indiana/KnoxTest.php delete mode 100644 tests/Earth/Timezone/America/Indiana/MarengoTest.php delete mode 100644 tests/Earth/Timezone/America/Indiana/PetersburgTest.php delete mode 100644 tests/Earth/Timezone/America/Indiana/TellCityTest.php delete mode 100644 tests/Earth/Timezone/America/Indiana/VevayTest.php delete mode 100644 tests/Earth/Timezone/America/Indiana/VincennesTest.php delete mode 100644 tests/Earth/Timezone/America/Indiana/WinamacTest.php delete mode 100644 tests/Earth/Timezone/America/InuvikTest.php delete mode 100644 tests/Earth/Timezone/America/IqaluitTest.php delete mode 100644 tests/Earth/Timezone/America/JamaicaTest.php delete mode 100644 tests/Earth/Timezone/America/JuneauTest.php delete mode 100644 tests/Earth/Timezone/America/KralendijkTest.php delete mode 100644 tests/Earth/Timezone/America/LaPazTest.php delete mode 100644 tests/Earth/Timezone/America/LimaTest.php delete mode 100644 tests/Earth/Timezone/America/LosAngelesTest.php delete mode 100644 tests/Earth/Timezone/America/LouisvilleTest.php delete mode 100644 tests/Earth/Timezone/America/LowerPrincesTest.php delete mode 100644 tests/Earth/Timezone/America/MaceioTest.php delete mode 100644 tests/Earth/Timezone/America/ManaguaTest.php delete mode 100644 tests/Earth/Timezone/America/ManausTest.php delete mode 100644 tests/Earth/Timezone/America/MarigotTest.php delete mode 100644 tests/Earth/Timezone/America/MartiniqueTest.php delete mode 100644 tests/Earth/Timezone/America/MatamorosTest.php delete mode 100644 tests/Earth/Timezone/America/MazatlanTest.php delete mode 100644 tests/Earth/Timezone/America/MenomineeTest.php delete mode 100644 tests/Earth/Timezone/America/MeridaTest.php delete mode 100644 tests/Earth/Timezone/America/MetlakatlaTest.php delete mode 100644 tests/Earth/Timezone/America/MexicoCityTest.php delete mode 100644 tests/Earth/Timezone/America/MiquelonTest.php delete mode 100644 tests/Earth/Timezone/America/MonctonTest.php delete mode 100644 tests/Earth/Timezone/America/MonterreyTest.php delete mode 100644 tests/Earth/Timezone/America/MontevideoTest.php delete mode 100644 tests/Earth/Timezone/America/MonticelloTest.php delete mode 100644 tests/Earth/Timezone/America/MontrealTest.php delete mode 100644 tests/Earth/Timezone/America/MontserratTest.php delete mode 100644 tests/Earth/Timezone/America/NassauTest.php delete mode 100644 tests/Earth/Timezone/America/NewYorkTest.php delete mode 100644 tests/Earth/Timezone/America/NipigonTest.php delete mode 100644 tests/Earth/Timezone/America/NomeTest.php delete mode 100644 tests/Earth/Timezone/America/NoronhaTest.php delete mode 100644 tests/Earth/Timezone/America/NorthDakota/BeulahTest.php delete mode 100644 tests/Earth/Timezone/America/NorthDakota/CenterTest.php delete mode 100644 tests/Earth/Timezone/America/NorthDakota/NewSalemTest.php delete mode 100644 tests/Earth/Timezone/America/OjinagaTest.php delete mode 100644 tests/Earth/Timezone/America/PanamaTest.php delete mode 100644 tests/Earth/Timezone/America/PangnirtungTest.php delete mode 100644 tests/Earth/Timezone/America/ParamariboTest.php delete mode 100644 tests/Earth/Timezone/America/PhoenixTest.php delete mode 100644 tests/Earth/Timezone/America/PortAuPrinceTest.php delete mode 100644 tests/Earth/Timezone/America/PortOfSpainTest.php delete mode 100644 tests/Earth/Timezone/America/PortoAcreTest.php delete mode 100644 tests/Earth/Timezone/America/PortoVelhoTest.php delete mode 100644 tests/Earth/Timezone/America/PuertoRicoTest.php delete mode 100644 tests/Earth/Timezone/America/RainyRiverTest.php delete mode 100644 tests/Earth/Timezone/America/RankinInletTest.php delete mode 100644 tests/Earth/Timezone/America/RecifeTest.php delete mode 100644 tests/Earth/Timezone/America/ReginaTest.php delete mode 100644 tests/Earth/Timezone/America/ResoluteTest.php delete mode 100644 tests/Earth/Timezone/America/RioBrancoTest.php delete mode 100644 tests/Earth/Timezone/America/RosarioTest.php delete mode 100644 tests/Earth/Timezone/America/SaintBarthelemyTest.php delete mode 100644 tests/Earth/Timezone/America/SaintJohnsTest.php delete mode 100644 tests/Earth/Timezone/America/SaintKittsTest.php delete mode 100644 tests/Earth/Timezone/America/SaintLuciaTest.php delete mode 100644 tests/Earth/Timezone/America/SaintThomasTest.php delete mode 100644 tests/Earth/Timezone/America/SaintVincentTest.php delete mode 100644 tests/Earth/Timezone/America/SantaIsabelTest.php delete mode 100644 tests/Earth/Timezone/America/SantaremTest.php delete mode 100644 tests/Earth/Timezone/America/SantiagoTest.php delete mode 100644 tests/Earth/Timezone/America/SantoDomingoTest.php delete mode 100644 tests/Earth/Timezone/America/SaoPauloTest.php delete mode 100644 tests/Earth/Timezone/America/ScoresbysundTest.php delete mode 100644 tests/Earth/Timezone/America/ShiprockTest.php delete mode 100644 tests/Earth/Timezone/America/SitkaTest.php delete mode 100644 tests/Earth/Timezone/America/SwiftCurrentTest.php delete mode 100644 tests/Earth/Timezone/America/TegucigalpaTest.php delete mode 100644 tests/Earth/Timezone/America/ThuleTest.php delete mode 100644 tests/Earth/Timezone/America/ThunderBayTest.php delete mode 100644 tests/Earth/Timezone/America/TijuanaTest.php delete mode 100644 tests/Earth/Timezone/America/TorontoTest.php delete mode 100644 tests/Earth/Timezone/America/TortolaTest.php delete mode 100644 tests/Earth/Timezone/America/VancouverTest.php delete mode 100644 tests/Earth/Timezone/America/VirginTest.php delete mode 100644 tests/Earth/Timezone/America/WhitehorseTest.php delete mode 100644 tests/Earth/Timezone/America/WinnipegTest.php delete mode 100644 tests/Earth/Timezone/America/YakutatTest.php delete mode 100644 tests/Earth/Timezone/America/YellowknifeTest.php delete mode 100644 tests/Earth/Timezone/Antarctica/CaseyTest.php delete mode 100644 tests/Earth/Timezone/Antarctica/DavisTest.php delete mode 100644 tests/Earth/Timezone/Antarctica/DumontDUrvilleTest.php delete mode 100644 tests/Earth/Timezone/Antarctica/MacquarieTest.php delete mode 100644 tests/Earth/Timezone/Antarctica/MawsonTest.php delete mode 100644 tests/Earth/Timezone/Antarctica/McMurdoTest.php delete mode 100644 tests/Earth/Timezone/Antarctica/PalmerTest.php delete mode 100644 tests/Earth/Timezone/Antarctica/RotheraTest.php delete mode 100644 tests/Earth/Timezone/Antarctica/SouthPoleTest.php delete mode 100644 tests/Earth/Timezone/Antarctica/SyowaTest.php delete mode 100644 tests/Earth/Timezone/Antarctica/TrollTest.php delete mode 100644 tests/Earth/Timezone/Antarctica/VostokTest.php delete mode 100644 tests/Earth/Timezone/Arctic/LongyearbyenTest.php delete mode 100644 tests/Earth/Timezone/Asia/AdenTest.php delete mode 100644 tests/Earth/Timezone/Asia/AlmatyTest.php delete mode 100644 tests/Earth/Timezone/Asia/AmmanTest.php delete mode 100644 tests/Earth/Timezone/Asia/AnadyrTest.php delete mode 100644 tests/Earth/Timezone/Asia/AqtauTest.php delete mode 100644 tests/Earth/Timezone/Asia/AqtobeTest.php delete mode 100644 tests/Earth/Timezone/Asia/AshgabatTest.php delete mode 100644 tests/Earth/Timezone/Asia/AshkhabadTest.php delete mode 100644 tests/Earth/Timezone/Asia/BaghdadTest.php delete mode 100644 tests/Earth/Timezone/Asia/BahrainTest.php delete mode 100644 tests/Earth/Timezone/Asia/BakuTest.php delete mode 100644 tests/Earth/Timezone/Asia/BangkokTest.php delete mode 100644 tests/Earth/Timezone/Asia/BeirutTest.php delete mode 100644 tests/Earth/Timezone/Asia/BishkekTest.php delete mode 100644 tests/Earth/Timezone/Asia/BruneiTest.php delete mode 100644 tests/Earth/Timezone/Asia/CalcuttaTest.php delete mode 100644 tests/Earth/Timezone/Asia/ChitaTest.php delete mode 100644 tests/Earth/Timezone/Asia/ChoibalsanTest.php delete mode 100644 tests/Earth/Timezone/Asia/ChongqingTest.php delete mode 100644 tests/Earth/Timezone/Asia/ChungkingTest.php delete mode 100644 tests/Earth/Timezone/Asia/ColomboTest.php delete mode 100644 tests/Earth/Timezone/Asia/DaccaTest.php delete mode 100644 tests/Earth/Timezone/Asia/DamascusTest.php delete mode 100644 tests/Earth/Timezone/Asia/DhakaTest.php delete mode 100644 tests/Earth/Timezone/Asia/DiliTest.php delete mode 100644 tests/Earth/Timezone/Asia/DubaiTest.php delete mode 100644 tests/Earth/Timezone/Asia/DushanbeTest.php delete mode 100644 tests/Earth/Timezone/Asia/GazaTest.php delete mode 100644 tests/Earth/Timezone/Asia/HarbinTest.php delete mode 100644 tests/Earth/Timezone/Asia/HebronTest.php delete mode 100644 tests/Earth/Timezone/Asia/HoChiMinhTest.php delete mode 100644 tests/Earth/Timezone/Asia/HongKongTest.php delete mode 100644 tests/Earth/Timezone/Asia/HovdTest.php delete mode 100644 tests/Earth/Timezone/Asia/IrkutskTest.php delete mode 100644 tests/Earth/Timezone/Asia/IstanbulTest.php delete mode 100644 tests/Earth/Timezone/Asia/JakartaTest.php delete mode 100644 tests/Earth/Timezone/Asia/JayapuraTest.php delete mode 100644 tests/Earth/Timezone/Asia/JerusalemTest.php delete mode 100644 tests/Earth/Timezone/Asia/KabulTest.php delete mode 100644 tests/Earth/Timezone/Asia/KamchatkaTest.php delete mode 100644 tests/Earth/Timezone/Asia/KarachiTest.php delete mode 100644 tests/Earth/Timezone/Asia/KathmanduTest.php delete mode 100644 tests/Earth/Timezone/Asia/KatmanduTest.php delete mode 100644 tests/Earth/Timezone/Asia/KhandygaTest.php delete mode 100644 tests/Earth/Timezone/Asia/KolkataTest.php delete mode 100644 tests/Earth/Timezone/Asia/KrasnoyarskTest.php delete mode 100644 tests/Earth/Timezone/Asia/KualaLumpurTest.php delete mode 100644 tests/Earth/Timezone/Asia/KuchingTest.php delete mode 100644 tests/Earth/Timezone/Asia/KuwaitTest.php delete mode 100644 tests/Earth/Timezone/Asia/MacaoTest.php delete mode 100644 tests/Earth/Timezone/Asia/MacauTest.php delete mode 100644 tests/Earth/Timezone/Asia/MagadanTest.php delete mode 100644 tests/Earth/Timezone/Asia/MakassarTest.php delete mode 100644 tests/Earth/Timezone/Asia/ManilaTest.php delete mode 100644 tests/Earth/Timezone/Asia/MuscatTest.php delete mode 100644 tests/Earth/Timezone/Asia/NicosiaTest.php delete mode 100644 tests/Earth/Timezone/Asia/NovokuznetskTest.php delete mode 100644 tests/Earth/Timezone/Asia/NovosibirskTest.php delete mode 100644 tests/Earth/Timezone/Asia/OmskTest.php delete mode 100644 tests/Earth/Timezone/Asia/OralTest.php delete mode 100644 tests/Earth/Timezone/Asia/PhnomPenhTest.php delete mode 100644 tests/Earth/Timezone/Asia/PontianakTest.php delete mode 100644 tests/Earth/Timezone/Asia/PyongyangTest.php delete mode 100644 tests/Earth/Timezone/Asia/QatarTest.php delete mode 100644 tests/Earth/Timezone/Asia/QyzylordaTest.php delete mode 100644 tests/Earth/Timezone/Asia/RangoonTest.php delete mode 100644 tests/Earth/Timezone/Asia/RiyadhTest.php delete mode 100644 tests/Earth/Timezone/Asia/SaigonTest.php delete mode 100644 tests/Earth/Timezone/Asia/SakhalinTest.php delete mode 100644 tests/Earth/Timezone/Asia/SamarkandTest.php delete mode 100644 tests/Earth/Timezone/Asia/SeoulTest.php delete mode 100644 tests/Earth/Timezone/Asia/ShanghaiTest.php delete mode 100644 tests/Earth/Timezone/Asia/SingaporeTest.php delete mode 100644 tests/Earth/Timezone/Asia/SrednekolymskTest.php delete mode 100644 tests/Earth/Timezone/Asia/TaipeiTest.php delete mode 100644 tests/Earth/Timezone/Asia/TashkentTest.php delete mode 100644 tests/Earth/Timezone/Asia/TbilisiTest.php delete mode 100644 tests/Earth/Timezone/Asia/TehranTest.php delete mode 100644 tests/Earth/Timezone/Asia/TelAvivTest.php delete mode 100644 tests/Earth/Timezone/Asia/ThimbuTest.php delete mode 100644 tests/Earth/Timezone/Asia/ThimphuTest.php delete mode 100644 tests/Earth/Timezone/Asia/TokyoTest.php delete mode 100644 tests/Earth/Timezone/Asia/UjungPandangTest.php delete mode 100644 tests/Earth/Timezone/Asia/UlaanbaatarTest.php delete mode 100644 tests/Earth/Timezone/Asia/UlanBatorTest.php delete mode 100644 tests/Earth/Timezone/Asia/UstNeraTest.php delete mode 100644 tests/Earth/Timezone/Asia/VientianeTest.php delete mode 100644 tests/Earth/Timezone/Asia/VladivostokTest.php delete mode 100644 tests/Earth/Timezone/Asia/YakutskTest.php delete mode 100644 tests/Earth/Timezone/Asia/YekaterinburgTest.php delete mode 100644 tests/Earth/Timezone/Asia/YerevanTest.php delete mode 100644 tests/Earth/Timezone/Atlantic/AzoresTest.php delete mode 100644 tests/Earth/Timezone/Atlantic/BermudaTest.php delete mode 100644 tests/Earth/Timezone/Atlantic/CanaryTest.php delete mode 100644 tests/Earth/Timezone/Atlantic/CapeVerdeTest.php delete mode 100644 tests/Earth/Timezone/Atlantic/FaeroeTest.php delete mode 100644 tests/Earth/Timezone/Atlantic/FaroeTest.php delete mode 100644 tests/Earth/Timezone/Atlantic/JanMayenTest.php delete mode 100644 tests/Earth/Timezone/Atlantic/MadeiraTest.php delete mode 100644 tests/Earth/Timezone/Atlantic/ReykjavikTest.php delete mode 100644 tests/Earth/Timezone/Atlantic/SaintHelenaTest.php delete mode 100644 tests/Earth/Timezone/Atlantic/SouthGeorgiaTest.php delete mode 100644 tests/Earth/Timezone/Atlantic/StanleyTest.php delete mode 100644 tests/Earth/Timezone/Australia/AdelaideTest.php delete mode 100644 tests/Earth/Timezone/Australia/AustralianCapitalTerritoryTest.php delete mode 100644 tests/Earth/Timezone/Australia/BrisbaneTest.php delete mode 100644 tests/Earth/Timezone/Australia/BrokenHillTest.php delete mode 100644 tests/Earth/Timezone/Australia/CanberraTest.php delete mode 100644 tests/Earth/Timezone/Australia/CurrieTest.php delete mode 100644 tests/Earth/Timezone/Australia/DarwinTest.php delete mode 100644 tests/Earth/Timezone/Australia/EuclaTest.php delete mode 100644 tests/Earth/Timezone/Australia/HobartTest.php delete mode 100644 tests/Earth/Timezone/Australia/LindemanTest.php delete mode 100644 tests/Earth/Timezone/Australia/LordeHoweIslandTest.php delete mode 100644 tests/Earth/Timezone/Australia/MelbourneTest.php delete mode 100644 tests/Earth/Timezone/Australia/NewSouthWalesTest.php delete mode 100644 tests/Earth/Timezone/Australia/NorthTest.php delete mode 100644 tests/Earth/Timezone/Australia/PerthTest.php delete mode 100644 tests/Earth/Timezone/Australia/QueenslandTest.php delete mode 100644 tests/Earth/Timezone/Australia/SouthTest.php delete mode 100644 tests/Earth/Timezone/Australia/SydneyTest.php delete mode 100644 tests/Earth/Timezone/Australia/TasmaniaTest.php delete mode 100644 tests/Earth/Timezone/Australia/VictoriaTest.php delete mode 100644 tests/Earth/Timezone/Australia/WestTest.php delete mode 100644 tests/Earth/Timezone/Australia/YancowinnaTest.php delete mode 100644 tests/Earth/Timezone/Europe/AmsterdamTest.php delete mode 100644 tests/Earth/Timezone/Europe/AndorraTest.php delete mode 100644 tests/Earth/Timezone/Europe/AthensTest.php delete mode 100644 tests/Earth/Timezone/Europe/BelfastTest.php delete mode 100644 tests/Earth/Timezone/Europe/BelgradeTest.php delete mode 100644 tests/Earth/Timezone/Europe/BerlinTest.php delete mode 100644 tests/Earth/Timezone/Europe/BratislavaTest.php delete mode 100644 tests/Earth/Timezone/Europe/BrusselsTest.php delete mode 100644 tests/Earth/Timezone/Europe/BucharestTest.php delete mode 100644 tests/Earth/Timezone/Europe/BudapestTest.php delete mode 100644 tests/Earth/Timezone/Europe/BusingenTest.php delete mode 100644 tests/Earth/Timezone/Europe/ChisinauTest.php delete mode 100644 tests/Earth/Timezone/Europe/CopenhagenTest.php delete mode 100644 tests/Earth/Timezone/Europe/DublinTest.php delete mode 100644 tests/Earth/Timezone/Europe/GibraltarTest.php delete mode 100644 tests/Earth/Timezone/Europe/GuernseyTest.php delete mode 100644 tests/Earth/Timezone/Europe/HelsinkiTest.php delete mode 100644 tests/Earth/Timezone/Europe/IsleOfManTest.php delete mode 100644 tests/Earth/Timezone/Europe/IstanbulTest.php delete mode 100644 tests/Earth/Timezone/Europe/JerseyTest.php delete mode 100644 tests/Earth/Timezone/Europe/KaliningradTest.php delete mode 100644 tests/Earth/Timezone/Europe/KievTest.php delete mode 100644 tests/Earth/Timezone/Europe/LisbonTest.php delete mode 100644 tests/Earth/Timezone/Europe/LjubljanaTest.php delete mode 100644 tests/Earth/Timezone/Europe/LondonTest.php delete mode 100644 tests/Earth/Timezone/Europe/LuxembourgTest.php delete mode 100644 tests/Earth/Timezone/Europe/MadridTest.php delete mode 100644 tests/Earth/Timezone/Europe/MaltaTest.php delete mode 100644 tests/Earth/Timezone/Europe/MariehamnTest.php delete mode 100644 tests/Earth/Timezone/Europe/MinskTest.php delete mode 100644 tests/Earth/Timezone/Europe/MonacoTest.php delete mode 100644 tests/Earth/Timezone/Europe/MoscowTest.php delete mode 100644 tests/Earth/Timezone/Europe/NicosiaTest.php delete mode 100644 tests/Earth/Timezone/Europe/OsloTest.php delete mode 100644 tests/Earth/Timezone/Europe/ParisTest.php delete mode 100644 tests/Earth/Timezone/Europe/PodgoricaTest.php delete mode 100644 tests/Earth/Timezone/Europe/PragueTest.php delete mode 100644 tests/Earth/Timezone/Europe/RigaTest.php delete mode 100644 tests/Earth/Timezone/Europe/RomeTest.php delete mode 100644 tests/Earth/Timezone/Europe/SamaraTest.php delete mode 100644 tests/Earth/Timezone/Europe/SanMarinoTest.php delete mode 100644 tests/Earth/Timezone/Europe/SarajevoTest.php delete mode 100644 tests/Earth/Timezone/Europe/SimferopolTest.php delete mode 100644 tests/Earth/Timezone/Europe/SkopjeTest.php delete mode 100644 tests/Earth/Timezone/Europe/SofiaTest.php delete mode 100644 tests/Earth/Timezone/Europe/StockholmTest.php delete mode 100644 tests/Earth/Timezone/Europe/TallinnTest.php delete mode 100644 tests/Earth/Timezone/Europe/TiraneTest.php delete mode 100644 tests/Earth/Timezone/Europe/TiraspolTest.php delete mode 100644 tests/Earth/Timezone/Europe/UzhgorodTest.php delete mode 100644 tests/Earth/Timezone/Europe/VaduzTest.php delete mode 100644 tests/Earth/Timezone/Europe/VaticanTest.php delete mode 100644 tests/Earth/Timezone/Europe/ViennaTest.php delete mode 100644 tests/Earth/Timezone/Europe/VilniusTest.php delete mode 100644 tests/Earth/Timezone/Europe/VolgogradTest.php delete mode 100644 tests/Earth/Timezone/Europe/WarsawTest.php delete mode 100644 tests/Earth/Timezone/Europe/ZagrebTest.php delete mode 100644 tests/Earth/Timezone/Europe/ZaporozhyeTest.php delete mode 100644 tests/Earth/Timezone/Europe/ZurichTest.php delete mode 100644 tests/Earth/Timezone/Indian/AntananarivoTest.php delete mode 100644 tests/Earth/Timezone/Indian/ChagosTest.php delete mode 100644 tests/Earth/Timezone/Indian/ChristmasTest.php delete mode 100644 tests/Earth/Timezone/Indian/CocosTest.php delete mode 100644 tests/Earth/Timezone/Indian/ComoroTest.php delete mode 100644 tests/Earth/Timezone/Indian/KerguelenTest.php delete mode 100644 tests/Earth/Timezone/Indian/MaheTest.php delete mode 100644 tests/Earth/Timezone/Indian/MaldivesTest.php delete mode 100644 tests/Earth/Timezone/Indian/MauritiusTest.php delete mode 100644 tests/Earth/Timezone/Indian/MayotteTest.php delete mode 100644 tests/Earth/Timezone/Indian/ReunionTest.php delete mode 100644 tests/Earth/Timezone/Pacific/ApiaTest.php delete mode 100644 tests/Earth/Timezone/Pacific/AucklandTest.php delete mode 100644 tests/Earth/Timezone/Pacific/BougainvilleTest.php delete mode 100644 tests/Earth/Timezone/Pacific/ChathamTest.php delete mode 100644 tests/Earth/Timezone/Pacific/ChuukTest.php delete mode 100644 tests/Earth/Timezone/Pacific/EasterTest.php delete mode 100644 tests/Earth/Timezone/Pacific/EfateTest.php delete mode 100644 tests/Earth/Timezone/Pacific/EnderburyTest.php delete mode 100644 tests/Earth/Timezone/Pacific/FakaofoTest.php delete mode 100644 tests/Earth/Timezone/Pacific/FijiTest.php delete mode 100644 tests/Earth/Timezone/Pacific/FunafutiTest.php delete mode 100644 tests/Earth/Timezone/Pacific/GalapagosTest.php delete mode 100644 tests/Earth/Timezone/Pacific/GambierTest.php delete mode 100644 tests/Earth/Timezone/Pacific/GuadalcanalTest.php delete mode 100644 tests/Earth/Timezone/Pacific/GuamTest.php delete mode 100644 tests/Earth/Timezone/Pacific/HonoluluTest.php delete mode 100644 tests/Earth/Timezone/Pacific/JohnstonTest.php delete mode 100644 tests/Earth/Timezone/Pacific/KiritimatiTest.php delete mode 100644 tests/Earth/Timezone/Pacific/KosraeTest.php delete mode 100644 tests/Earth/Timezone/Pacific/KwajaleinTest.php delete mode 100644 tests/Earth/Timezone/Pacific/MajuroTest.php delete mode 100644 tests/Earth/Timezone/Pacific/MarquesasTest.php delete mode 100644 tests/Earth/Timezone/Pacific/MidwayTest.php delete mode 100644 tests/Earth/Timezone/Pacific/NauruTest.php delete mode 100644 tests/Earth/Timezone/Pacific/NiueTest.php delete mode 100644 tests/Earth/Timezone/Pacific/NorfolkTest.php delete mode 100644 tests/Earth/Timezone/Pacific/NoumeaTest.php delete mode 100644 tests/Earth/Timezone/Pacific/PagoPagoTest.php delete mode 100644 tests/Earth/Timezone/Pacific/PalauTest.php delete mode 100644 tests/Earth/Timezone/Pacific/PitcairnTest.php delete mode 100644 tests/Earth/Timezone/Pacific/PohnpeiTest.php delete mode 100644 tests/Earth/Timezone/Pacific/PonapeTest.php delete mode 100644 tests/Earth/Timezone/Pacific/PortMoresbyTest.php delete mode 100644 tests/Earth/Timezone/Pacific/RarotongaTest.php delete mode 100644 tests/Earth/Timezone/Pacific/SaipanTest.php delete mode 100644 tests/Earth/Timezone/Pacific/TahitiTest.php delete mode 100644 tests/Earth/Timezone/Pacific/TarawaTest.php delete mode 100644 tests/Earth/Timezone/Pacific/TongatapuTest.php delete mode 100644 tests/Earth/Timezone/Pacific/TrukTest.php delete mode 100644 tests/Earth/Timezone/Pacific/WakeTest.php delete mode 100644 tests/Earth/Timezone/Pacific/WallisTest.php delete mode 100644 tests/Earth/Timezone/Pacific/YapTest.php delete mode 100644 tests/Earth/Timezone/UTCTest.php diff --git a/CHANGELOG.md b/CHANGELOG.md index 69b3b54..70a0b4e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,7 @@ - `Innmind\TimeContinuum\Earth\PointInTime\PointInTime` - `Innmind\TimeContinuum\Earth\PointInTime\Now` - `Innmind\TimeContinuum\Earth\PointInTime\HighResolution` +- Earth timezones ## 3.4.1 - 2023-09-17 diff --git a/src/Earth/Timezone.php b/src/Earth/Timezone.php deleted file mode 100644 index 25309dd..0000000 --- a/src/Earth/Timezone.php +++ /dev/null @@ -1,51 +0,0 @@ -getOffset( - $now = new \DateTimeImmutable('now', $zone), - ); - $this->utc = new Timezone\UTC( - $hour = (int) ($currentOffset / 3600), - (int) \abs(\round(($currentOffset - $hour * 3600) / 60)), - ); - $this->dst = (bool) (int) $now->format('I'); - } - - final public function hours(): int - { - return $this->utc->hours(); - } - - final public function minutes(): int - { - return $this->utc->minutes(); - } - - final public function daylightSavingTimeApplied(): bool - { - return $this->dst; - } - - final public function toString(): string - { - return $this->utc->toString(); - } -} diff --git a/src/Earth/Timezone/Africa/Abidjan.php b/src/Earth/Timezone/Africa/Abidjan.php deleted file mode 100644 index cc42691..0000000 --- a/src/Earth/Timezone/Africa/Abidjan.php +++ /dev/null @@ -1,17 +0,0 @@ - 14 || - $minutes < 0 || - $minutes > 59 - ) { - throw new InvalidTimezone("$hours:$minutes"); - } - - $this->hours = $hours; - $this->minutes = $minutes; - $this->string = $this->format($hours, $minutes); - } - - /** - * @psalm-pure - */ - public static function daylightSavingTime(int $hours, int $minutes = 0): self - { - $self = new self($hours, $minutes); - $self->dst = true; - - return $self; - } - - /** - * @psalm-pure - */ - public static function of(string $zone): self - { - if (\mb_strtolower($zone) === 'z') { - return new self; - } - - [$hours, $minutes] = \explode(':', $zone); - - return new self((int) $hours, (int) $minutes); - } - - public function hours(): int - { - return $this->hours; - } - - public function minutes(): int - { - return $this->minutes; - } - - public function daylightSavingTimeApplied(): bool - { - return $this->dst; - } - - public function toString(): string - { - return $this->string; - } - - /** - * @return non-empty-string - */ - private function format(int $hours, int $minutes): string - { - if ($hours === 0 && $minutes === 0) { - return 'Z'; - } - - /** @var non-empty-string */ - return \sprintf( - '%s%02d:%02d', - $hours > 0 ? '+' : '-', - \abs($hours), - $minutes, - ); - } -} diff --git a/tests/Earth/Timezone/Africa/AbidjanTest.php b/tests/Earth/Timezone/Africa/AbidjanTest.php deleted file mode 100644 index 9649b96..0000000 --- a/tests/Earth/Timezone/Africa/AbidjanTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Africa/AccraTest.php b/tests/Earth/Timezone/Africa/AccraTest.php deleted file mode 100644 index 2ad208a..0000000 --- a/tests/Earth/Timezone/Africa/AccraTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Africa/AddisAbabaTest.php b/tests/Earth/Timezone/Africa/AddisAbabaTest.php deleted file mode 100644 index 04b9a2a..0000000 --- a/tests/Earth/Timezone/Africa/AddisAbabaTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Africa/AlgiersTest.php b/tests/Earth/Timezone/Africa/AlgiersTest.php deleted file mode 100644 index 28c9475..0000000 --- a/tests/Earth/Timezone/Africa/AlgiersTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Africa/AsmaraTest.php b/tests/Earth/Timezone/Africa/AsmaraTest.php deleted file mode 100644 index 5c0bfbe..0000000 --- a/tests/Earth/Timezone/Africa/AsmaraTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Africa/AsmeraTest.php b/tests/Earth/Timezone/Africa/AsmeraTest.php deleted file mode 100644 index 0b14782..0000000 --- a/tests/Earth/Timezone/Africa/AsmeraTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Africa/BamakoTest.php b/tests/Earth/Timezone/Africa/BamakoTest.php deleted file mode 100644 index ee6dce1..0000000 --- a/tests/Earth/Timezone/Africa/BamakoTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Africa/BanguiTest.php b/tests/Earth/Timezone/Africa/BanguiTest.php deleted file mode 100644 index a114954..0000000 --- a/tests/Earth/Timezone/Africa/BanguiTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Africa/BanjulTest.php b/tests/Earth/Timezone/Africa/BanjulTest.php deleted file mode 100644 index 54b654e..0000000 --- a/tests/Earth/Timezone/Africa/BanjulTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Africa/BissauTest.php b/tests/Earth/Timezone/Africa/BissauTest.php deleted file mode 100644 index bd98410..0000000 --- a/tests/Earth/Timezone/Africa/BissauTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Africa/BlantyreTest.php b/tests/Earth/Timezone/Africa/BlantyreTest.php deleted file mode 100644 index 85ad029..0000000 --- a/tests/Earth/Timezone/Africa/BlantyreTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Africa/BrazzavilleTest.php b/tests/Earth/Timezone/Africa/BrazzavilleTest.php deleted file mode 100644 index e980c9b..0000000 --- a/tests/Earth/Timezone/Africa/BrazzavilleTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Africa/BujumburaTest.php b/tests/Earth/Timezone/Africa/BujumburaTest.php deleted file mode 100644 index 0ac4d56..0000000 --- a/tests/Earth/Timezone/Africa/BujumburaTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Africa/CairoTest.php b/tests/Earth/Timezone/Africa/CairoTest.php deleted file mode 100644 index ace13b9..0000000 --- a/tests/Earth/Timezone/Africa/CairoTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Africa/CasablancaTest.php b/tests/Earth/Timezone/Africa/CasablancaTest.php deleted file mode 100644 index 2db4b48..0000000 --- a/tests/Earth/Timezone/Africa/CasablancaTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Africa/CeutaTest.php b/tests/Earth/Timezone/Africa/CeutaTest.php deleted file mode 100644 index b347cb9..0000000 --- a/tests/Earth/Timezone/Africa/CeutaTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Africa/ConakryTest.php b/tests/Earth/Timezone/Africa/ConakryTest.php deleted file mode 100644 index b2e1dde..0000000 --- a/tests/Earth/Timezone/Africa/ConakryTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Africa/DakarTest.php b/tests/Earth/Timezone/Africa/DakarTest.php deleted file mode 100644 index ebffedb..0000000 --- a/tests/Earth/Timezone/Africa/DakarTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Africa/DarEsSalaamTest.php b/tests/Earth/Timezone/Africa/DarEsSalaamTest.php deleted file mode 100644 index 4b67a6a..0000000 --- a/tests/Earth/Timezone/Africa/DarEsSalaamTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Africa/DjiboutiTest.php b/tests/Earth/Timezone/Africa/DjiboutiTest.php deleted file mode 100644 index c253b16..0000000 --- a/tests/Earth/Timezone/Africa/DjiboutiTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Africa/DoualaTest.php b/tests/Earth/Timezone/Africa/DoualaTest.php deleted file mode 100644 index f6932c8..0000000 --- a/tests/Earth/Timezone/Africa/DoualaTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Africa/ElAaiunTest.php b/tests/Earth/Timezone/Africa/ElAaiunTest.php deleted file mode 100644 index 14738ae..0000000 --- a/tests/Earth/Timezone/Africa/ElAaiunTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Africa/FreetownTest.php b/tests/Earth/Timezone/Africa/FreetownTest.php deleted file mode 100644 index ded5fd4..0000000 --- a/tests/Earth/Timezone/Africa/FreetownTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Africa/GaboroneTest.php b/tests/Earth/Timezone/Africa/GaboroneTest.php deleted file mode 100644 index 3fd9f8c..0000000 --- a/tests/Earth/Timezone/Africa/GaboroneTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Africa/HarareTest.php b/tests/Earth/Timezone/Africa/HarareTest.php deleted file mode 100644 index d13689a..0000000 --- a/tests/Earth/Timezone/Africa/HarareTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Africa/JohannesburgTest.php b/tests/Earth/Timezone/Africa/JohannesburgTest.php deleted file mode 100644 index 76f05f9..0000000 --- a/tests/Earth/Timezone/Africa/JohannesburgTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Africa/JubaTest.php b/tests/Earth/Timezone/Africa/JubaTest.php deleted file mode 100644 index d44649a..0000000 --- a/tests/Earth/Timezone/Africa/JubaTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Africa/KampalaTest.php b/tests/Earth/Timezone/Africa/KampalaTest.php deleted file mode 100644 index 616f325..0000000 --- a/tests/Earth/Timezone/Africa/KampalaTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Africa/KhartoumTest.php b/tests/Earth/Timezone/Africa/KhartoumTest.php deleted file mode 100644 index 2b259c4..0000000 --- a/tests/Earth/Timezone/Africa/KhartoumTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Africa/KigaliTest.php b/tests/Earth/Timezone/Africa/KigaliTest.php deleted file mode 100644 index fbe3ad9..0000000 --- a/tests/Earth/Timezone/Africa/KigaliTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Africa/KinshasaTest.php b/tests/Earth/Timezone/Africa/KinshasaTest.php deleted file mode 100644 index 78e89ef..0000000 --- a/tests/Earth/Timezone/Africa/KinshasaTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Africa/LagosTest.php b/tests/Earth/Timezone/Africa/LagosTest.php deleted file mode 100644 index edc4172..0000000 --- a/tests/Earth/Timezone/Africa/LagosTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Africa/LibrevilleTest.php b/tests/Earth/Timezone/Africa/LibrevilleTest.php deleted file mode 100644 index 73f3562..0000000 --- a/tests/Earth/Timezone/Africa/LibrevilleTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Africa/LomeTest.php b/tests/Earth/Timezone/Africa/LomeTest.php deleted file mode 100644 index 7250e23..0000000 --- a/tests/Earth/Timezone/Africa/LomeTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Africa/LuandaTest.php b/tests/Earth/Timezone/Africa/LuandaTest.php deleted file mode 100644 index afdcf5f..0000000 --- a/tests/Earth/Timezone/Africa/LuandaTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Africa/LubumbashiTest.php b/tests/Earth/Timezone/Africa/LubumbashiTest.php deleted file mode 100644 index bbdcc86..0000000 --- a/tests/Earth/Timezone/Africa/LubumbashiTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Africa/LusakaTest.php b/tests/Earth/Timezone/Africa/LusakaTest.php deleted file mode 100644 index bc037df..0000000 --- a/tests/Earth/Timezone/Africa/LusakaTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Africa/MalaboTest.php b/tests/Earth/Timezone/Africa/MalaboTest.php deleted file mode 100644 index 39522d0..0000000 --- a/tests/Earth/Timezone/Africa/MalaboTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Africa/MaputoTest.php b/tests/Earth/Timezone/Africa/MaputoTest.php deleted file mode 100644 index ee8400e..0000000 --- a/tests/Earth/Timezone/Africa/MaputoTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Africa/MaseruTest.php b/tests/Earth/Timezone/Africa/MaseruTest.php deleted file mode 100644 index befa5e0..0000000 --- a/tests/Earth/Timezone/Africa/MaseruTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Africa/MbabaneTest.php b/tests/Earth/Timezone/Africa/MbabaneTest.php deleted file mode 100644 index 134f6ce..0000000 --- a/tests/Earth/Timezone/Africa/MbabaneTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Africa/MogadishuTest.php b/tests/Earth/Timezone/Africa/MogadishuTest.php deleted file mode 100644 index 34ef0fc..0000000 --- a/tests/Earth/Timezone/Africa/MogadishuTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Africa/MonroviaTest.php b/tests/Earth/Timezone/Africa/MonroviaTest.php deleted file mode 100644 index d0baf90..0000000 --- a/tests/Earth/Timezone/Africa/MonroviaTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Africa/NairobiTest.php b/tests/Earth/Timezone/Africa/NairobiTest.php deleted file mode 100644 index c52c8fa..0000000 --- a/tests/Earth/Timezone/Africa/NairobiTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Africa/NdjamenaTest.php b/tests/Earth/Timezone/Africa/NdjamenaTest.php deleted file mode 100644 index 68f9856..0000000 --- a/tests/Earth/Timezone/Africa/NdjamenaTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Africa/NiameyTest.php b/tests/Earth/Timezone/Africa/NiameyTest.php deleted file mode 100644 index d43a5bc..0000000 --- a/tests/Earth/Timezone/Africa/NiameyTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Africa/NouakchottTest.php b/tests/Earth/Timezone/Africa/NouakchottTest.php deleted file mode 100644 index 84bb4e2..0000000 --- a/tests/Earth/Timezone/Africa/NouakchottTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Africa/OuagadougouTest.php b/tests/Earth/Timezone/Africa/OuagadougouTest.php deleted file mode 100644 index 597e2da..0000000 --- a/tests/Earth/Timezone/Africa/OuagadougouTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Africa/PortoNovoTest.php b/tests/Earth/Timezone/Africa/PortoNovoTest.php deleted file mode 100644 index 23125d1..0000000 --- a/tests/Earth/Timezone/Africa/PortoNovoTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Africa/SaoTomeTest.php b/tests/Earth/Timezone/Africa/SaoTomeTest.php deleted file mode 100644 index 4d2c3bb..0000000 --- a/tests/Earth/Timezone/Africa/SaoTomeTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Africa/TimbuktuTest.php b/tests/Earth/Timezone/Africa/TimbuktuTest.php deleted file mode 100644 index f1152d5..0000000 --- a/tests/Earth/Timezone/Africa/TimbuktuTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Africa/TripoliTest.php b/tests/Earth/Timezone/Africa/TripoliTest.php deleted file mode 100644 index a2fee19..0000000 --- a/tests/Earth/Timezone/Africa/TripoliTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Africa/TunisTest.php b/tests/Earth/Timezone/Africa/TunisTest.php deleted file mode 100644 index 709cc1a..0000000 --- a/tests/Earth/Timezone/Africa/TunisTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Africa/WindhoekTest.php b/tests/Earth/Timezone/Africa/WindhoekTest.php deleted file mode 100644 index 3e2966a..0000000 --- a/tests/Earth/Timezone/Africa/WindhoekTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/AdakTest.php b/tests/Earth/Timezone/America/AdakTest.php deleted file mode 100644 index cd34aae..0000000 --- a/tests/Earth/Timezone/America/AdakTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/AnchorageTest.php b/tests/Earth/Timezone/America/AnchorageTest.php deleted file mode 100644 index 8be8279..0000000 --- a/tests/Earth/Timezone/America/AnchorageTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/AnguillaTest.php b/tests/Earth/Timezone/America/AnguillaTest.php deleted file mode 100644 index 301d7ef..0000000 --- a/tests/Earth/Timezone/America/AnguillaTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/AntiguaTest.php b/tests/Earth/Timezone/America/AntiguaTest.php deleted file mode 100644 index 7711f16..0000000 --- a/tests/Earth/Timezone/America/AntiguaTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/AraguainaTest.php b/tests/Earth/Timezone/America/AraguainaTest.php deleted file mode 100644 index 94ec994..0000000 --- a/tests/Earth/Timezone/America/AraguainaTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/Argentina/BuenosAiresTest.php b/tests/Earth/Timezone/America/Argentina/BuenosAiresTest.php deleted file mode 100644 index a6791dc..0000000 --- a/tests/Earth/Timezone/America/Argentina/BuenosAiresTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/Argentina/CatamarcaTest.php b/tests/Earth/Timezone/America/Argentina/CatamarcaTest.php deleted file mode 100644 index 76b12c7..0000000 --- a/tests/Earth/Timezone/America/Argentina/CatamarcaTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/Argentina/ComodRivadaviaTest.php b/tests/Earth/Timezone/America/Argentina/ComodRivadaviaTest.php deleted file mode 100644 index cb0d363..0000000 --- a/tests/Earth/Timezone/America/Argentina/ComodRivadaviaTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/Argentina/CordobaTest.php b/tests/Earth/Timezone/America/Argentina/CordobaTest.php deleted file mode 100644 index b14837b..0000000 --- a/tests/Earth/Timezone/America/Argentina/CordobaTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/Argentina/JujuyTest.php b/tests/Earth/Timezone/America/Argentina/JujuyTest.php deleted file mode 100644 index c07f9f7..0000000 --- a/tests/Earth/Timezone/America/Argentina/JujuyTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/Argentina/LaRiojaTest.php b/tests/Earth/Timezone/America/Argentina/LaRiojaTest.php deleted file mode 100644 index b5a4a07..0000000 --- a/tests/Earth/Timezone/America/Argentina/LaRiojaTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/Argentina/MendozaTest.php b/tests/Earth/Timezone/America/Argentina/MendozaTest.php deleted file mode 100644 index eec4866..0000000 --- a/tests/Earth/Timezone/America/Argentina/MendozaTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/Argentina/RioGallegosTest.php b/tests/Earth/Timezone/America/Argentina/RioGallegosTest.php deleted file mode 100644 index 03eb673..0000000 --- a/tests/Earth/Timezone/America/Argentina/RioGallegosTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/Argentina/SaltaTest.php b/tests/Earth/Timezone/America/Argentina/SaltaTest.php deleted file mode 100644 index 7e5c36d..0000000 --- a/tests/Earth/Timezone/America/Argentina/SaltaTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/Argentina/SanJuanTest.php b/tests/Earth/Timezone/America/Argentina/SanJuanTest.php deleted file mode 100644 index b5804b3..0000000 --- a/tests/Earth/Timezone/America/Argentina/SanJuanTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/Argentina/SanLuisTest.php b/tests/Earth/Timezone/America/Argentina/SanLuisTest.php deleted file mode 100644 index 014a730..0000000 --- a/tests/Earth/Timezone/America/Argentina/SanLuisTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/Argentina/TucumanTest.php b/tests/Earth/Timezone/America/Argentina/TucumanTest.php deleted file mode 100644 index bdff690..0000000 --- a/tests/Earth/Timezone/America/Argentina/TucumanTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/Argentina/UshuaiaTest.php b/tests/Earth/Timezone/America/Argentina/UshuaiaTest.php deleted file mode 100644 index d9fad70..0000000 --- a/tests/Earth/Timezone/America/Argentina/UshuaiaTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/ArubaTest.php b/tests/Earth/Timezone/America/ArubaTest.php deleted file mode 100644 index 30ae266..0000000 --- a/tests/Earth/Timezone/America/ArubaTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/AsuncionTest.php b/tests/Earth/Timezone/America/AsuncionTest.php deleted file mode 100644 index fffeb38..0000000 --- a/tests/Earth/Timezone/America/AsuncionTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/AtikokanTest.php b/tests/Earth/Timezone/America/AtikokanTest.php deleted file mode 100644 index 00f9a88..0000000 --- a/tests/Earth/Timezone/America/AtikokanTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/AtkaTest.php b/tests/Earth/Timezone/America/AtkaTest.php deleted file mode 100644 index 1d1d155..0000000 --- a/tests/Earth/Timezone/America/AtkaTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/BahiaBanderasTest.php b/tests/Earth/Timezone/America/BahiaBanderasTest.php deleted file mode 100644 index a942e70..0000000 --- a/tests/Earth/Timezone/America/BahiaBanderasTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/BahiaTest.php b/tests/Earth/Timezone/America/BahiaTest.php deleted file mode 100644 index b1f1318..0000000 --- a/tests/Earth/Timezone/America/BahiaTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/BarbadosTest.php b/tests/Earth/Timezone/America/BarbadosTest.php deleted file mode 100644 index daeb24a..0000000 --- a/tests/Earth/Timezone/America/BarbadosTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/BelemTest.php b/tests/Earth/Timezone/America/BelemTest.php deleted file mode 100644 index e6056b7..0000000 --- a/tests/Earth/Timezone/America/BelemTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/BelizeTest.php b/tests/Earth/Timezone/America/BelizeTest.php deleted file mode 100644 index 33b442d..0000000 --- a/tests/Earth/Timezone/America/BelizeTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/BlancSablonTest.php b/tests/Earth/Timezone/America/BlancSablonTest.php deleted file mode 100644 index 3203096..0000000 --- a/tests/Earth/Timezone/America/BlancSablonTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/BoaVistaTest.php b/tests/Earth/Timezone/America/BoaVistaTest.php deleted file mode 100644 index b3fb206..0000000 --- a/tests/Earth/Timezone/America/BoaVistaTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/BogotaTest.php b/tests/Earth/Timezone/America/BogotaTest.php deleted file mode 100644 index 09e77ff..0000000 --- a/tests/Earth/Timezone/America/BogotaTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/BoiseTest.php b/tests/Earth/Timezone/America/BoiseTest.php deleted file mode 100644 index f9acfe9..0000000 --- a/tests/Earth/Timezone/America/BoiseTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/CambridgeBayTest.php b/tests/Earth/Timezone/America/CambridgeBayTest.php deleted file mode 100644 index 117329a..0000000 --- a/tests/Earth/Timezone/America/CambridgeBayTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/CampoGrandeTest.php b/tests/Earth/Timezone/America/CampoGrandeTest.php deleted file mode 100644 index 95a6692..0000000 --- a/tests/Earth/Timezone/America/CampoGrandeTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/CancunTest.php b/tests/Earth/Timezone/America/CancunTest.php deleted file mode 100644 index 6f9933d..0000000 --- a/tests/Earth/Timezone/America/CancunTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/CaracasTest.php b/tests/Earth/Timezone/America/CaracasTest.php deleted file mode 100644 index 5b56735..0000000 --- a/tests/Earth/Timezone/America/CaracasTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/CatamarcaTest.php b/tests/Earth/Timezone/America/CatamarcaTest.php deleted file mode 100644 index 3ffeca5..0000000 --- a/tests/Earth/Timezone/America/CatamarcaTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/CayenneTest.php b/tests/Earth/Timezone/America/CayenneTest.php deleted file mode 100644 index 3052e4c..0000000 --- a/tests/Earth/Timezone/America/CayenneTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/CaymanTest.php b/tests/Earth/Timezone/America/CaymanTest.php deleted file mode 100644 index ab66f5d..0000000 --- a/tests/Earth/Timezone/America/CaymanTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/ChicagoTest.php b/tests/Earth/Timezone/America/ChicagoTest.php deleted file mode 100644 index 9a4e93e..0000000 --- a/tests/Earth/Timezone/America/ChicagoTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/ChihuahuaTest.php b/tests/Earth/Timezone/America/ChihuahuaTest.php deleted file mode 100644 index d1b2df2..0000000 --- a/tests/Earth/Timezone/America/ChihuahuaTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/CoralHarbourTest.php b/tests/Earth/Timezone/America/CoralHarbourTest.php deleted file mode 100644 index d3e303f..0000000 --- a/tests/Earth/Timezone/America/CoralHarbourTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/CostaRicaTest.php b/tests/Earth/Timezone/America/CostaRicaTest.php deleted file mode 100644 index 6923d85..0000000 --- a/tests/Earth/Timezone/America/CostaRicaTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/CrestonTest.php b/tests/Earth/Timezone/America/CrestonTest.php deleted file mode 100644 index f1cc14a..0000000 --- a/tests/Earth/Timezone/America/CrestonTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/CuiabaTest.php b/tests/Earth/Timezone/America/CuiabaTest.php deleted file mode 100644 index 2fef7c0..0000000 --- a/tests/Earth/Timezone/America/CuiabaTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/CuracaoTest.php b/tests/Earth/Timezone/America/CuracaoTest.php deleted file mode 100644 index 4a95a16..0000000 --- a/tests/Earth/Timezone/America/CuracaoTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/DanmarkshavnTest.php b/tests/Earth/Timezone/America/DanmarkshavnTest.php deleted file mode 100644 index eea69c8..0000000 --- a/tests/Earth/Timezone/America/DanmarkshavnTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/DawsonCreekTest.php b/tests/Earth/Timezone/America/DawsonCreekTest.php deleted file mode 100644 index 8182d5f..0000000 --- a/tests/Earth/Timezone/America/DawsonCreekTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/DawsonTest.php b/tests/Earth/Timezone/America/DawsonTest.php deleted file mode 100644 index 5bac853..0000000 --- a/tests/Earth/Timezone/America/DawsonTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/DenverTest.php b/tests/Earth/Timezone/America/DenverTest.php deleted file mode 100644 index 8c67f7c..0000000 --- a/tests/Earth/Timezone/America/DenverTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/DetroitTest.php b/tests/Earth/Timezone/America/DetroitTest.php deleted file mode 100644 index 59a3fbd..0000000 --- a/tests/Earth/Timezone/America/DetroitTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/DominicaTest.php b/tests/Earth/Timezone/America/DominicaTest.php deleted file mode 100644 index 2e6baf9..0000000 --- a/tests/Earth/Timezone/America/DominicaTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/EdmontonTest.php b/tests/Earth/Timezone/America/EdmontonTest.php deleted file mode 100644 index 944a4c9..0000000 --- a/tests/Earth/Timezone/America/EdmontonTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/EirunepeTest.php b/tests/Earth/Timezone/America/EirunepeTest.php deleted file mode 100644 index f97ff78..0000000 --- a/tests/Earth/Timezone/America/EirunepeTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/ElSalvadorTest.php b/tests/Earth/Timezone/America/ElSalvadorTest.php deleted file mode 100644 index 774ce1d..0000000 --- a/tests/Earth/Timezone/America/ElSalvadorTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/EnsenadaTest.php b/tests/Earth/Timezone/America/EnsenadaTest.php deleted file mode 100644 index 1931499..0000000 --- a/tests/Earth/Timezone/America/EnsenadaTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/FortWayneTest.php b/tests/Earth/Timezone/America/FortWayneTest.php deleted file mode 100644 index 463a396..0000000 --- a/tests/Earth/Timezone/America/FortWayneTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/FortalezaTest.php b/tests/Earth/Timezone/America/FortalezaTest.php deleted file mode 100644 index d95a71e..0000000 --- a/tests/Earth/Timezone/America/FortalezaTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/GlaceBayTest.php b/tests/Earth/Timezone/America/GlaceBayTest.php deleted file mode 100644 index d03cc48..0000000 --- a/tests/Earth/Timezone/America/GlaceBayTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/GodthabTest.php b/tests/Earth/Timezone/America/GodthabTest.php deleted file mode 100644 index d0382ba..0000000 --- a/tests/Earth/Timezone/America/GodthabTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/GooseBayTest.php b/tests/Earth/Timezone/America/GooseBayTest.php deleted file mode 100644 index c40a82a..0000000 --- a/tests/Earth/Timezone/America/GooseBayTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/GrandTurkTest.php b/tests/Earth/Timezone/America/GrandTurkTest.php deleted file mode 100644 index 516af1a..0000000 --- a/tests/Earth/Timezone/America/GrandTurkTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/GrenadaTest.php b/tests/Earth/Timezone/America/GrenadaTest.php deleted file mode 100644 index 4b72d63..0000000 --- a/tests/Earth/Timezone/America/GrenadaTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/GuadeloupeTest.php b/tests/Earth/Timezone/America/GuadeloupeTest.php deleted file mode 100644 index 764b249..0000000 --- a/tests/Earth/Timezone/America/GuadeloupeTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/GuatemalaTest.php b/tests/Earth/Timezone/America/GuatemalaTest.php deleted file mode 100644 index 937e3bb..0000000 --- a/tests/Earth/Timezone/America/GuatemalaTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/GuayaquilTest.php b/tests/Earth/Timezone/America/GuayaquilTest.php deleted file mode 100644 index ee66cde..0000000 --- a/tests/Earth/Timezone/America/GuayaquilTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/GuyanaTest.php b/tests/Earth/Timezone/America/GuyanaTest.php deleted file mode 100644 index a031e76..0000000 --- a/tests/Earth/Timezone/America/GuyanaTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/HalifaxTest.php b/tests/Earth/Timezone/America/HalifaxTest.php deleted file mode 100644 index ef7d3f4..0000000 --- a/tests/Earth/Timezone/America/HalifaxTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/HavanaTest.php b/tests/Earth/Timezone/America/HavanaTest.php deleted file mode 100644 index 3c2527e..0000000 --- a/tests/Earth/Timezone/America/HavanaTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/HermosilloTest.php b/tests/Earth/Timezone/America/HermosilloTest.php deleted file mode 100644 index 0b05443..0000000 --- a/tests/Earth/Timezone/America/HermosilloTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/Indiana/IndianapolisTest.php b/tests/Earth/Timezone/America/Indiana/IndianapolisTest.php deleted file mode 100644 index e75c84c..0000000 --- a/tests/Earth/Timezone/America/Indiana/IndianapolisTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/Indiana/KnoxTest.php b/tests/Earth/Timezone/America/Indiana/KnoxTest.php deleted file mode 100644 index 1b925fe..0000000 --- a/tests/Earth/Timezone/America/Indiana/KnoxTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/Indiana/MarengoTest.php b/tests/Earth/Timezone/America/Indiana/MarengoTest.php deleted file mode 100644 index be641e8..0000000 --- a/tests/Earth/Timezone/America/Indiana/MarengoTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/Indiana/PetersburgTest.php b/tests/Earth/Timezone/America/Indiana/PetersburgTest.php deleted file mode 100644 index c82d311..0000000 --- a/tests/Earth/Timezone/America/Indiana/PetersburgTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/Indiana/TellCityTest.php b/tests/Earth/Timezone/America/Indiana/TellCityTest.php deleted file mode 100644 index 55259af..0000000 --- a/tests/Earth/Timezone/America/Indiana/TellCityTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/Indiana/VevayTest.php b/tests/Earth/Timezone/America/Indiana/VevayTest.php deleted file mode 100644 index 3d8d220..0000000 --- a/tests/Earth/Timezone/America/Indiana/VevayTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/Indiana/VincennesTest.php b/tests/Earth/Timezone/America/Indiana/VincennesTest.php deleted file mode 100644 index 1f14d7d..0000000 --- a/tests/Earth/Timezone/America/Indiana/VincennesTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/Indiana/WinamacTest.php b/tests/Earth/Timezone/America/Indiana/WinamacTest.php deleted file mode 100644 index ed84c54..0000000 --- a/tests/Earth/Timezone/America/Indiana/WinamacTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/InuvikTest.php b/tests/Earth/Timezone/America/InuvikTest.php deleted file mode 100644 index 82990fd..0000000 --- a/tests/Earth/Timezone/America/InuvikTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/IqaluitTest.php b/tests/Earth/Timezone/America/IqaluitTest.php deleted file mode 100644 index fa890b2..0000000 --- a/tests/Earth/Timezone/America/IqaluitTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/JamaicaTest.php b/tests/Earth/Timezone/America/JamaicaTest.php deleted file mode 100644 index 77948d1..0000000 --- a/tests/Earth/Timezone/America/JamaicaTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/JuneauTest.php b/tests/Earth/Timezone/America/JuneauTest.php deleted file mode 100644 index fc7da9e..0000000 --- a/tests/Earth/Timezone/America/JuneauTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/KralendijkTest.php b/tests/Earth/Timezone/America/KralendijkTest.php deleted file mode 100644 index 2798aa6..0000000 --- a/tests/Earth/Timezone/America/KralendijkTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/LaPazTest.php b/tests/Earth/Timezone/America/LaPazTest.php deleted file mode 100644 index 2b45d59..0000000 --- a/tests/Earth/Timezone/America/LaPazTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/LimaTest.php b/tests/Earth/Timezone/America/LimaTest.php deleted file mode 100644 index e35160c..0000000 --- a/tests/Earth/Timezone/America/LimaTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/LosAngelesTest.php b/tests/Earth/Timezone/America/LosAngelesTest.php deleted file mode 100644 index 5aca7e2..0000000 --- a/tests/Earth/Timezone/America/LosAngelesTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/LouisvilleTest.php b/tests/Earth/Timezone/America/LouisvilleTest.php deleted file mode 100644 index a40f1c7..0000000 --- a/tests/Earth/Timezone/America/LouisvilleTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/LowerPrincesTest.php b/tests/Earth/Timezone/America/LowerPrincesTest.php deleted file mode 100644 index ba1c4fb..0000000 --- a/tests/Earth/Timezone/America/LowerPrincesTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/MaceioTest.php b/tests/Earth/Timezone/America/MaceioTest.php deleted file mode 100644 index 5542b08..0000000 --- a/tests/Earth/Timezone/America/MaceioTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/ManaguaTest.php b/tests/Earth/Timezone/America/ManaguaTest.php deleted file mode 100644 index af5331e..0000000 --- a/tests/Earth/Timezone/America/ManaguaTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/ManausTest.php b/tests/Earth/Timezone/America/ManausTest.php deleted file mode 100644 index ae4bbf2..0000000 --- a/tests/Earth/Timezone/America/ManausTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/MarigotTest.php b/tests/Earth/Timezone/America/MarigotTest.php deleted file mode 100644 index 084d9bc..0000000 --- a/tests/Earth/Timezone/America/MarigotTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/MartiniqueTest.php b/tests/Earth/Timezone/America/MartiniqueTest.php deleted file mode 100644 index 3fa7a69..0000000 --- a/tests/Earth/Timezone/America/MartiniqueTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/MatamorosTest.php b/tests/Earth/Timezone/America/MatamorosTest.php deleted file mode 100644 index 1873587..0000000 --- a/tests/Earth/Timezone/America/MatamorosTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/MazatlanTest.php b/tests/Earth/Timezone/America/MazatlanTest.php deleted file mode 100644 index 07372c7..0000000 --- a/tests/Earth/Timezone/America/MazatlanTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/MenomineeTest.php b/tests/Earth/Timezone/America/MenomineeTest.php deleted file mode 100644 index f9fcaf4..0000000 --- a/tests/Earth/Timezone/America/MenomineeTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/MeridaTest.php b/tests/Earth/Timezone/America/MeridaTest.php deleted file mode 100644 index 1acca53..0000000 --- a/tests/Earth/Timezone/America/MeridaTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/MetlakatlaTest.php b/tests/Earth/Timezone/America/MetlakatlaTest.php deleted file mode 100644 index d2249c0..0000000 --- a/tests/Earth/Timezone/America/MetlakatlaTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/MexicoCityTest.php b/tests/Earth/Timezone/America/MexicoCityTest.php deleted file mode 100644 index 7fbe1d0..0000000 --- a/tests/Earth/Timezone/America/MexicoCityTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/MiquelonTest.php b/tests/Earth/Timezone/America/MiquelonTest.php deleted file mode 100644 index 4fdf151..0000000 --- a/tests/Earth/Timezone/America/MiquelonTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/MonctonTest.php b/tests/Earth/Timezone/America/MonctonTest.php deleted file mode 100644 index fd5354c..0000000 --- a/tests/Earth/Timezone/America/MonctonTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/MonterreyTest.php b/tests/Earth/Timezone/America/MonterreyTest.php deleted file mode 100644 index f66efd7..0000000 --- a/tests/Earth/Timezone/America/MonterreyTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/MontevideoTest.php b/tests/Earth/Timezone/America/MontevideoTest.php deleted file mode 100644 index bdbf818..0000000 --- a/tests/Earth/Timezone/America/MontevideoTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/MonticelloTest.php b/tests/Earth/Timezone/America/MonticelloTest.php deleted file mode 100644 index e570c77..0000000 --- a/tests/Earth/Timezone/America/MonticelloTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/MontrealTest.php b/tests/Earth/Timezone/America/MontrealTest.php deleted file mode 100644 index 68ab949..0000000 --- a/tests/Earth/Timezone/America/MontrealTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/MontserratTest.php b/tests/Earth/Timezone/America/MontserratTest.php deleted file mode 100644 index 1e9fe0e..0000000 --- a/tests/Earth/Timezone/America/MontserratTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/NassauTest.php b/tests/Earth/Timezone/America/NassauTest.php deleted file mode 100644 index 93d6304..0000000 --- a/tests/Earth/Timezone/America/NassauTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/NewYorkTest.php b/tests/Earth/Timezone/America/NewYorkTest.php deleted file mode 100644 index ad553a8..0000000 --- a/tests/Earth/Timezone/America/NewYorkTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/NipigonTest.php b/tests/Earth/Timezone/America/NipigonTest.php deleted file mode 100644 index a974802..0000000 --- a/tests/Earth/Timezone/America/NipigonTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/NomeTest.php b/tests/Earth/Timezone/America/NomeTest.php deleted file mode 100644 index 521e10b..0000000 --- a/tests/Earth/Timezone/America/NomeTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/NoronhaTest.php b/tests/Earth/Timezone/America/NoronhaTest.php deleted file mode 100644 index 0262d2e..0000000 --- a/tests/Earth/Timezone/America/NoronhaTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/NorthDakota/BeulahTest.php b/tests/Earth/Timezone/America/NorthDakota/BeulahTest.php deleted file mode 100644 index cdc134a..0000000 --- a/tests/Earth/Timezone/America/NorthDakota/BeulahTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/NorthDakota/CenterTest.php b/tests/Earth/Timezone/America/NorthDakota/CenterTest.php deleted file mode 100644 index a837878..0000000 --- a/tests/Earth/Timezone/America/NorthDakota/CenterTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/NorthDakota/NewSalemTest.php b/tests/Earth/Timezone/America/NorthDakota/NewSalemTest.php deleted file mode 100644 index f8ccc0a..0000000 --- a/tests/Earth/Timezone/America/NorthDakota/NewSalemTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/OjinagaTest.php b/tests/Earth/Timezone/America/OjinagaTest.php deleted file mode 100644 index 1c65eb9..0000000 --- a/tests/Earth/Timezone/America/OjinagaTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/PanamaTest.php b/tests/Earth/Timezone/America/PanamaTest.php deleted file mode 100644 index a7cb8ce..0000000 --- a/tests/Earth/Timezone/America/PanamaTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/PangnirtungTest.php b/tests/Earth/Timezone/America/PangnirtungTest.php deleted file mode 100644 index 34e3768..0000000 --- a/tests/Earth/Timezone/America/PangnirtungTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/ParamariboTest.php b/tests/Earth/Timezone/America/ParamariboTest.php deleted file mode 100644 index a7ab539..0000000 --- a/tests/Earth/Timezone/America/ParamariboTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/PhoenixTest.php b/tests/Earth/Timezone/America/PhoenixTest.php deleted file mode 100644 index 6cd0032..0000000 --- a/tests/Earth/Timezone/America/PhoenixTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/PortAuPrinceTest.php b/tests/Earth/Timezone/America/PortAuPrinceTest.php deleted file mode 100644 index 6e5085e..0000000 --- a/tests/Earth/Timezone/America/PortAuPrinceTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/PortOfSpainTest.php b/tests/Earth/Timezone/America/PortOfSpainTest.php deleted file mode 100644 index 22aa249..0000000 --- a/tests/Earth/Timezone/America/PortOfSpainTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/PortoAcreTest.php b/tests/Earth/Timezone/America/PortoAcreTest.php deleted file mode 100644 index 5611c29..0000000 --- a/tests/Earth/Timezone/America/PortoAcreTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/PortoVelhoTest.php b/tests/Earth/Timezone/America/PortoVelhoTest.php deleted file mode 100644 index 8a14c7d..0000000 --- a/tests/Earth/Timezone/America/PortoVelhoTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/PuertoRicoTest.php b/tests/Earth/Timezone/America/PuertoRicoTest.php deleted file mode 100644 index bcb1386..0000000 --- a/tests/Earth/Timezone/America/PuertoRicoTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/RainyRiverTest.php b/tests/Earth/Timezone/America/RainyRiverTest.php deleted file mode 100644 index c72aa55..0000000 --- a/tests/Earth/Timezone/America/RainyRiverTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/RankinInletTest.php b/tests/Earth/Timezone/America/RankinInletTest.php deleted file mode 100644 index 5da9378..0000000 --- a/tests/Earth/Timezone/America/RankinInletTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/RecifeTest.php b/tests/Earth/Timezone/America/RecifeTest.php deleted file mode 100644 index ac9dd0a..0000000 --- a/tests/Earth/Timezone/America/RecifeTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/ReginaTest.php b/tests/Earth/Timezone/America/ReginaTest.php deleted file mode 100644 index 3cbf523..0000000 --- a/tests/Earth/Timezone/America/ReginaTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/ResoluteTest.php b/tests/Earth/Timezone/America/ResoluteTest.php deleted file mode 100644 index cc0866c..0000000 --- a/tests/Earth/Timezone/America/ResoluteTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/RioBrancoTest.php b/tests/Earth/Timezone/America/RioBrancoTest.php deleted file mode 100644 index 5ade99d..0000000 --- a/tests/Earth/Timezone/America/RioBrancoTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/RosarioTest.php b/tests/Earth/Timezone/America/RosarioTest.php deleted file mode 100644 index 29bacec..0000000 --- a/tests/Earth/Timezone/America/RosarioTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/SaintBarthelemyTest.php b/tests/Earth/Timezone/America/SaintBarthelemyTest.php deleted file mode 100644 index 889771b..0000000 --- a/tests/Earth/Timezone/America/SaintBarthelemyTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/SaintJohnsTest.php b/tests/Earth/Timezone/America/SaintJohnsTest.php deleted file mode 100644 index 59dbc01..0000000 --- a/tests/Earth/Timezone/America/SaintJohnsTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/SaintKittsTest.php b/tests/Earth/Timezone/America/SaintKittsTest.php deleted file mode 100644 index c91e7bf..0000000 --- a/tests/Earth/Timezone/America/SaintKittsTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/SaintLuciaTest.php b/tests/Earth/Timezone/America/SaintLuciaTest.php deleted file mode 100644 index 29a475a..0000000 --- a/tests/Earth/Timezone/America/SaintLuciaTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/SaintThomasTest.php b/tests/Earth/Timezone/America/SaintThomasTest.php deleted file mode 100644 index a85a659..0000000 --- a/tests/Earth/Timezone/America/SaintThomasTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/SaintVincentTest.php b/tests/Earth/Timezone/America/SaintVincentTest.php deleted file mode 100644 index 68b5e11..0000000 --- a/tests/Earth/Timezone/America/SaintVincentTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/SantaIsabelTest.php b/tests/Earth/Timezone/America/SantaIsabelTest.php deleted file mode 100644 index 6201f3e..0000000 --- a/tests/Earth/Timezone/America/SantaIsabelTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/SantaremTest.php b/tests/Earth/Timezone/America/SantaremTest.php deleted file mode 100644 index 95b2668..0000000 --- a/tests/Earth/Timezone/America/SantaremTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/SantiagoTest.php b/tests/Earth/Timezone/America/SantiagoTest.php deleted file mode 100644 index 38083c7..0000000 --- a/tests/Earth/Timezone/America/SantiagoTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/SantoDomingoTest.php b/tests/Earth/Timezone/America/SantoDomingoTest.php deleted file mode 100644 index 80a23d1..0000000 --- a/tests/Earth/Timezone/America/SantoDomingoTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/SaoPauloTest.php b/tests/Earth/Timezone/America/SaoPauloTest.php deleted file mode 100644 index bc4ab09..0000000 --- a/tests/Earth/Timezone/America/SaoPauloTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/ScoresbysundTest.php b/tests/Earth/Timezone/America/ScoresbysundTest.php deleted file mode 100644 index c5a9698..0000000 --- a/tests/Earth/Timezone/America/ScoresbysundTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/ShiprockTest.php b/tests/Earth/Timezone/America/ShiprockTest.php deleted file mode 100644 index 1ee4c76..0000000 --- a/tests/Earth/Timezone/America/ShiprockTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/SitkaTest.php b/tests/Earth/Timezone/America/SitkaTest.php deleted file mode 100644 index ff273cf..0000000 --- a/tests/Earth/Timezone/America/SitkaTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/SwiftCurrentTest.php b/tests/Earth/Timezone/America/SwiftCurrentTest.php deleted file mode 100644 index 9bd5c36..0000000 --- a/tests/Earth/Timezone/America/SwiftCurrentTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/TegucigalpaTest.php b/tests/Earth/Timezone/America/TegucigalpaTest.php deleted file mode 100644 index f2c90f0..0000000 --- a/tests/Earth/Timezone/America/TegucigalpaTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/ThuleTest.php b/tests/Earth/Timezone/America/ThuleTest.php deleted file mode 100644 index 2297a64..0000000 --- a/tests/Earth/Timezone/America/ThuleTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/ThunderBayTest.php b/tests/Earth/Timezone/America/ThunderBayTest.php deleted file mode 100644 index 4587c79..0000000 --- a/tests/Earth/Timezone/America/ThunderBayTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/TijuanaTest.php b/tests/Earth/Timezone/America/TijuanaTest.php deleted file mode 100644 index d23b833..0000000 --- a/tests/Earth/Timezone/America/TijuanaTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/TorontoTest.php b/tests/Earth/Timezone/America/TorontoTest.php deleted file mode 100644 index 4ec3f88..0000000 --- a/tests/Earth/Timezone/America/TorontoTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/TortolaTest.php b/tests/Earth/Timezone/America/TortolaTest.php deleted file mode 100644 index 67e22f3..0000000 --- a/tests/Earth/Timezone/America/TortolaTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/VancouverTest.php b/tests/Earth/Timezone/America/VancouverTest.php deleted file mode 100644 index 5254437..0000000 --- a/tests/Earth/Timezone/America/VancouverTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/VirginTest.php b/tests/Earth/Timezone/America/VirginTest.php deleted file mode 100644 index 484083f..0000000 --- a/tests/Earth/Timezone/America/VirginTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/WhitehorseTest.php b/tests/Earth/Timezone/America/WhitehorseTest.php deleted file mode 100644 index a2cd316..0000000 --- a/tests/Earth/Timezone/America/WhitehorseTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/WinnipegTest.php b/tests/Earth/Timezone/America/WinnipegTest.php deleted file mode 100644 index b7d7cb7..0000000 --- a/tests/Earth/Timezone/America/WinnipegTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/YakutatTest.php b/tests/Earth/Timezone/America/YakutatTest.php deleted file mode 100644 index 5152d6b..0000000 --- a/tests/Earth/Timezone/America/YakutatTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/America/YellowknifeTest.php b/tests/Earth/Timezone/America/YellowknifeTest.php deleted file mode 100644 index d40f578..0000000 --- a/tests/Earth/Timezone/America/YellowknifeTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Antarctica/CaseyTest.php b/tests/Earth/Timezone/Antarctica/CaseyTest.php deleted file mode 100644 index e36f310..0000000 --- a/tests/Earth/Timezone/Antarctica/CaseyTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Antarctica/DavisTest.php b/tests/Earth/Timezone/Antarctica/DavisTest.php deleted file mode 100644 index 59609c5..0000000 --- a/tests/Earth/Timezone/Antarctica/DavisTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Antarctica/DumontDUrvilleTest.php b/tests/Earth/Timezone/Antarctica/DumontDUrvilleTest.php deleted file mode 100644 index 4238bca..0000000 --- a/tests/Earth/Timezone/Antarctica/DumontDUrvilleTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Antarctica/MacquarieTest.php b/tests/Earth/Timezone/Antarctica/MacquarieTest.php deleted file mode 100644 index faa632d..0000000 --- a/tests/Earth/Timezone/Antarctica/MacquarieTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Antarctica/MawsonTest.php b/tests/Earth/Timezone/Antarctica/MawsonTest.php deleted file mode 100644 index e276403..0000000 --- a/tests/Earth/Timezone/Antarctica/MawsonTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Antarctica/McMurdoTest.php b/tests/Earth/Timezone/Antarctica/McMurdoTest.php deleted file mode 100644 index 930efc6..0000000 --- a/tests/Earth/Timezone/Antarctica/McMurdoTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Antarctica/PalmerTest.php b/tests/Earth/Timezone/Antarctica/PalmerTest.php deleted file mode 100644 index 882621e..0000000 --- a/tests/Earth/Timezone/Antarctica/PalmerTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Antarctica/RotheraTest.php b/tests/Earth/Timezone/Antarctica/RotheraTest.php deleted file mode 100644 index 85d41f5..0000000 --- a/tests/Earth/Timezone/Antarctica/RotheraTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Antarctica/SouthPoleTest.php b/tests/Earth/Timezone/Antarctica/SouthPoleTest.php deleted file mode 100644 index e2c296d..0000000 --- a/tests/Earth/Timezone/Antarctica/SouthPoleTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Antarctica/SyowaTest.php b/tests/Earth/Timezone/Antarctica/SyowaTest.php deleted file mode 100644 index 7ac9908..0000000 --- a/tests/Earth/Timezone/Antarctica/SyowaTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Antarctica/TrollTest.php b/tests/Earth/Timezone/Antarctica/TrollTest.php deleted file mode 100644 index 0cda88c..0000000 --- a/tests/Earth/Timezone/Antarctica/TrollTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Antarctica/VostokTest.php b/tests/Earth/Timezone/Antarctica/VostokTest.php deleted file mode 100644 index 349e95e..0000000 --- a/tests/Earth/Timezone/Antarctica/VostokTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Arctic/LongyearbyenTest.php b/tests/Earth/Timezone/Arctic/LongyearbyenTest.php deleted file mode 100644 index e81e7e4..0000000 --- a/tests/Earth/Timezone/Arctic/LongyearbyenTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Asia/AdenTest.php b/tests/Earth/Timezone/Asia/AdenTest.php deleted file mode 100644 index 9fbae93..0000000 --- a/tests/Earth/Timezone/Asia/AdenTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Asia/AlmatyTest.php b/tests/Earth/Timezone/Asia/AlmatyTest.php deleted file mode 100644 index d3f9da1..0000000 --- a/tests/Earth/Timezone/Asia/AlmatyTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Asia/AmmanTest.php b/tests/Earth/Timezone/Asia/AmmanTest.php deleted file mode 100644 index bb435b6..0000000 --- a/tests/Earth/Timezone/Asia/AmmanTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Asia/AnadyrTest.php b/tests/Earth/Timezone/Asia/AnadyrTest.php deleted file mode 100644 index b67ec4d..0000000 --- a/tests/Earth/Timezone/Asia/AnadyrTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Asia/AqtauTest.php b/tests/Earth/Timezone/Asia/AqtauTest.php deleted file mode 100644 index d22ab95..0000000 --- a/tests/Earth/Timezone/Asia/AqtauTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Asia/AqtobeTest.php b/tests/Earth/Timezone/Asia/AqtobeTest.php deleted file mode 100644 index 5d24337..0000000 --- a/tests/Earth/Timezone/Asia/AqtobeTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Asia/AshgabatTest.php b/tests/Earth/Timezone/Asia/AshgabatTest.php deleted file mode 100644 index 819fcd0..0000000 --- a/tests/Earth/Timezone/Asia/AshgabatTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Asia/AshkhabadTest.php b/tests/Earth/Timezone/Asia/AshkhabadTest.php deleted file mode 100644 index 4e256f7..0000000 --- a/tests/Earth/Timezone/Asia/AshkhabadTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Asia/BaghdadTest.php b/tests/Earth/Timezone/Asia/BaghdadTest.php deleted file mode 100644 index 18050ae..0000000 --- a/tests/Earth/Timezone/Asia/BaghdadTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Asia/BahrainTest.php b/tests/Earth/Timezone/Asia/BahrainTest.php deleted file mode 100644 index 269afa9..0000000 --- a/tests/Earth/Timezone/Asia/BahrainTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Asia/BakuTest.php b/tests/Earth/Timezone/Asia/BakuTest.php deleted file mode 100644 index ecf9a45..0000000 --- a/tests/Earth/Timezone/Asia/BakuTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Asia/BangkokTest.php b/tests/Earth/Timezone/Asia/BangkokTest.php deleted file mode 100644 index 41a60d6..0000000 --- a/tests/Earth/Timezone/Asia/BangkokTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Asia/BeirutTest.php b/tests/Earth/Timezone/Asia/BeirutTest.php deleted file mode 100644 index 6982120..0000000 --- a/tests/Earth/Timezone/Asia/BeirutTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Asia/BishkekTest.php b/tests/Earth/Timezone/Asia/BishkekTest.php deleted file mode 100644 index b12443f..0000000 --- a/tests/Earth/Timezone/Asia/BishkekTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Asia/BruneiTest.php b/tests/Earth/Timezone/Asia/BruneiTest.php deleted file mode 100644 index 068b14f..0000000 --- a/tests/Earth/Timezone/Asia/BruneiTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Asia/CalcuttaTest.php b/tests/Earth/Timezone/Asia/CalcuttaTest.php deleted file mode 100644 index 8f4da04..0000000 --- a/tests/Earth/Timezone/Asia/CalcuttaTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Asia/ChitaTest.php b/tests/Earth/Timezone/Asia/ChitaTest.php deleted file mode 100644 index c1f17f0..0000000 --- a/tests/Earth/Timezone/Asia/ChitaTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Asia/ChoibalsanTest.php b/tests/Earth/Timezone/Asia/ChoibalsanTest.php deleted file mode 100644 index c2fc589..0000000 --- a/tests/Earth/Timezone/Asia/ChoibalsanTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Asia/ChongqingTest.php b/tests/Earth/Timezone/Asia/ChongqingTest.php deleted file mode 100644 index d7b2c06..0000000 --- a/tests/Earth/Timezone/Asia/ChongqingTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Asia/ChungkingTest.php b/tests/Earth/Timezone/Asia/ChungkingTest.php deleted file mode 100644 index dc42c26..0000000 --- a/tests/Earth/Timezone/Asia/ChungkingTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Asia/ColomboTest.php b/tests/Earth/Timezone/Asia/ColomboTest.php deleted file mode 100644 index 482c10a..0000000 --- a/tests/Earth/Timezone/Asia/ColomboTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Asia/DaccaTest.php b/tests/Earth/Timezone/Asia/DaccaTest.php deleted file mode 100644 index 1c3497f..0000000 --- a/tests/Earth/Timezone/Asia/DaccaTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Asia/DamascusTest.php b/tests/Earth/Timezone/Asia/DamascusTest.php deleted file mode 100644 index 26771f2..0000000 --- a/tests/Earth/Timezone/Asia/DamascusTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Asia/DhakaTest.php b/tests/Earth/Timezone/Asia/DhakaTest.php deleted file mode 100644 index 12eeeb9..0000000 --- a/tests/Earth/Timezone/Asia/DhakaTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Asia/DiliTest.php b/tests/Earth/Timezone/Asia/DiliTest.php deleted file mode 100644 index dc39a1a..0000000 --- a/tests/Earth/Timezone/Asia/DiliTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Asia/DubaiTest.php b/tests/Earth/Timezone/Asia/DubaiTest.php deleted file mode 100644 index 79e0e41..0000000 --- a/tests/Earth/Timezone/Asia/DubaiTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Asia/DushanbeTest.php b/tests/Earth/Timezone/Asia/DushanbeTest.php deleted file mode 100644 index 0299084..0000000 --- a/tests/Earth/Timezone/Asia/DushanbeTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Asia/GazaTest.php b/tests/Earth/Timezone/Asia/GazaTest.php deleted file mode 100644 index c992d46..0000000 --- a/tests/Earth/Timezone/Asia/GazaTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Asia/HarbinTest.php b/tests/Earth/Timezone/Asia/HarbinTest.php deleted file mode 100644 index f39a84b..0000000 --- a/tests/Earth/Timezone/Asia/HarbinTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Asia/HebronTest.php b/tests/Earth/Timezone/Asia/HebronTest.php deleted file mode 100644 index 1d0b9ec..0000000 --- a/tests/Earth/Timezone/Asia/HebronTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Asia/HoChiMinhTest.php b/tests/Earth/Timezone/Asia/HoChiMinhTest.php deleted file mode 100644 index c574ca2..0000000 --- a/tests/Earth/Timezone/Asia/HoChiMinhTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Asia/HongKongTest.php b/tests/Earth/Timezone/Asia/HongKongTest.php deleted file mode 100644 index 132354c..0000000 --- a/tests/Earth/Timezone/Asia/HongKongTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Asia/HovdTest.php b/tests/Earth/Timezone/Asia/HovdTest.php deleted file mode 100644 index 874dcfd..0000000 --- a/tests/Earth/Timezone/Asia/HovdTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Asia/IrkutskTest.php b/tests/Earth/Timezone/Asia/IrkutskTest.php deleted file mode 100644 index b4c9f4c..0000000 --- a/tests/Earth/Timezone/Asia/IrkutskTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Asia/IstanbulTest.php b/tests/Earth/Timezone/Asia/IstanbulTest.php deleted file mode 100644 index a36eed3..0000000 --- a/tests/Earth/Timezone/Asia/IstanbulTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Asia/JakartaTest.php b/tests/Earth/Timezone/Asia/JakartaTest.php deleted file mode 100644 index 7e979f2..0000000 --- a/tests/Earth/Timezone/Asia/JakartaTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Asia/JayapuraTest.php b/tests/Earth/Timezone/Asia/JayapuraTest.php deleted file mode 100644 index 8ff4f8b..0000000 --- a/tests/Earth/Timezone/Asia/JayapuraTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Asia/JerusalemTest.php b/tests/Earth/Timezone/Asia/JerusalemTest.php deleted file mode 100644 index a08067c..0000000 --- a/tests/Earth/Timezone/Asia/JerusalemTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Asia/KabulTest.php b/tests/Earth/Timezone/Asia/KabulTest.php deleted file mode 100644 index 9c3769c..0000000 --- a/tests/Earth/Timezone/Asia/KabulTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Asia/KamchatkaTest.php b/tests/Earth/Timezone/Asia/KamchatkaTest.php deleted file mode 100644 index 4a92df0..0000000 --- a/tests/Earth/Timezone/Asia/KamchatkaTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Asia/KarachiTest.php b/tests/Earth/Timezone/Asia/KarachiTest.php deleted file mode 100644 index 78a5abc..0000000 --- a/tests/Earth/Timezone/Asia/KarachiTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Asia/KathmanduTest.php b/tests/Earth/Timezone/Asia/KathmanduTest.php deleted file mode 100644 index 3b43b0d..0000000 --- a/tests/Earth/Timezone/Asia/KathmanduTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Asia/KatmanduTest.php b/tests/Earth/Timezone/Asia/KatmanduTest.php deleted file mode 100644 index 85a64fd..0000000 --- a/tests/Earth/Timezone/Asia/KatmanduTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Asia/KhandygaTest.php b/tests/Earth/Timezone/Asia/KhandygaTest.php deleted file mode 100644 index c31c385..0000000 --- a/tests/Earth/Timezone/Asia/KhandygaTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Asia/KolkataTest.php b/tests/Earth/Timezone/Asia/KolkataTest.php deleted file mode 100644 index 97cabed..0000000 --- a/tests/Earth/Timezone/Asia/KolkataTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Asia/KrasnoyarskTest.php b/tests/Earth/Timezone/Asia/KrasnoyarskTest.php deleted file mode 100644 index 9011ef4..0000000 --- a/tests/Earth/Timezone/Asia/KrasnoyarskTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Asia/KualaLumpurTest.php b/tests/Earth/Timezone/Asia/KualaLumpurTest.php deleted file mode 100644 index c7e0ff0..0000000 --- a/tests/Earth/Timezone/Asia/KualaLumpurTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Asia/KuchingTest.php b/tests/Earth/Timezone/Asia/KuchingTest.php deleted file mode 100644 index dc3379e..0000000 --- a/tests/Earth/Timezone/Asia/KuchingTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Asia/KuwaitTest.php b/tests/Earth/Timezone/Asia/KuwaitTest.php deleted file mode 100644 index 7518d38..0000000 --- a/tests/Earth/Timezone/Asia/KuwaitTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Asia/MacaoTest.php b/tests/Earth/Timezone/Asia/MacaoTest.php deleted file mode 100644 index 2f59968..0000000 --- a/tests/Earth/Timezone/Asia/MacaoTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Asia/MacauTest.php b/tests/Earth/Timezone/Asia/MacauTest.php deleted file mode 100644 index eabf8a4..0000000 --- a/tests/Earth/Timezone/Asia/MacauTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Asia/MagadanTest.php b/tests/Earth/Timezone/Asia/MagadanTest.php deleted file mode 100644 index f746a7d..0000000 --- a/tests/Earth/Timezone/Asia/MagadanTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Asia/MakassarTest.php b/tests/Earth/Timezone/Asia/MakassarTest.php deleted file mode 100644 index 5e54e06..0000000 --- a/tests/Earth/Timezone/Asia/MakassarTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Asia/ManilaTest.php b/tests/Earth/Timezone/Asia/ManilaTest.php deleted file mode 100644 index baee6fa..0000000 --- a/tests/Earth/Timezone/Asia/ManilaTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Asia/MuscatTest.php b/tests/Earth/Timezone/Asia/MuscatTest.php deleted file mode 100644 index 2d2dbff..0000000 --- a/tests/Earth/Timezone/Asia/MuscatTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Asia/NicosiaTest.php b/tests/Earth/Timezone/Asia/NicosiaTest.php deleted file mode 100644 index 48cdde2..0000000 --- a/tests/Earth/Timezone/Asia/NicosiaTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Asia/NovokuznetskTest.php b/tests/Earth/Timezone/Asia/NovokuznetskTest.php deleted file mode 100644 index 1c2e6e8..0000000 --- a/tests/Earth/Timezone/Asia/NovokuznetskTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Asia/NovosibirskTest.php b/tests/Earth/Timezone/Asia/NovosibirskTest.php deleted file mode 100644 index e817c05..0000000 --- a/tests/Earth/Timezone/Asia/NovosibirskTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Asia/OmskTest.php b/tests/Earth/Timezone/Asia/OmskTest.php deleted file mode 100644 index 919167c..0000000 --- a/tests/Earth/Timezone/Asia/OmskTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Asia/OralTest.php b/tests/Earth/Timezone/Asia/OralTest.php deleted file mode 100644 index 84d990d..0000000 --- a/tests/Earth/Timezone/Asia/OralTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Asia/PhnomPenhTest.php b/tests/Earth/Timezone/Asia/PhnomPenhTest.php deleted file mode 100644 index 7befbf5..0000000 --- a/tests/Earth/Timezone/Asia/PhnomPenhTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Asia/PontianakTest.php b/tests/Earth/Timezone/Asia/PontianakTest.php deleted file mode 100644 index 679fa67..0000000 --- a/tests/Earth/Timezone/Asia/PontianakTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Asia/PyongyangTest.php b/tests/Earth/Timezone/Asia/PyongyangTest.php deleted file mode 100644 index c5e69c2..0000000 --- a/tests/Earth/Timezone/Asia/PyongyangTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Asia/QatarTest.php b/tests/Earth/Timezone/Asia/QatarTest.php deleted file mode 100644 index 478fae8..0000000 --- a/tests/Earth/Timezone/Asia/QatarTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Asia/QyzylordaTest.php b/tests/Earth/Timezone/Asia/QyzylordaTest.php deleted file mode 100644 index 9a2c56a..0000000 --- a/tests/Earth/Timezone/Asia/QyzylordaTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Asia/RangoonTest.php b/tests/Earth/Timezone/Asia/RangoonTest.php deleted file mode 100644 index b18cbb6..0000000 --- a/tests/Earth/Timezone/Asia/RangoonTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Asia/RiyadhTest.php b/tests/Earth/Timezone/Asia/RiyadhTest.php deleted file mode 100644 index 1059781..0000000 --- a/tests/Earth/Timezone/Asia/RiyadhTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Asia/SaigonTest.php b/tests/Earth/Timezone/Asia/SaigonTest.php deleted file mode 100644 index 6054f82..0000000 --- a/tests/Earth/Timezone/Asia/SaigonTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Asia/SakhalinTest.php b/tests/Earth/Timezone/Asia/SakhalinTest.php deleted file mode 100644 index 1672c4a..0000000 --- a/tests/Earth/Timezone/Asia/SakhalinTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Asia/SamarkandTest.php b/tests/Earth/Timezone/Asia/SamarkandTest.php deleted file mode 100644 index 5fd56d3..0000000 --- a/tests/Earth/Timezone/Asia/SamarkandTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Asia/SeoulTest.php b/tests/Earth/Timezone/Asia/SeoulTest.php deleted file mode 100644 index 6f97342..0000000 --- a/tests/Earth/Timezone/Asia/SeoulTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Asia/ShanghaiTest.php b/tests/Earth/Timezone/Asia/ShanghaiTest.php deleted file mode 100644 index 196923a..0000000 --- a/tests/Earth/Timezone/Asia/ShanghaiTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Asia/SingaporeTest.php b/tests/Earth/Timezone/Asia/SingaporeTest.php deleted file mode 100644 index 795cdbe..0000000 --- a/tests/Earth/Timezone/Asia/SingaporeTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Asia/SrednekolymskTest.php b/tests/Earth/Timezone/Asia/SrednekolymskTest.php deleted file mode 100644 index 9f5e557..0000000 --- a/tests/Earth/Timezone/Asia/SrednekolymskTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Asia/TaipeiTest.php b/tests/Earth/Timezone/Asia/TaipeiTest.php deleted file mode 100644 index 7a34a79..0000000 --- a/tests/Earth/Timezone/Asia/TaipeiTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Asia/TashkentTest.php b/tests/Earth/Timezone/Asia/TashkentTest.php deleted file mode 100644 index 0fa204e..0000000 --- a/tests/Earth/Timezone/Asia/TashkentTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Asia/TbilisiTest.php b/tests/Earth/Timezone/Asia/TbilisiTest.php deleted file mode 100644 index c345e2b..0000000 --- a/tests/Earth/Timezone/Asia/TbilisiTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Asia/TehranTest.php b/tests/Earth/Timezone/Asia/TehranTest.php deleted file mode 100644 index e59955d..0000000 --- a/tests/Earth/Timezone/Asia/TehranTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Asia/TelAvivTest.php b/tests/Earth/Timezone/Asia/TelAvivTest.php deleted file mode 100644 index 2a14e55..0000000 --- a/tests/Earth/Timezone/Asia/TelAvivTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Asia/ThimbuTest.php b/tests/Earth/Timezone/Asia/ThimbuTest.php deleted file mode 100644 index ea799b5..0000000 --- a/tests/Earth/Timezone/Asia/ThimbuTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Asia/ThimphuTest.php b/tests/Earth/Timezone/Asia/ThimphuTest.php deleted file mode 100644 index e717ded..0000000 --- a/tests/Earth/Timezone/Asia/ThimphuTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Asia/TokyoTest.php b/tests/Earth/Timezone/Asia/TokyoTest.php deleted file mode 100644 index 73e60c4..0000000 --- a/tests/Earth/Timezone/Asia/TokyoTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Asia/UjungPandangTest.php b/tests/Earth/Timezone/Asia/UjungPandangTest.php deleted file mode 100644 index 4bd65fe..0000000 --- a/tests/Earth/Timezone/Asia/UjungPandangTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Asia/UlaanbaatarTest.php b/tests/Earth/Timezone/Asia/UlaanbaatarTest.php deleted file mode 100644 index 6e7638e..0000000 --- a/tests/Earth/Timezone/Asia/UlaanbaatarTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Asia/UlanBatorTest.php b/tests/Earth/Timezone/Asia/UlanBatorTest.php deleted file mode 100644 index 5fcb895..0000000 --- a/tests/Earth/Timezone/Asia/UlanBatorTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Asia/UstNeraTest.php b/tests/Earth/Timezone/Asia/UstNeraTest.php deleted file mode 100644 index 091b3de..0000000 --- a/tests/Earth/Timezone/Asia/UstNeraTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Asia/VientianeTest.php b/tests/Earth/Timezone/Asia/VientianeTest.php deleted file mode 100644 index b5285fa..0000000 --- a/tests/Earth/Timezone/Asia/VientianeTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Asia/VladivostokTest.php b/tests/Earth/Timezone/Asia/VladivostokTest.php deleted file mode 100644 index ed5a27a..0000000 --- a/tests/Earth/Timezone/Asia/VladivostokTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Asia/YakutskTest.php b/tests/Earth/Timezone/Asia/YakutskTest.php deleted file mode 100644 index ad8bf71..0000000 --- a/tests/Earth/Timezone/Asia/YakutskTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Asia/YekaterinburgTest.php b/tests/Earth/Timezone/Asia/YekaterinburgTest.php deleted file mode 100644 index 3710785..0000000 --- a/tests/Earth/Timezone/Asia/YekaterinburgTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Asia/YerevanTest.php b/tests/Earth/Timezone/Asia/YerevanTest.php deleted file mode 100644 index 730aef8..0000000 --- a/tests/Earth/Timezone/Asia/YerevanTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Atlantic/AzoresTest.php b/tests/Earth/Timezone/Atlantic/AzoresTest.php deleted file mode 100644 index 6234fb1..0000000 --- a/tests/Earth/Timezone/Atlantic/AzoresTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Atlantic/BermudaTest.php b/tests/Earth/Timezone/Atlantic/BermudaTest.php deleted file mode 100644 index 93420ac..0000000 --- a/tests/Earth/Timezone/Atlantic/BermudaTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Atlantic/CanaryTest.php b/tests/Earth/Timezone/Atlantic/CanaryTest.php deleted file mode 100644 index 06a1339..0000000 --- a/tests/Earth/Timezone/Atlantic/CanaryTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Atlantic/CapeVerdeTest.php b/tests/Earth/Timezone/Atlantic/CapeVerdeTest.php deleted file mode 100644 index aa7a0ee..0000000 --- a/tests/Earth/Timezone/Atlantic/CapeVerdeTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Atlantic/FaeroeTest.php b/tests/Earth/Timezone/Atlantic/FaeroeTest.php deleted file mode 100644 index 8c44b2a..0000000 --- a/tests/Earth/Timezone/Atlantic/FaeroeTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Atlantic/FaroeTest.php b/tests/Earth/Timezone/Atlantic/FaroeTest.php deleted file mode 100644 index d20608a..0000000 --- a/tests/Earth/Timezone/Atlantic/FaroeTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Atlantic/JanMayenTest.php b/tests/Earth/Timezone/Atlantic/JanMayenTest.php deleted file mode 100644 index d12dcbf..0000000 --- a/tests/Earth/Timezone/Atlantic/JanMayenTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Atlantic/MadeiraTest.php b/tests/Earth/Timezone/Atlantic/MadeiraTest.php deleted file mode 100644 index 84700b0..0000000 --- a/tests/Earth/Timezone/Atlantic/MadeiraTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Atlantic/ReykjavikTest.php b/tests/Earth/Timezone/Atlantic/ReykjavikTest.php deleted file mode 100644 index 8067461..0000000 --- a/tests/Earth/Timezone/Atlantic/ReykjavikTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Atlantic/SaintHelenaTest.php b/tests/Earth/Timezone/Atlantic/SaintHelenaTest.php deleted file mode 100644 index 58ecc3f..0000000 --- a/tests/Earth/Timezone/Atlantic/SaintHelenaTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Atlantic/SouthGeorgiaTest.php b/tests/Earth/Timezone/Atlantic/SouthGeorgiaTest.php deleted file mode 100644 index f2eb571..0000000 --- a/tests/Earth/Timezone/Atlantic/SouthGeorgiaTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Atlantic/StanleyTest.php b/tests/Earth/Timezone/Atlantic/StanleyTest.php deleted file mode 100644 index 04d7e4d..0000000 --- a/tests/Earth/Timezone/Atlantic/StanleyTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Australia/AdelaideTest.php b/tests/Earth/Timezone/Australia/AdelaideTest.php deleted file mode 100644 index fec1b2d..0000000 --- a/tests/Earth/Timezone/Australia/AdelaideTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Australia/AustralianCapitalTerritoryTest.php b/tests/Earth/Timezone/Australia/AustralianCapitalTerritoryTest.php deleted file mode 100644 index b9f3bd2..0000000 --- a/tests/Earth/Timezone/Australia/AustralianCapitalTerritoryTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Australia/BrisbaneTest.php b/tests/Earth/Timezone/Australia/BrisbaneTest.php deleted file mode 100644 index e9d713d..0000000 --- a/tests/Earth/Timezone/Australia/BrisbaneTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Australia/BrokenHillTest.php b/tests/Earth/Timezone/Australia/BrokenHillTest.php deleted file mode 100644 index 53392b6..0000000 --- a/tests/Earth/Timezone/Australia/BrokenHillTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Australia/CanberraTest.php b/tests/Earth/Timezone/Australia/CanberraTest.php deleted file mode 100644 index 57ef78f..0000000 --- a/tests/Earth/Timezone/Australia/CanberraTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Australia/CurrieTest.php b/tests/Earth/Timezone/Australia/CurrieTest.php deleted file mode 100644 index 4fe2158..0000000 --- a/tests/Earth/Timezone/Australia/CurrieTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Australia/DarwinTest.php b/tests/Earth/Timezone/Australia/DarwinTest.php deleted file mode 100644 index d8e4fbe..0000000 --- a/tests/Earth/Timezone/Australia/DarwinTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Australia/EuclaTest.php b/tests/Earth/Timezone/Australia/EuclaTest.php deleted file mode 100644 index c9c35c3..0000000 --- a/tests/Earth/Timezone/Australia/EuclaTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Australia/HobartTest.php b/tests/Earth/Timezone/Australia/HobartTest.php deleted file mode 100644 index 695e232..0000000 --- a/tests/Earth/Timezone/Australia/HobartTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Australia/LindemanTest.php b/tests/Earth/Timezone/Australia/LindemanTest.php deleted file mode 100644 index 0fb302f..0000000 --- a/tests/Earth/Timezone/Australia/LindemanTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Australia/LordeHoweIslandTest.php b/tests/Earth/Timezone/Australia/LordeHoweIslandTest.php deleted file mode 100644 index d6a1046..0000000 --- a/tests/Earth/Timezone/Australia/LordeHoweIslandTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Australia/MelbourneTest.php b/tests/Earth/Timezone/Australia/MelbourneTest.php deleted file mode 100644 index 9287f45..0000000 --- a/tests/Earth/Timezone/Australia/MelbourneTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Australia/NewSouthWalesTest.php b/tests/Earth/Timezone/Australia/NewSouthWalesTest.php deleted file mode 100644 index b38994d..0000000 --- a/tests/Earth/Timezone/Australia/NewSouthWalesTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Australia/NorthTest.php b/tests/Earth/Timezone/Australia/NorthTest.php deleted file mode 100644 index 2ed537d..0000000 --- a/tests/Earth/Timezone/Australia/NorthTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Australia/PerthTest.php b/tests/Earth/Timezone/Australia/PerthTest.php deleted file mode 100644 index 200097c..0000000 --- a/tests/Earth/Timezone/Australia/PerthTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Australia/QueenslandTest.php b/tests/Earth/Timezone/Australia/QueenslandTest.php deleted file mode 100644 index ab96376..0000000 --- a/tests/Earth/Timezone/Australia/QueenslandTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Australia/SouthTest.php b/tests/Earth/Timezone/Australia/SouthTest.php deleted file mode 100644 index 6ce9bb1..0000000 --- a/tests/Earth/Timezone/Australia/SouthTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Australia/SydneyTest.php b/tests/Earth/Timezone/Australia/SydneyTest.php deleted file mode 100644 index 98c6cf2..0000000 --- a/tests/Earth/Timezone/Australia/SydneyTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Australia/TasmaniaTest.php b/tests/Earth/Timezone/Australia/TasmaniaTest.php deleted file mode 100644 index e0d6b3c..0000000 --- a/tests/Earth/Timezone/Australia/TasmaniaTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Australia/VictoriaTest.php b/tests/Earth/Timezone/Australia/VictoriaTest.php deleted file mode 100644 index a2e2991..0000000 --- a/tests/Earth/Timezone/Australia/VictoriaTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Australia/WestTest.php b/tests/Earth/Timezone/Australia/WestTest.php deleted file mode 100644 index ac043da..0000000 --- a/tests/Earth/Timezone/Australia/WestTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Australia/YancowinnaTest.php b/tests/Earth/Timezone/Australia/YancowinnaTest.php deleted file mode 100644 index f38d77c..0000000 --- a/tests/Earth/Timezone/Australia/YancowinnaTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Europe/AmsterdamTest.php b/tests/Earth/Timezone/Europe/AmsterdamTest.php deleted file mode 100644 index b1c06f2..0000000 --- a/tests/Earth/Timezone/Europe/AmsterdamTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Europe/AndorraTest.php b/tests/Earth/Timezone/Europe/AndorraTest.php deleted file mode 100644 index f20b19e..0000000 --- a/tests/Earth/Timezone/Europe/AndorraTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Europe/AthensTest.php b/tests/Earth/Timezone/Europe/AthensTest.php deleted file mode 100644 index 60957a9..0000000 --- a/tests/Earth/Timezone/Europe/AthensTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Europe/BelfastTest.php b/tests/Earth/Timezone/Europe/BelfastTest.php deleted file mode 100644 index 3e2b87c..0000000 --- a/tests/Earth/Timezone/Europe/BelfastTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Europe/BelgradeTest.php b/tests/Earth/Timezone/Europe/BelgradeTest.php deleted file mode 100644 index d7be5dd..0000000 --- a/tests/Earth/Timezone/Europe/BelgradeTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Europe/BerlinTest.php b/tests/Earth/Timezone/Europe/BerlinTest.php deleted file mode 100644 index 2d9ad58..0000000 --- a/tests/Earth/Timezone/Europe/BerlinTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Europe/BratislavaTest.php b/tests/Earth/Timezone/Europe/BratislavaTest.php deleted file mode 100644 index 7d53e8b..0000000 --- a/tests/Earth/Timezone/Europe/BratislavaTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Europe/BrusselsTest.php b/tests/Earth/Timezone/Europe/BrusselsTest.php deleted file mode 100644 index 79ce0fc..0000000 --- a/tests/Earth/Timezone/Europe/BrusselsTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Europe/BucharestTest.php b/tests/Earth/Timezone/Europe/BucharestTest.php deleted file mode 100644 index 980f2d1..0000000 --- a/tests/Earth/Timezone/Europe/BucharestTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Europe/BudapestTest.php b/tests/Earth/Timezone/Europe/BudapestTest.php deleted file mode 100644 index a91095b..0000000 --- a/tests/Earth/Timezone/Europe/BudapestTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Europe/BusingenTest.php b/tests/Earth/Timezone/Europe/BusingenTest.php deleted file mode 100644 index b7693ee..0000000 --- a/tests/Earth/Timezone/Europe/BusingenTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Europe/ChisinauTest.php b/tests/Earth/Timezone/Europe/ChisinauTest.php deleted file mode 100644 index 970d24e..0000000 --- a/tests/Earth/Timezone/Europe/ChisinauTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Europe/CopenhagenTest.php b/tests/Earth/Timezone/Europe/CopenhagenTest.php deleted file mode 100644 index 147c060..0000000 --- a/tests/Earth/Timezone/Europe/CopenhagenTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Europe/DublinTest.php b/tests/Earth/Timezone/Europe/DublinTest.php deleted file mode 100644 index 8f8424e..0000000 --- a/tests/Earth/Timezone/Europe/DublinTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Europe/GibraltarTest.php b/tests/Earth/Timezone/Europe/GibraltarTest.php deleted file mode 100644 index c11e407..0000000 --- a/tests/Earth/Timezone/Europe/GibraltarTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Europe/GuernseyTest.php b/tests/Earth/Timezone/Europe/GuernseyTest.php deleted file mode 100644 index 4eba48b..0000000 --- a/tests/Earth/Timezone/Europe/GuernseyTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Europe/HelsinkiTest.php b/tests/Earth/Timezone/Europe/HelsinkiTest.php deleted file mode 100644 index be329f1..0000000 --- a/tests/Earth/Timezone/Europe/HelsinkiTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Europe/IsleOfManTest.php b/tests/Earth/Timezone/Europe/IsleOfManTest.php deleted file mode 100644 index 9160f07..0000000 --- a/tests/Earth/Timezone/Europe/IsleOfManTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Europe/IstanbulTest.php b/tests/Earth/Timezone/Europe/IstanbulTest.php deleted file mode 100644 index b2c2365..0000000 --- a/tests/Earth/Timezone/Europe/IstanbulTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Europe/JerseyTest.php b/tests/Earth/Timezone/Europe/JerseyTest.php deleted file mode 100644 index 62d935d..0000000 --- a/tests/Earth/Timezone/Europe/JerseyTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Europe/KaliningradTest.php b/tests/Earth/Timezone/Europe/KaliningradTest.php deleted file mode 100644 index 97d66b3..0000000 --- a/tests/Earth/Timezone/Europe/KaliningradTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Europe/KievTest.php b/tests/Earth/Timezone/Europe/KievTest.php deleted file mode 100644 index ada2786..0000000 --- a/tests/Earth/Timezone/Europe/KievTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Europe/LisbonTest.php b/tests/Earth/Timezone/Europe/LisbonTest.php deleted file mode 100644 index 33fc53b..0000000 --- a/tests/Earth/Timezone/Europe/LisbonTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Europe/LjubljanaTest.php b/tests/Earth/Timezone/Europe/LjubljanaTest.php deleted file mode 100644 index f82eb44..0000000 --- a/tests/Earth/Timezone/Europe/LjubljanaTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Europe/LondonTest.php b/tests/Earth/Timezone/Europe/LondonTest.php deleted file mode 100644 index ca3d322..0000000 --- a/tests/Earth/Timezone/Europe/LondonTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Europe/LuxembourgTest.php b/tests/Earth/Timezone/Europe/LuxembourgTest.php deleted file mode 100644 index ef68b5e..0000000 --- a/tests/Earth/Timezone/Europe/LuxembourgTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Europe/MadridTest.php b/tests/Earth/Timezone/Europe/MadridTest.php deleted file mode 100644 index 3ffd250..0000000 --- a/tests/Earth/Timezone/Europe/MadridTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Europe/MaltaTest.php b/tests/Earth/Timezone/Europe/MaltaTest.php deleted file mode 100644 index 695ac2b..0000000 --- a/tests/Earth/Timezone/Europe/MaltaTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Europe/MariehamnTest.php b/tests/Earth/Timezone/Europe/MariehamnTest.php deleted file mode 100644 index eb89fe6..0000000 --- a/tests/Earth/Timezone/Europe/MariehamnTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Europe/MinskTest.php b/tests/Earth/Timezone/Europe/MinskTest.php deleted file mode 100644 index c2ece1a..0000000 --- a/tests/Earth/Timezone/Europe/MinskTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Europe/MonacoTest.php b/tests/Earth/Timezone/Europe/MonacoTest.php deleted file mode 100644 index ecb667f..0000000 --- a/tests/Earth/Timezone/Europe/MonacoTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Europe/MoscowTest.php b/tests/Earth/Timezone/Europe/MoscowTest.php deleted file mode 100644 index 318a12c..0000000 --- a/tests/Earth/Timezone/Europe/MoscowTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Europe/NicosiaTest.php b/tests/Earth/Timezone/Europe/NicosiaTest.php deleted file mode 100644 index 1d124be..0000000 --- a/tests/Earth/Timezone/Europe/NicosiaTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Europe/OsloTest.php b/tests/Earth/Timezone/Europe/OsloTest.php deleted file mode 100644 index 590765b..0000000 --- a/tests/Earth/Timezone/Europe/OsloTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Europe/ParisTest.php b/tests/Earth/Timezone/Europe/ParisTest.php deleted file mode 100644 index a24834c..0000000 --- a/tests/Earth/Timezone/Europe/ParisTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Europe/PodgoricaTest.php b/tests/Earth/Timezone/Europe/PodgoricaTest.php deleted file mode 100644 index fb86465..0000000 --- a/tests/Earth/Timezone/Europe/PodgoricaTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Europe/PragueTest.php b/tests/Earth/Timezone/Europe/PragueTest.php deleted file mode 100644 index f01692e..0000000 --- a/tests/Earth/Timezone/Europe/PragueTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Europe/RigaTest.php b/tests/Earth/Timezone/Europe/RigaTest.php deleted file mode 100644 index e336e63..0000000 --- a/tests/Earth/Timezone/Europe/RigaTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Europe/RomeTest.php b/tests/Earth/Timezone/Europe/RomeTest.php deleted file mode 100644 index 78c71e2..0000000 --- a/tests/Earth/Timezone/Europe/RomeTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Europe/SamaraTest.php b/tests/Earth/Timezone/Europe/SamaraTest.php deleted file mode 100644 index 08bcba9..0000000 --- a/tests/Earth/Timezone/Europe/SamaraTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Europe/SanMarinoTest.php b/tests/Earth/Timezone/Europe/SanMarinoTest.php deleted file mode 100644 index 272f8ba..0000000 --- a/tests/Earth/Timezone/Europe/SanMarinoTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Europe/SarajevoTest.php b/tests/Earth/Timezone/Europe/SarajevoTest.php deleted file mode 100644 index ad4f96e..0000000 --- a/tests/Earth/Timezone/Europe/SarajevoTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Europe/SimferopolTest.php b/tests/Earth/Timezone/Europe/SimferopolTest.php deleted file mode 100644 index da24d78..0000000 --- a/tests/Earth/Timezone/Europe/SimferopolTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Europe/SkopjeTest.php b/tests/Earth/Timezone/Europe/SkopjeTest.php deleted file mode 100644 index 88a9004..0000000 --- a/tests/Earth/Timezone/Europe/SkopjeTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Europe/SofiaTest.php b/tests/Earth/Timezone/Europe/SofiaTest.php deleted file mode 100644 index 3d4c976..0000000 --- a/tests/Earth/Timezone/Europe/SofiaTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Europe/StockholmTest.php b/tests/Earth/Timezone/Europe/StockholmTest.php deleted file mode 100644 index 31128d6..0000000 --- a/tests/Earth/Timezone/Europe/StockholmTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Europe/TallinnTest.php b/tests/Earth/Timezone/Europe/TallinnTest.php deleted file mode 100644 index 9752f82..0000000 --- a/tests/Earth/Timezone/Europe/TallinnTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Europe/TiraneTest.php b/tests/Earth/Timezone/Europe/TiraneTest.php deleted file mode 100644 index ad394b9..0000000 --- a/tests/Earth/Timezone/Europe/TiraneTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Europe/TiraspolTest.php b/tests/Earth/Timezone/Europe/TiraspolTest.php deleted file mode 100644 index 10ee318..0000000 --- a/tests/Earth/Timezone/Europe/TiraspolTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Europe/UzhgorodTest.php b/tests/Earth/Timezone/Europe/UzhgorodTest.php deleted file mode 100644 index ad723b6..0000000 --- a/tests/Earth/Timezone/Europe/UzhgorodTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Europe/VaduzTest.php b/tests/Earth/Timezone/Europe/VaduzTest.php deleted file mode 100644 index d30e0be..0000000 --- a/tests/Earth/Timezone/Europe/VaduzTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Europe/VaticanTest.php b/tests/Earth/Timezone/Europe/VaticanTest.php deleted file mode 100644 index 8ac2937..0000000 --- a/tests/Earth/Timezone/Europe/VaticanTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Europe/ViennaTest.php b/tests/Earth/Timezone/Europe/ViennaTest.php deleted file mode 100644 index 544d8bb..0000000 --- a/tests/Earth/Timezone/Europe/ViennaTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Europe/VilniusTest.php b/tests/Earth/Timezone/Europe/VilniusTest.php deleted file mode 100644 index ad0ff9f..0000000 --- a/tests/Earth/Timezone/Europe/VilniusTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Europe/VolgogradTest.php b/tests/Earth/Timezone/Europe/VolgogradTest.php deleted file mode 100644 index d5c41c3..0000000 --- a/tests/Earth/Timezone/Europe/VolgogradTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Europe/WarsawTest.php b/tests/Earth/Timezone/Europe/WarsawTest.php deleted file mode 100644 index 421d9c9..0000000 --- a/tests/Earth/Timezone/Europe/WarsawTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Europe/ZagrebTest.php b/tests/Earth/Timezone/Europe/ZagrebTest.php deleted file mode 100644 index ef9ff0d..0000000 --- a/tests/Earth/Timezone/Europe/ZagrebTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Europe/ZaporozhyeTest.php b/tests/Earth/Timezone/Europe/ZaporozhyeTest.php deleted file mode 100644 index 782501c..0000000 --- a/tests/Earth/Timezone/Europe/ZaporozhyeTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Europe/ZurichTest.php b/tests/Earth/Timezone/Europe/ZurichTest.php deleted file mode 100644 index ae6741d..0000000 --- a/tests/Earth/Timezone/Europe/ZurichTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Indian/AntananarivoTest.php b/tests/Earth/Timezone/Indian/AntananarivoTest.php deleted file mode 100644 index 178c240..0000000 --- a/tests/Earth/Timezone/Indian/AntananarivoTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Indian/ChagosTest.php b/tests/Earth/Timezone/Indian/ChagosTest.php deleted file mode 100644 index 58160b5..0000000 --- a/tests/Earth/Timezone/Indian/ChagosTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Indian/ChristmasTest.php b/tests/Earth/Timezone/Indian/ChristmasTest.php deleted file mode 100644 index feb836d..0000000 --- a/tests/Earth/Timezone/Indian/ChristmasTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Indian/CocosTest.php b/tests/Earth/Timezone/Indian/CocosTest.php deleted file mode 100644 index a66ce7c..0000000 --- a/tests/Earth/Timezone/Indian/CocosTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Indian/ComoroTest.php b/tests/Earth/Timezone/Indian/ComoroTest.php deleted file mode 100644 index 815e2bd..0000000 --- a/tests/Earth/Timezone/Indian/ComoroTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Indian/KerguelenTest.php b/tests/Earth/Timezone/Indian/KerguelenTest.php deleted file mode 100644 index 223f2c7..0000000 --- a/tests/Earth/Timezone/Indian/KerguelenTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Indian/MaheTest.php b/tests/Earth/Timezone/Indian/MaheTest.php deleted file mode 100644 index f291b23..0000000 --- a/tests/Earth/Timezone/Indian/MaheTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Indian/MaldivesTest.php b/tests/Earth/Timezone/Indian/MaldivesTest.php deleted file mode 100644 index d12213d..0000000 --- a/tests/Earth/Timezone/Indian/MaldivesTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Indian/MauritiusTest.php b/tests/Earth/Timezone/Indian/MauritiusTest.php deleted file mode 100644 index d879fc2..0000000 --- a/tests/Earth/Timezone/Indian/MauritiusTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Indian/MayotteTest.php b/tests/Earth/Timezone/Indian/MayotteTest.php deleted file mode 100644 index e4f508a..0000000 --- a/tests/Earth/Timezone/Indian/MayotteTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Indian/ReunionTest.php b/tests/Earth/Timezone/Indian/ReunionTest.php deleted file mode 100644 index e6d4408..0000000 --- a/tests/Earth/Timezone/Indian/ReunionTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Pacific/ApiaTest.php b/tests/Earth/Timezone/Pacific/ApiaTest.php deleted file mode 100644 index 34b09b3..0000000 --- a/tests/Earth/Timezone/Pacific/ApiaTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Pacific/AucklandTest.php b/tests/Earth/Timezone/Pacific/AucklandTest.php deleted file mode 100644 index 74731b1..0000000 --- a/tests/Earth/Timezone/Pacific/AucklandTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Pacific/BougainvilleTest.php b/tests/Earth/Timezone/Pacific/BougainvilleTest.php deleted file mode 100644 index 1632faa..0000000 --- a/tests/Earth/Timezone/Pacific/BougainvilleTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Pacific/ChathamTest.php b/tests/Earth/Timezone/Pacific/ChathamTest.php deleted file mode 100644 index 999ab7d..0000000 --- a/tests/Earth/Timezone/Pacific/ChathamTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Pacific/ChuukTest.php b/tests/Earth/Timezone/Pacific/ChuukTest.php deleted file mode 100644 index e577882..0000000 --- a/tests/Earth/Timezone/Pacific/ChuukTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Pacific/EasterTest.php b/tests/Earth/Timezone/Pacific/EasterTest.php deleted file mode 100644 index 4f94974..0000000 --- a/tests/Earth/Timezone/Pacific/EasterTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Pacific/EfateTest.php b/tests/Earth/Timezone/Pacific/EfateTest.php deleted file mode 100644 index 19f5a9e..0000000 --- a/tests/Earth/Timezone/Pacific/EfateTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Pacific/EnderburyTest.php b/tests/Earth/Timezone/Pacific/EnderburyTest.php deleted file mode 100644 index c7217dc..0000000 --- a/tests/Earth/Timezone/Pacific/EnderburyTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Pacific/FakaofoTest.php b/tests/Earth/Timezone/Pacific/FakaofoTest.php deleted file mode 100644 index f59270f..0000000 --- a/tests/Earth/Timezone/Pacific/FakaofoTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Pacific/FijiTest.php b/tests/Earth/Timezone/Pacific/FijiTest.php deleted file mode 100644 index 132201d..0000000 --- a/tests/Earth/Timezone/Pacific/FijiTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Pacific/FunafutiTest.php b/tests/Earth/Timezone/Pacific/FunafutiTest.php deleted file mode 100644 index ac646e9..0000000 --- a/tests/Earth/Timezone/Pacific/FunafutiTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Pacific/GalapagosTest.php b/tests/Earth/Timezone/Pacific/GalapagosTest.php deleted file mode 100644 index ebc2954..0000000 --- a/tests/Earth/Timezone/Pacific/GalapagosTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Pacific/GambierTest.php b/tests/Earth/Timezone/Pacific/GambierTest.php deleted file mode 100644 index e9fe1da..0000000 --- a/tests/Earth/Timezone/Pacific/GambierTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Pacific/GuadalcanalTest.php b/tests/Earth/Timezone/Pacific/GuadalcanalTest.php deleted file mode 100644 index 216e61f..0000000 --- a/tests/Earth/Timezone/Pacific/GuadalcanalTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Pacific/GuamTest.php b/tests/Earth/Timezone/Pacific/GuamTest.php deleted file mode 100644 index 9f657c9..0000000 --- a/tests/Earth/Timezone/Pacific/GuamTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Pacific/HonoluluTest.php b/tests/Earth/Timezone/Pacific/HonoluluTest.php deleted file mode 100644 index dc0e05d..0000000 --- a/tests/Earth/Timezone/Pacific/HonoluluTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Pacific/JohnstonTest.php b/tests/Earth/Timezone/Pacific/JohnstonTest.php deleted file mode 100644 index d6d7445..0000000 --- a/tests/Earth/Timezone/Pacific/JohnstonTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Pacific/KiritimatiTest.php b/tests/Earth/Timezone/Pacific/KiritimatiTest.php deleted file mode 100644 index ed049a1..0000000 --- a/tests/Earth/Timezone/Pacific/KiritimatiTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Pacific/KosraeTest.php b/tests/Earth/Timezone/Pacific/KosraeTest.php deleted file mode 100644 index 4807dc7..0000000 --- a/tests/Earth/Timezone/Pacific/KosraeTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Pacific/KwajaleinTest.php b/tests/Earth/Timezone/Pacific/KwajaleinTest.php deleted file mode 100644 index 813b5fb..0000000 --- a/tests/Earth/Timezone/Pacific/KwajaleinTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Pacific/MajuroTest.php b/tests/Earth/Timezone/Pacific/MajuroTest.php deleted file mode 100644 index 76ab26f..0000000 --- a/tests/Earth/Timezone/Pacific/MajuroTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Pacific/MarquesasTest.php b/tests/Earth/Timezone/Pacific/MarquesasTest.php deleted file mode 100644 index f5002ff..0000000 --- a/tests/Earth/Timezone/Pacific/MarquesasTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Pacific/MidwayTest.php b/tests/Earth/Timezone/Pacific/MidwayTest.php deleted file mode 100644 index aff5f60..0000000 --- a/tests/Earth/Timezone/Pacific/MidwayTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Pacific/NauruTest.php b/tests/Earth/Timezone/Pacific/NauruTest.php deleted file mode 100644 index a05409e..0000000 --- a/tests/Earth/Timezone/Pacific/NauruTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Pacific/NiueTest.php b/tests/Earth/Timezone/Pacific/NiueTest.php deleted file mode 100644 index dc3c71a..0000000 --- a/tests/Earth/Timezone/Pacific/NiueTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Pacific/NorfolkTest.php b/tests/Earth/Timezone/Pacific/NorfolkTest.php deleted file mode 100644 index 001fac1..0000000 --- a/tests/Earth/Timezone/Pacific/NorfolkTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Pacific/NoumeaTest.php b/tests/Earth/Timezone/Pacific/NoumeaTest.php deleted file mode 100644 index d6def49..0000000 --- a/tests/Earth/Timezone/Pacific/NoumeaTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Pacific/PagoPagoTest.php b/tests/Earth/Timezone/Pacific/PagoPagoTest.php deleted file mode 100644 index 505419a..0000000 --- a/tests/Earth/Timezone/Pacific/PagoPagoTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Pacific/PalauTest.php b/tests/Earth/Timezone/Pacific/PalauTest.php deleted file mode 100644 index f19d6b8..0000000 --- a/tests/Earth/Timezone/Pacific/PalauTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Pacific/PitcairnTest.php b/tests/Earth/Timezone/Pacific/PitcairnTest.php deleted file mode 100644 index 1059140..0000000 --- a/tests/Earth/Timezone/Pacific/PitcairnTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Pacific/PohnpeiTest.php b/tests/Earth/Timezone/Pacific/PohnpeiTest.php deleted file mode 100644 index 7fa619a..0000000 --- a/tests/Earth/Timezone/Pacific/PohnpeiTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Pacific/PonapeTest.php b/tests/Earth/Timezone/Pacific/PonapeTest.php deleted file mode 100644 index 4510e13..0000000 --- a/tests/Earth/Timezone/Pacific/PonapeTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Pacific/PortMoresbyTest.php b/tests/Earth/Timezone/Pacific/PortMoresbyTest.php deleted file mode 100644 index 8abcd55..0000000 --- a/tests/Earth/Timezone/Pacific/PortMoresbyTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Pacific/RarotongaTest.php b/tests/Earth/Timezone/Pacific/RarotongaTest.php deleted file mode 100644 index 83c3ce2..0000000 --- a/tests/Earth/Timezone/Pacific/RarotongaTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Pacific/SaipanTest.php b/tests/Earth/Timezone/Pacific/SaipanTest.php deleted file mode 100644 index 276f76c..0000000 --- a/tests/Earth/Timezone/Pacific/SaipanTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Pacific/TahitiTest.php b/tests/Earth/Timezone/Pacific/TahitiTest.php deleted file mode 100644 index b1680a7..0000000 --- a/tests/Earth/Timezone/Pacific/TahitiTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Pacific/TarawaTest.php b/tests/Earth/Timezone/Pacific/TarawaTest.php deleted file mode 100644 index 4705596..0000000 --- a/tests/Earth/Timezone/Pacific/TarawaTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Pacific/TongatapuTest.php b/tests/Earth/Timezone/Pacific/TongatapuTest.php deleted file mode 100644 index 35dc9e0..0000000 --- a/tests/Earth/Timezone/Pacific/TongatapuTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Pacific/TrukTest.php b/tests/Earth/Timezone/Pacific/TrukTest.php deleted file mode 100644 index ee14048..0000000 --- a/tests/Earth/Timezone/Pacific/TrukTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Pacific/WakeTest.php b/tests/Earth/Timezone/Pacific/WakeTest.php deleted file mode 100644 index bd677e6..0000000 --- a/tests/Earth/Timezone/Pacific/WakeTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Pacific/WallisTest.php b/tests/Earth/Timezone/Pacific/WallisTest.php deleted file mode 100644 index 2ee07e3..0000000 --- a/tests/Earth/Timezone/Pacific/WallisTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/Pacific/YapTest.php b/tests/Earth/Timezone/Pacific/YapTest.php deleted file mode 100644 index 41bb6f3..0000000 --- a/tests/Earth/Timezone/Pacific/YapTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - } -} diff --git a/tests/Earth/Timezone/UTCTest.php b/tests/Earth/Timezone/UTCTest.php deleted file mode 100644 index b997c85..0000000 --- a/tests/Earth/Timezone/UTCTest.php +++ /dev/null @@ -1,104 +0,0 @@ -assertInstanceOf(Timezone::class, $zone); - $this->assertSame(1, $zone->hours()); - $this->assertSame(0, $zone->minutes()); - $this->assertSame('+01:00', $zone->toString()); - $this->assertFalse($zone->daylightSavingTimeApplied()); - - $this->assertSame('Z', (new UTC)->toString()); - } - - public function testThrowWhenHoursTooLow() - { - $this->expectException(InvalidTimezone::class); - $this->expectExceptionMessage('-13:0'); - - new UTC(-13); - } - - public function testThrowWhenHoursTooHigh() - { - $this->expectException(InvalidTimezone::class); - $this->expectExceptionMessage('15:0'); - - new UTC(15); - } - - public function testThrowWhenMinutesTooLow() - { - $this->expectException(InvalidTimezone::class); - $this->expectExceptionMessage('-11:-1'); - - new UTC(-11, -1); - } - - public function testThrowWhenMinutesTooHigh() - { - $this->expectException(InvalidTimezone::class); - $this->expectExceptionMessage('11:60'); - - new UTC(11, 60); - } - - /** - * @dataProvider cases - */ - public function testFormat(string $expected, int $hours, int $minutes) - { - $zone = new UTC($hours, $minutes); - - $this->assertSame($hours, $zone->hours()); - $this->assertSame($minutes, $zone->minutes()); - $this->assertSame($expected, $zone->toString()); - } - - public function testDaylightSavingTime() - { - $zone = UTC::daylightSavingTime(2, 30); - - $this->assertInstanceOf(Timezone::class, $zone); - $this->assertSame(2, $zone->hours()); - $this->assertSame(30, $zone->minutes()); - $this->assertTrue($zone->daylightSavingTimeApplied()); - } - - /** - * @dataProvider cases - */ - public function testFromString(string $zone, int $hours, int $minutes) - { - $zone = UTC::of($zone); - - $this->assertInstanceOf(UTC::class, $zone); - $this->assertSame($hours, $zone->hours()); - $this->assertSame($minutes, $zone->minutes()); - } - - public static function cases() - { - return [ - ['Z', 0, 0], - ['-12:00', -12, 0], - ['+12:00', 12, 0], - ['-03:45', -3, 45], - ['+03:45', 3, 45], - ]; - } -} From f0f2fc50e5ab484fa69b5f3a7ed18c9744b8350d Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Wed, 20 Nov 2024 20:31:21 +0100 Subject: [PATCH 16/85] make Timezone a final class --- CHANGELOG.md | 1 + src/Clock/Live.php | 4 +-- src/PointInTime.php | 6 +++- src/Timezone.php | 73 ++++++++++++++++++++++++++++++++++++--- tests/Clock/LiveTest.php | 6 ++-- tests/NowTest.php | 3 +- tests/PointInTimeTest.php | 3 +- 7 files changed, 81 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 70a0b4e..1f996a5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ - `Innmind\TimeContinuum\Earth\FrozenClock` as been renamed `Innmind\TimeContinuum\Clock\Frozen` - `Innmind\TimeContinuum\Logger\Clock` as been renamed `Innmind\TimeContinuum\Clock\Logger` - Classes in the `Innmind\TimeContinuum\Earth\Move` namespace have been moved to `Innmind\TimeContinuum\Move` +- `Innmind\TimeContinuum\Timezone` is now a `final class` ### Removed diff --git a/src/Clock/Live.php b/src/Clock/Live.php index bead585..6603f38 100644 --- a/src/Clock/Live.php +++ b/src/Clock/Live.php @@ -8,7 +8,6 @@ Timezone, PointInTime, Format, - Earth\Timezone\UTC, }; use Innmind\Immutable\Maybe; @@ -20,7 +19,8 @@ public function __construct(Timezone $timezone = null) { if ($timezone === null) { [$hour, $minute] = \explode(':', \date('P')); - $timezone = new UTC((int) $hour, (int) $minute); + /** @psalm-suppress ArgumentTypeCoercion */ + $timezone = Timezone::of((int) $hour, (int) $minute); } $this->timezone = $timezone; diff --git a/src/PointInTime.php b/src/PointInTime.php index f3d32ea..eb2ec8f 100644 --- a/src/PointInTime.php +++ b/src/PointInTime.php @@ -151,7 +151,11 @@ public function changeTimezone(Timezone $zone): self public function timezone(): Timezone { - return UTC::of($this->date->format('P')); + $string = $this->date->format('P'); + [$hour, $minute] = \explode(':', $string); + + /** @psalm-suppress ArgumentTypeCoercion */ + return Timezone::of((int) $hour, (int) $minute); } public function elapsedSince(self $point): ElapsedPeriod diff --git a/src/Timezone.php b/src/Timezone.php index 00a2779..cbe596f 100644 --- a/src/Timezone.php +++ b/src/Timezone.php @@ -6,14 +6,77 @@ /** * @psalm-immutable */ -interface Timezone +final class Timezone { - public function hours(): int; - public function minutes(): int; - public function daylightSavingTimeApplied(): bool; + /** + * @param int<-12, 14> $hours + * @param int<0, 59> $minutes + */ + private function __construct( + private int $hours, + private int $minutes, + private bool $dst, + ) { + } + + /** + * @psalm-pure + * + * @param int<-12, 14> $hours + * @param int<0, 59> $minutes + */ + public static function daylightSavingTime(int $hours, int $minutes = 0): self + { + return new self($hours, $minutes, true); + } + + /** + * @psalm-pure + * + * @param int<-12, 14> $hours + * @param int<0, 59> $minutes + */ + public static function of(int $hours, int $minutes = 0): self + { + return new self($hours, $minutes, false); + } + + /** + * @return int<-12, 14> + */ + public function hours(): int + { + return $this->hours; + } + + /** + * @return int<0, 59> + */ + public function minutes(): int + { + return $this->minutes; + } + + public function daylightSavingTimeApplied(): bool + { + return $this->dst; + } /** * @return non-empty-string */ - public function toString(): string; + public function toString(): string + { + if ($this->hours === 0 && $this->minutes === 0) { + return 'Z'; + } + + /** @var non-empty-string */ + return \sprintf( + '%s%02d:%02d', + $this->hours > 0 ? '+' : '-', + \abs($this->hours), + $this->minutes, + ); + } } diff --git a/tests/Clock/LiveTest.php b/tests/Clock/LiveTest.php index c75bb09..5a2c3e4 100644 --- a/tests/Clock/LiveTest.php +++ b/tests/Clock/LiveTest.php @@ -8,7 +8,7 @@ Clock, PointInTime, Format, - Earth\Timezone\UTC, + Timezone, }; use PHPUnit\Framework\TestCase; use Innmind\BlackBox\{ @@ -63,7 +63,7 @@ public function testNowAtGivenExpectedTimezone() { $this->assertInstanceOf( PointInTime::class, - $now = (new Live(new UTC(6, 42)))->now(), + $now = (new Live(Timezone::of(6, 42)))->now(), ); $this->assertSame('+06:42', $now->timezone()->toString()); } @@ -72,7 +72,7 @@ public function testAtWithExpectedTimezone() { $this->assertInstanceOf( PointInTime::class, - $point = (new Live(new UTC(6, 42)))->at('2016-10-08T16:08:30+02:00')->match( + $point = (new Live(Timezone::of(6, 42)))->at('2016-10-08T16:08:30+02:00')->match( static fn($point) => $point, static fn() => null, ), diff --git a/tests/NowTest.php b/tests/NowTest.php index 3bb6c58..39191e8 100644 --- a/tests/NowTest.php +++ b/tests/NowTest.php @@ -15,7 +15,6 @@ PointInTime\Minute, PointInTime\Second, PointInTime\Millisecond, - Earth\Timezone\UTC, Period, Period\Year, }; @@ -72,7 +71,7 @@ public function testChangeTimezone() $now = new \DateTimeImmutable; $now = $now->setTimezone(new \DateTimeZone('-02:30')); $point = PointInTime::now(); - $point2 = $point->changeTimezone(new UTC(-2, 30)); + $point2 = $point->changeTimezone(Timezone::of(-2, 30)); $this->assertNotSame($point, $point2); $this->assertNotSame($point->year(), $point2->year()); diff --git a/tests/PointInTimeTest.php b/tests/PointInTimeTest.php index 94eac9b..e6c1241 100644 --- a/tests/PointInTimeTest.php +++ b/tests/PointInTimeTest.php @@ -15,7 +15,6 @@ PointInTime\Minute, PointInTime\Second, PointInTime\Millisecond, - Earth\Timezone\UTC, Period, Period\Day, }; @@ -71,7 +70,7 @@ public function testFormat() public function testChangeTimezone() { $point = PointInTime::at('2016-10-05T08:01:30.123+02:00'); - $point2 = $point->changeTimezone(new UTC(-2, 30)); + $point2 = $point->changeTimezone(Timezone::of(-2, 30)); $this->assertNotSame($point, $point2); $this->assertNotSame($point->year(), $point2->year()); From 110b9a87530afac60063828dc1230b38f3fb64a7 Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Thu, 21 Nov 2024 17:12:35 +0100 Subject: [PATCH 17/85] CS --- src/PointInTime.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/PointInTime.php b/src/PointInTime.php index eb2ec8f..bfe5e77 100644 --- a/src/PointInTime.php +++ b/src/PointInTime.php @@ -12,7 +12,6 @@ PointInTime\Second, PointInTime\Millisecond, PointInTime\HighResolution, - Earth\Timezone\UTC, }; /** From 359277a727fcc9db3111d0e29d629aff3773a2b4 Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Thu, 21 Nov 2024 17:13:03 +0100 Subject: [PATCH 18/85] simplify milliseconds handling --- src/PointInTime.php | 28 ++++++---------------------- 1 file changed, 6 insertions(+), 22 deletions(-) diff --git a/src/PointInTime.php b/src/PointInTime.php index bfe5e77..9ad0196 100644 --- a/src/PointInTime.php +++ b/src/PointInTime.php @@ -19,13 +19,9 @@ */ final class PointInTime { - /** - * @param int<0, max> $milliseconds - */ private function __construct( private \DateTimeImmutable $date, private ?HighResolution $highResolution, - private int $milliseconds, ) { } @@ -44,7 +40,6 @@ public static function at(string $date): self return new self( $datetime, null, - $milliseconds + self::millisecondOf($datetime), ); } @@ -56,13 +51,10 @@ public static function now(): self $now = new \DateTimeImmutable('now'); /** @psalm-suppress ImpureMethodCallAcceptable since only a clock should instantiate this class */ $highResolution = HighResolution::now(); - /** @var int<0, max> */ - $milliseconds = $now->getTimestamp() * 1000; return new self( $now, $highResolution, - $milliseconds + self::millisecondOf($now), ); } @@ -73,7 +65,8 @@ public static function now(): self */ public function milliseconds(): int { - return $this->milliseconds; + /** @var int<0, max> */ + return (int) $this->date->format('Uv'); } public function year(): Year @@ -129,7 +122,10 @@ public function second(): Second public function millisecond(): Millisecond { - return Millisecond::of(self::millisecondOf($this->date)); + /** @var int<0, 999> */ + $millisecond = (int) $this->date->format('v'); + + return Millisecond::of($millisecond); } public function format(Format $format): string @@ -144,7 +140,6 @@ public function changeTimezone(Timezone $zone): self new \DateTimeZone($zone->toString()), ), $this->highResolution, - $this->milliseconds, ); } @@ -266,15 +261,4 @@ private static function periodComponents(): array 'seconds', ]; } - - /** - * @psalm-pure - * - * @return int<0, 999> - */ - private static function millisecondOf(\DateTimeImmutable $date): int - { - /** @var int<0, 999> */ - return (int) ((int) $date->format('u') / 1000); - } } From 95349ac298156c19894dafc267670bd2dea03404 Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Thu, 21 Nov 2024 17:24:19 +0100 Subject: [PATCH 19/85] simplify going forward/backward in time --- src/Move/StartOfDay.php | 11 +--- src/PointInTime.php | 142 +++++++++++++++++++++------------------- 2 files changed, 77 insertions(+), 76 deletions(-) diff --git a/src/Move/StartOfDay.php b/src/Move/StartOfDay.php index 1299660..920ef56 100644 --- a/src/Move/StartOfDay.php +++ b/src/Move/StartOfDay.php @@ -15,18 +15,11 @@ final class StartOfDay { public function __invoke(PointInTime $point): PointInTime { - $seconds = \max($point->second()->toInt() - 1, 0); - $millisecond = $point->millisecond()->toInt(); - - if ($seconds !== 0 && $millisecond === 0) { - ++$seconds; - } - return $point->goBack( Hour::of($point->hour()->toInt()) ->add(Minute::of($point->minute()->toInt())) - ->add(Second::of($seconds)) - ->add(Millisecond::of($millisecond)), + ->add(Second::of($point->second()->toInt())) + ->add(Millisecond::of($point->millisecond()->toInt())), ); } } diff --git a/src/PointInTime.php b/src/PointInTime.php index 9ad0196..8966595 100644 --- a/src/PointInTime.php +++ b/src/PointInTime.php @@ -33,6 +33,7 @@ private function __construct( */ public static function at(string $date): self { + /** @psalm-suppress ImpureMethodCall */ $datetime = new \DateTimeImmutable($date); /** @var int<0, max> */ $milliseconds = $datetime->getTimestamp() * 1000; @@ -163,71 +164,30 @@ public function elapsedSince(self $point): ElapsedPeriod public function goBack(Period $period): self { - if ($this->millisecond()->toInt() > 0) { - $period = $period->add( - Period\Millisecond::of(1000 - $this->millisecond()->toInt()), - ); - } - $date = $this->date; - - foreach (self::periodComponents() as $component) { - /** @var int $periodComponent */ - $periodComponent = $period->{$component}(); - - if ($periodComponent > 0) { - /** @psalm-suppress PossiblyFalseReference The input is validated so there shouldn't be any error */ - $date = $date->modify( - \sprintf( - '-%s %s', - $periodComponent, - $component, - ), - ); - } - } + $interval = self::dateInterval($period); - if ($this->millisecond()->toInt() === 0 && $period->milliseconds() > 0) { - /** @psalm-suppress PossiblyFalseReference The input is validated so there shouldn't be any error */ - $date = $date->modify('-1 second'); + if (\is_null($interval)) { + return $this; } - /** @psalm-suppress PossiblyFalseReference The input is validated so there shouldn't be any error */ - // todo avoid using the string representation - return self::at(\sprintf( - $date->format('Y-m-d\TH:i:s.%03\sP'), - $period->milliseconds() > 0 ? 1000 - $period->milliseconds() : 0, - )); + return new self( + $this->date->sub($interval), + null, + ); } public function goForward(Period $period): self { - $period = $period->add( - Period\Millisecond::of($this->millisecond()->toInt()), - ); - $date = $this->date; - - foreach (self::periodComponents() as $component) { - /** @var int $periodComponent */ - $periodComponent = $period->{$component}(); - - if ($periodComponent > 0) { - /** @psalm-suppress PossiblyFalseReference The input is validated so there shouldn't be any error */ - $date = $date->modify( - \sprintf( - '+%s %s', - $periodComponent, - $component, - ), - ); - } + $interval = self::dateInterval($period); + + if (\is_null($interval)) { + return $this; } - /** @psalm-suppress PossiblyFalseReference The input is validated so there shouldn't be any error */ - // todo avoid using the string representation - return self::at(\sprintf( - $date->format('Y-m-d\TH:i:s.%03\sP'), - $period->milliseconds(), - )); + return new self( + $this->date->add($interval), + null, + ); } public function equals(self $point): bool @@ -247,18 +207,66 @@ public function toString(): string /** * @psalm-pure - * - * @return list */ - private static function periodComponents(): array + private static function dateInterval(Period $period): ?\DateInterval { - return [ - 'years', - 'months', - 'days', - 'hours', - 'minutes', - 'seconds', - ]; + /** @var list */ + $parts = []; + + if ($period->years() > 0) { + $parts[] = \sprintf( + '%s years', + $period->years(), + ); + } + + if ($period->months() > 0) { + $parts[] = \sprintf( + '%s months', + $period->months(), + ); + } + + if ($period->days() > 0) { + $parts[] = \sprintf( + '%s days', + $period->days(), + ); + } + + if ($period->hours() > 0) { + $parts[] = \sprintf( + '%s hours', + $period->hours(), + ); + } + + if ($period->minutes() > 0) { + $parts[] = \sprintf( + '%s minutes', + $period->minutes(), + ); + } + + if ($period->seconds() > 0) { + $parts[] = \sprintf( + '%s seconds', + $period->seconds(), + ); + } + + if ($period->milliseconds() > 0) { + $parts[] = \sprintf( + '%s milliseconds', + $period->milliseconds(), + ); + } + + if (\count($parts) === 0) { + return null; + } + + /** @psalm-suppress ImpureMethodCall */ + return \DateInterval::createFromDateString(\implode(' + ', $parts)); } } From cbc3bbd3c664a8cb0ba4a45af02283d28b4fd411 Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Thu, 21 Nov 2024 18:08:28 +0100 Subject: [PATCH 20/85] make Clock a final class --- CHANGELOG.md | 1 + src/Clock.php | 42 ++++++++++++++++++++++++-- src/Clock/Frozen.php | 12 ++++++-- src/Clock/Live.php | 10 +++++-- src/Clock/Logger.php | 9 +++++- tests/Clock/FrozenTest.php | 16 ++-------- tests/Clock/LiveTest.php | 29 ++++++++---------- tests/Clock/LoggerTest.php | 61 ++++++++++---------------------------- 8 files changed, 96 insertions(+), 84 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f996a5..c96a743 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ - `Innmind\TimeContinuum\Logger\Clock` as been renamed `Innmind\TimeContinuum\Clock\Logger` - Classes in the `Innmind\TimeContinuum\Earth\Move` namespace have been moved to `Innmind\TimeContinuum\Move` - `Innmind\TimeContinuum\Timezone` is now a `final class` +- `Innmind\TimeContinuum\Clock` is now a `final class` ### Removed diff --git a/src/Clock.php b/src/Clock.php index 05b9d9c..259bf6f 100644 --- a/src/Clock.php +++ b/src/Clock.php @@ -3,11 +3,40 @@ namespace Innmind\TimeContinuum; +use Innmind\TimeContinuum\Clock\{ + Live, + Frozen, + Logger, +}; use Innmind\Immutable\Maybe; +use Psr\Log\LoggerInterface; -interface Clock +final class Clock { - public function now(): PointInTime; + private function __construct( + private Live|Frozen|Logger $implementation, + ) { + } + + public static function live(): self + { + return new self(new Live); + } + + public static function frozen(PointInTime $point): self + { + return new self(new Frozen($point)); + } + + public static function logger(self $clock, LoggerInterface $logger): self + { + return new self(new Logger($clock, $logger)); + } + + public function now(): PointInTime + { + return $this->implementation->now(); + } /** * @psalm-pure @@ -16,5 +45,12 @@ public function now(): PointInTime; * * @return Maybe */ - public function at(string $date, Format $format = null): Maybe; + public function at(string $date, Format $format = null): Maybe + { + /** + * @psalm-suppress ImpureVariable + * @psalm-suppress ImpurePropertyFetch + */ + return $this->implementation->at($date, $format); + } } diff --git a/src/Clock/Frozen.php b/src/Clock/Frozen.php index 927291a..3240eb2 100644 --- a/src/Clock/Frozen.php +++ b/src/Clock/Frozen.php @@ -4,16 +4,18 @@ namespace Innmind\TimeContinuum\Clock; use Innmind\TimeContinuum\{ - Clock, PointInTime, Format, }; use Innmind\Immutable\Maybe; -final class Frozen implements Clock +/** + * @internal + */ +final class Frozen { private PointInTime $now; - private Clock $concrete; + private Live $concrete; public function __construct(PointInTime $now) { @@ -28,6 +30,10 @@ public function now(): PointInTime /** * @psalm-pure + * + * @param non-empty-string $date + * + * @return Maybe */ public function at(string $date, Format $format = null): Maybe { diff --git a/src/Clock/Live.php b/src/Clock/Live.php index 6603f38..49c941d 100644 --- a/src/Clock/Live.php +++ b/src/Clock/Live.php @@ -4,14 +4,16 @@ namespace Innmind\TimeContinuum\Clock; use Innmind\TimeContinuum\{ - Clock, Timezone, PointInTime, Format, }; use Innmind\Immutable\Maybe; -final class Live implements Clock +/** + * @internal + */ +final class Live { private Timezone $timezone; @@ -33,6 +35,10 @@ public function now(): PointInTime /** * @psalm-pure + * + * @param non-empty-string $date + * + * @return Maybe */ public function at(string $date, Format $format = null): Maybe { diff --git a/src/Clock/Logger.php b/src/Clock/Logger.php index a0074f4..82fe186 100644 --- a/src/Clock/Logger.php +++ b/src/Clock/Logger.php @@ -11,7 +11,10 @@ use Innmind\Immutable\Maybe; use Psr\Log\LoggerInterface; -final class Logger implements Clock +/** + * @internal + */ +final class Logger { private Clock $clock; private LoggerInterface $logger; @@ -34,6 +37,10 @@ public function now(): PointInTime /** * @psalm-pure + * + * @param non-empty-string $date + * + * @return Maybe */ public function at(string $date, Format $format = null): Maybe { diff --git a/tests/Clock/FrozenTest.php b/tests/Clock/FrozenTest.php index 1afe264..a562e3d 100644 --- a/tests/Clock/FrozenTest.php +++ b/tests/Clock/FrozenTest.php @@ -4,9 +4,8 @@ namespace Tests\Innmind\TimeContinuum\Clock; use Innmind\TimeContinuum\{ - Clock\Frozen, - Format, Clock, + Format, PointInTime as PointInTimeInterface, }; use Fixtures\Innmind\TimeContinuum\PointInTime; @@ -17,21 +16,12 @@ class FrozenTest extends TestCase { use BlackBox; - public function testInterface() - { - $this - ->forAll(PointInTime::any()) - ->then(function($now) { - $this->assertInstanceOf(Clock::class, new Frozen($now)); - }); - } - public function testNow() { $this ->forAll(PointInTime::any()) ->then(function($now) { - $this->assertSame($now, (new Frozen($now))->now()); + $this->assertSame($now, Clock::frozen($now)->now()); }); } @@ -43,7 +33,7 @@ public function testAtReturnWithTheSameTimezoneAsNow() PointInTime::any(), ) ->then(function($now, $at) { - $clock = new Frozen($now); + $clock = Clock::frozen($now); $point = $clock->at($at->format(Format::iso8601()))->match( static fn($point) => $point, diff --git a/tests/Clock/LiveTest.php b/tests/Clock/LiveTest.php index 5a2c3e4..64b2783 100644 --- a/tests/Clock/LiveTest.php +++ b/tests/Clock/LiveTest.php @@ -4,7 +4,6 @@ namespace Tests\Innmind\TimeContinuum\Clock; use Innmind\TimeContinuum\{ - Clock\Live, Clock, PointInTime, Format, @@ -20,19 +19,11 @@ class LiveTest extends TestCase { use BlackBox; - public function testInterface() - { - $this->assertInstanceOf( - Clock::class, - new Live, - ); - } - public function testNow() { $this->assertInstanceOf( PointInTime::class, - $now = (new Live)->now(), + $now = Clock::live()->now(), ); $timezone = \date('P'); $timezone = $timezone === '+00:00' ? 'Z' : $timezone; @@ -46,7 +37,7 @@ public function testAt() { $this->assertInstanceOf( PointInTime::class, - $point = (new Live)->at('2016-10-08T16:08:30+02:00')->match( + $point = Clock::live()->at('2016-10-08T16:08:30+02:00')->match( static fn($point) => $point, static fn() => null, ), @@ -61,18 +52,22 @@ public function testAt() public function testNowAtGivenExpectedTimezone() { + $this->markTestSkipped(); + $this->assertInstanceOf( PointInTime::class, - $now = (new Live(Timezone::of(6, 42)))->now(), + $now = Clock::live(Timezone::of(6, 42))->now(), ); $this->assertSame('+06:42', $now->timezone()->toString()); } public function testAtWithExpectedTimezone() { + $this->markTestSkipped(); + $this->assertInstanceOf( PointInTime::class, - $point = (new Live(Timezone::of(6, 42)))->at('2016-10-08T16:08:30+02:00')->match( + $point = Clock::live(Timezone::of(6, 42))->at('2016-10-08T16:08:30+02:00')->match( static fn($point) => $point, static fn() => null, ), @@ -84,7 +79,7 @@ public function testAtWithSpecificFormat() { $this->assertInstanceOf( PointInTime::class, - $point = (new Live)->at('+02:00 2016-10-08 16:08:30', Format::of('P Y-m-d H:i:s'))->match( + $point = Clock::live()->at('+02:00 2016-10-08 16:08:30', Format::of('P Y-m-d H:i:s'))->match( static fn($point) => $point, static fn() => null, ), @@ -102,7 +97,7 @@ public function testAtWithDateNotOfExpectedFormat() $this ->forAll(Set\Strings::any()) ->then(function($date) { - $clock = new Live; + $clock = Clock::live(); $this->assertNull($clock->at($date, Format::iso8601())->match( static fn($point) => $point, @@ -113,7 +108,7 @@ public function testAtWithDateNotOfExpectedFormat() public function testAtWithNullDate() { - $clock = new Live; + $clock = Clock::live(); $this->assertNull($clock->at("\x00", Format::iso8601())->match( static fn($point) => $point, static fn() => null, @@ -132,7 +127,7 @@ public function testDateCorrectlyRespectTheFormatGiven() $date = "$year-0$month-$day"; $this->assertNull( - (new Live) + Clock::live() ->at($date, Format::of('Y-m-d')) ->match( static fn($point) => $point, diff --git a/tests/Clock/LoggerTest.php b/tests/Clock/LoggerTest.php index 2a31dbb..142f069 100644 --- a/tests/Clock/LoggerTest.php +++ b/tests/Clock/LoggerTest.php @@ -4,12 +4,10 @@ namespace Tests\Innmind\TimeContinuum\Clock; use Innmind\TimeContinuum\{ - Clock\Logger, Clock, Format, }; use Fixtures\Innmind\TimeContinuum\PointInTime; -use Innmind\Immutable\Maybe; use Psr\Log\LoggerInterface; use PHPUnit\Framework\TestCase; use Innmind\BlackBox\{ @@ -21,27 +19,12 @@ class LoggerTest extends TestCase { use BlackBox; - public function testInterface() - { - $this->assertInstanceOf( - Clock::class, - new Logger( - $this->createMock(Clock::class), - $this->createMock(LoggerInterface::class), - ), - ); - } - public function testGeneratedNowIsLogged() { $this ->forAll(PointInTime::any()) ->then(function($now) { - $concrete = $this->createMock(Clock::class); - $concrete - ->expects($this->once()) - ->method('now') - ->willReturn($now); + $concrete = Clock::frozen($now); $logger = $this->createMock(LoggerInterface::class); $logger ->expects($this->once()) @@ -51,7 +34,7 @@ public function testGeneratedNowIsLogged() ['point' => $now->format(Format::iso8601())], ); - $clock = new Logger($concrete, $logger); + $clock = Clock::logger($concrete, $logger); $this->assertSame($now, $clock->now()); }); @@ -61,16 +44,10 @@ public function testAskedDateIsLogged() { $this ->forAll( - Set\Strings::any(), PointInTime::any(), ) - ->then(function($date, $point) { - $concrete = $this->createMock(Clock::class); - $concrete - ->expects($this->once()) - ->method('at') - ->with($date) - ->willReturn(Maybe::just($point)); + ->then(function($point) { + $concrete = Clock::frozen($point); $logger = $this->createMock(LoggerInterface::class); $logger ->expects($this->once()) @@ -78,18 +55,18 @@ public function testAskedDateIsLogged() ->with( 'Asked time {date} ({format}) resolved to {point}', [ - 'date' => $date, + 'date' => $point->toString(), 'format' => 'unknown', 'point' => $point->format(Format::iso8601()), ], ); - $clock = new Logger($concrete, $logger); + $clock = Clock::logger($concrete, $logger); $this->assertSame( - $point, - $clock->at($date)->match( - static fn($point) => $point, + $point->toString(), + $clock->at($point->toString())->match( + static fn($found) => $found->toString(), static fn() => null, ), ); @@ -100,7 +77,6 @@ public function testAskedDateWithSpecificFormatIsLogged() { $this ->forAll( - Set\Strings::any(), PointInTime::any(), Set\Elements::of( Format::cookie(), @@ -114,13 +90,8 @@ public function testAskedDateWithSpecificFormatIsLogged() Format::w3c(), ), ) - ->then(function($date, $point, $format) { - $concrete = $this->createMock(Clock::class); - $concrete - ->expects($this->once()) - ->method('at') - ->with($date) - ->willReturn(Maybe::just($point)); + ->then(function($point, $format) { + $concrete = Clock::frozen($point); $logger = $this->createMock(LoggerInterface::class); $logger ->expects($this->once()) @@ -128,18 +99,18 @@ public function testAskedDateWithSpecificFormatIsLogged() ->with( 'Asked time {date} ({format}) resolved to {point}', [ - 'date' => $date, + 'date' => $point->format($format), 'format' => $format->toString(), 'point' => $point->format(Format::iso8601()), ], ); - $clock = new Logger($concrete, $logger); + $clock = Clock::logger($concrete, $logger); $this->assertSame( - $point, - $clock->at($date, $format)->match( - static fn($point) => $point, + $point->toString(), + $clock->at($point->format($format), $format)->match( + static fn($point) => $point->toString(), static fn() => null, ), ); From 02d08bf42ac19a091da38173e833905abb1d0cfe Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Thu, 21 Nov 2024 18:09:57 +0100 Subject: [PATCH 21/85] remove timezone dst support --- CHANGELOG.md | 1 + src/Timezone.php | 19 +------------------ 2 files changed, 2 insertions(+), 18 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c96a743..da3bcbb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,7 @@ - `Innmind\TimeContinuum\Earth\PointInTime\Now` - `Innmind\TimeContinuum\Earth\PointInTime\HighResolution` - Earth timezones +- `Innmind\TimeContinuum\Timezone::daylightSavingTimeApplied()` ## 3.4.1 - 2023-09-17 diff --git a/src/Timezone.php b/src/Timezone.php index cbe596f..7d9bf31 100644 --- a/src/Timezone.php +++ b/src/Timezone.php @@ -15,21 +15,9 @@ final class Timezone private function __construct( private int $hours, private int $minutes, - private bool $dst, ) { } - /** - * @psalm-pure - * - * @param int<-12, 14> $hours - * @param int<0, 59> $minutes - */ - public static function daylightSavingTime(int $hours, int $minutes = 0): self - { - return new self($hours, $minutes, true); - } - /** * @psalm-pure * @@ -38,7 +26,7 @@ public static function daylightSavingTime(int $hours, int $minutes = 0): self */ public static function of(int $hours, int $minutes = 0): self { - return new self($hours, $minutes, false); + return new self($hours, $minutes); } /** @@ -57,11 +45,6 @@ public function minutes(): int return $this->minutes; } - public function daylightSavingTimeApplied(): bool - { - return $this->dst; - } - /** * @return non-empty-string */ From 582a0501823aeb6628dfbaf88fab573ce95eda72 Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Thu, 21 Nov 2024 18:22:13 +0100 Subject: [PATCH 22/85] fix handling timezones --- src/PointInTime.php | 6 +----- src/Timezone.php | 21 +++++++++++++++++++-- tests/Clock/LoggerTest.php | 8 +++++--- 3 files changed, 25 insertions(+), 10 deletions(-) diff --git a/src/PointInTime.php b/src/PointInTime.php index 8966595..a74858a 100644 --- a/src/PointInTime.php +++ b/src/PointInTime.php @@ -146,11 +146,7 @@ public function changeTimezone(Timezone $zone): self public function timezone(): Timezone { - $string = $this->date->format('P'); - [$hour, $minute] = \explode(':', $string); - - /** @psalm-suppress ArgumentTypeCoercion */ - return Timezone::of((int) $hour, (int) $minute); + return Timezone::from($this->date->format('P')); } public function elapsedSince(self $point): ElapsedPeriod diff --git a/src/Timezone.php b/src/Timezone.php index 7d9bf31..f50b955 100644 --- a/src/Timezone.php +++ b/src/Timezone.php @@ -15,6 +15,7 @@ final class Timezone private function __construct( private int $hours, private int $minutes, + private bool $plus, ) { } @@ -26,7 +27,23 @@ private function __construct( */ public static function of(int $hours, int $minutes = 0): self { - return new self($hours, $minutes); + return new self($hours, $minutes, $hours > 0); + } + + /** + * @psalm-pure + * @internal + */ + public static function from(string $string): self + { + [$hours, $minutes] = \explode(':', $string); + + /** @psalm-suppress ArgumentTypeCoercion */ + return new self( + (int) $hours, + (int) $minutes, + \str_starts_with($string, '+'), + ); } /** @@ -57,7 +74,7 @@ public function toString(): string /** @var non-empty-string */ return \sprintf( '%s%02d:%02d', - $this->hours > 0 ? '+' : '-', + $this->plus ? '+' : '-', \abs($this->hours), $this->minutes, ); diff --git a/tests/Clock/LoggerTest.php b/tests/Clock/LoggerTest.php index 142f069..ecbca3d 100644 --- a/tests/Clock/LoggerTest.php +++ b/tests/Clock/LoggerTest.php @@ -81,13 +81,15 @@ public function testAskedDateWithSpecificFormatIsLogged() Set\Elements::of( Format::cookie(), Format::iso8601(), - Format::rfc1036(), Format::rfc1123(), Format::rfc2822(), - Format::rfc822(), - Format::rfc850(), Format::rss(), Format::w3c(), + // the year is not precise enough to allow to correctly + // parse any date with these formats + // Format::rfc1036(), + // Format::rfc822(), + // Format::rfc850(), ), ) ->then(function($point, $format) { From 02403191b2cfa25d7ac339f167acb2d4e1fec1ae Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Thu, 21 Nov 2024 18:23:46 +0100 Subject: [PATCH 23/85] remove ability to specify the timezone of the live clock --- src/Clock/Live.php | 10 ++-------- tests/Clock/LiveTest.php | 25 ------------------------- 2 files changed, 2 insertions(+), 33 deletions(-) diff --git a/src/Clock/Live.php b/src/Clock/Live.php index 49c941d..9202dc5 100644 --- a/src/Clock/Live.php +++ b/src/Clock/Live.php @@ -17,15 +17,9 @@ final class Live { private Timezone $timezone; - public function __construct(Timezone $timezone = null) + public function __construct() { - if ($timezone === null) { - [$hour, $minute] = \explode(':', \date('P')); - /** @psalm-suppress ArgumentTypeCoercion */ - $timezone = Timezone::of((int) $hour, (int) $minute); - } - - $this->timezone = $timezone; + $this->timezone = Timezone::of(0, 0); } public function now(): PointInTime diff --git a/tests/Clock/LiveTest.php b/tests/Clock/LiveTest.php index 64b2783..36902b6 100644 --- a/tests/Clock/LiveTest.php +++ b/tests/Clock/LiveTest.php @@ -50,31 +50,6 @@ public function testAt() ); } - public function testNowAtGivenExpectedTimezone() - { - $this->markTestSkipped(); - - $this->assertInstanceOf( - PointInTime::class, - $now = Clock::live(Timezone::of(6, 42))->now(), - ); - $this->assertSame('+06:42', $now->timezone()->toString()); - } - - public function testAtWithExpectedTimezone() - { - $this->markTestSkipped(); - - $this->assertInstanceOf( - PointInTime::class, - $point = Clock::live(Timezone::of(6, 42))->at('2016-10-08T16:08:30+02:00')->match( - static fn($point) => $point, - static fn() => null, - ), - ); - $this->assertSame('+06:42', $point->timezone()->toString()); - } - public function testAtWithSpecificFormat() { $this->assertInstanceOf( From fe21cff8b885a11d07151139e5a5bc0a543a40a0 Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Thu, 21 Nov 2024 18:34:57 +0100 Subject: [PATCH 24/85] rename Timezone to Offset --- CHANGELOG.md | 3 +++ src/Clock/Frozen.php | 2 +- src/Clock/Live.php | 10 +++++----- src/{Timezone.php => Offset.php} | 10 +++++++++- src/PointInTime.php | 8 ++++---- tests/Clock/FrozenTest.php | 2 +- tests/Clock/LiveTest.php | 8 ++++---- tests/NowTest.php | 12 ++++++------ tests/PointInTimeTest.php | 12 ++++++------ 9 files changed, 39 insertions(+), 28 deletions(-) rename src/{Timezone.php => Offset.php} (91%) diff --git a/CHANGELOG.md b/CHANGELOG.md index da3bcbb..92f239b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,9 @@ - Classes in the `Innmind\TimeContinuum\Earth\Move` namespace have been moved to `Innmind\TimeContinuum\Move` - `Innmind\TimeContinuum\Timezone` is now a `final class` - `Innmind\TimeContinuum\Clock` is now a `final class` +- `Innmind\TimeContinuum\Timezone` has been renamed `Innmind\TimeContinuum\Offset` +- `Innmind\TimeContinuum\PointInTime::changeTimezone()` has been renamed `Innmind\TimeContinuum\PointInTime::changeOffset()` +- `Innmind\TimeContinuum\PointInTime::timezone()` has been renamed `Innmind\TimeContinuum\PointInTime::offset()` ### Removed diff --git a/src/Clock/Frozen.php b/src/Clock/Frozen.php index 3240eb2..60b01a2 100644 --- a/src/Clock/Frozen.php +++ b/src/Clock/Frozen.php @@ -44,6 +44,6 @@ public function at(string $date, Format $format = null): Maybe return $this ->concrete ->at($date, $format) - ->map(fn($point) => $point->changeTimezone($this->now->timezone())); + ->map(fn($point) => $point->changeOffset($this->now->offset())); } } diff --git a/src/Clock/Live.php b/src/Clock/Live.php index 9202dc5..72497a1 100644 --- a/src/Clock/Live.php +++ b/src/Clock/Live.php @@ -4,7 +4,7 @@ namespace Innmind\TimeContinuum\Clock; use Innmind\TimeContinuum\{ - Timezone, + Offset, PointInTime, Format, }; @@ -15,16 +15,16 @@ */ final class Live { - private Timezone $timezone; + private Offset $offset; public function __construct() { - $this->timezone = Timezone::of(0, 0); + $this->offset = Offset::utc(); } public function now(): PointInTime { - return PointInTime::now()->changeTimezone($this->timezone); + return PointInTime::now()->changeOffset($this->offset); } /** @@ -62,6 +62,6 @@ public function at(string $date, Format $format = null): Maybe * @psalm-suppress ImpureVariable * @psalm-suppress ImpurePropertyFetch */ - return Maybe::just(PointInTime::at($date)->changeTimezone($this->timezone)); + return Maybe::just(PointInTime::at($date)->changeOffset($this->offset)); } } diff --git a/src/Timezone.php b/src/Offset.php similarity index 91% rename from src/Timezone.php rename to src/Offset.php index f50b955..9a5f867 100644 --- a/src/Timezone.php +++ b/src/Offset.php @@ -6,7 +6,7 @@ /** * @psalm-immutable */ -final class Timezone +final class Offset { /** * @param int<-12, 14> $hours @@ -19,6 +19,14 @@ private function __construct( ) { } + /** + * @psalm-pure + */ + public static function utc(): self + { + return self::of(0, 0); + } + /** * @psalm-pure * diff --git a/src/PointInTime.php b/src/PointInTime.php index a74858a..a4384f3 100644 --- a/src/PointInTime.php +++ b/src/PointInTime.php @@ -134,19 +134,19 @@ public function format(Format $format): string return $this->date->format($format->toString()); } - public function changeTimezone(Timezone $zone): self + public function changeOffset(Offset $offset): self { return new self( $this->date->setTimezone( - new \DateTimeZone($zone->toString()), + new \DateTimeZone($offset->toString()), ), $this->highResolution, ); } - public function timezone(): Timezone + public function offset(): Offset { - return Timezone::from($this->date->format('P')); + return Offset::from($this->date->format('P')); } public function elapsedSince(self $point): ElapsedPeriod diff --git a/tests/Clock/FrozenTest.php b/tests/Clock/FrozenTest.php index a562e3d..5f0d0e8 100644 --- a/tests/Clock/FrozenTest.php +++ b/tests/Clock/FrozenTest.php @@ -41,7 +41,7 @@ public function testAtReturnWithTheSameTimezoneAsNow() ); $this->assertInstanceOf(PointInTimeInterface::class, $point); - $this->assertSame($now->timezone()->toString(), $point->timezone()->toString()); + $this->assertSame($now->offset()->toString(), $point->offset()->toString()); }); } } diff --git a/tests/Clock/LiveTest.php b/tests/Clock/LiveTest.php index 36902b6..55683be 100644 --- a/tests/Clock/LiveTest.php +++ b/tests/Clock/LiveTest.php @@ -25,11 +25,11 @@ public function testNow() PointInTime::class, $now = Clock::live()->now(), ); - $timezone = \date('P'); - $timezone = $timezone === '+00:00' ? 'Z' : $timezone; + $offset = \date('P'); + $offset = $offset === '+00:00' ? 'Z' : $offset; $this->assertSame( - $timezone, - $now->timezone()->toString(), + $offset, + $now->offset()->toString(), ); } diff --git a/tests/NowTest.php b/tests/NowTest.php index 39191e8..a1f04fa 100644 --- a/tests/NowTest.php +++ b/tests/NowTest.php @@ -5,7 +5,7 @@ use Innmind\TimeContinuum\{ PointInTime, - Timezone, + Offset, Format, ElapsedPeriod, PointInTime\Year as YearInterface, @@ -37,7 +37,7 @@ public function testInterface() $this->assertInstanceOf(Minute::class, $point->minute()); $this->assertInstanceOf(Second::class, $point->second()); $this->assertInstanceOf(Millisecond::class, $point->millisecond()); - $this->assertInstanceOf(Timezone::class, $point->timezone()); + $this->assertInstanceOf(Offset::class, $point->offset()); $this->assertSame((int) \date('Y', $timestamp), $point->year()->toInt()); $this->assertSame((int) \date('m', $timestamp), $point->month()->toInt()); $this->assertSame((int) \date('d', $timestamp), $point->day()->toInt()); @@ -52,7 +52,7 @@ public function testInterface() $this->assertTrue($point->milliseconds() <= $now + 50); $timezone = \date('P', $timestamp); $timezone = $timezone === '+00:00' ? 'Z' : $timezone; - $this->assertSame($timezone, $point->timezone()->toString()); + $this->assertSame($timezone, $point->offset()->toString()); $this->assertSame(\date('Y-m-d\TH:i:sP', $timestamp), $point->toString()); } @@ -66,12 +66,12 @@ public function testFormat() ); } - public function testChangeTimezone() + public function testChangeOffset() { $now = new \DateTimeImmutable; $now = $now->setTimezone(new \DateTimeZone('-02:30')); $point = PointInTime::now(); - $point2 = $point->changeTimezone(Timezone::of(-2, 30)); + $point2 = $point->changeOffset(Offset::of(-2, 30)); $this->assertNotSame($point, $point2); $this->assertNotSame($point->year(), $point2->year()); @@ -88,7 +88,7 @@ public function testChangeTimezone() $this->assertSame((int) $now->format('H'), $point2->hour()->toInt()); $this->assertSame((int) $now->format('i'), $point2->minute()->toInt()); $this->assertSame((int) $now->format('s'), $point2->second()->toInt()); - $this->assertSame('-02:30', $point2->timezone()->toString()); + $this->assertSame('-02:30', $point2->offset()->toString()); } public function testElapsedSince() diff --git a/tests/PointInTimeTest.php b/tests/PointInTimeTest.php index e6c1241..0d7849c 100644 --- a/tests/PointInTimeTest.php +++ b/tests/PointInTimeTest.php @@ -5,7 +5,7 @@ use Innmind\TimeContinuum\{ PointInTime, - Timezone, + Offset, Format, ElapsedPeriod, PointInTime\Year, @@ -33,7 +33,7 @@ public function testInterface() $this->assertInstanceOf(Minute::class, $point->minute()); $this->assertInstanceOf(Second::class, $point->second()); $this->assertInstanceOf(Millisecond::class, $point->millisecond()); - $this->assertInstanceOf(Timezone::class, $point->timezone()); + $this->assertInstanceOf(Offset::class, $point->offset()); $this->assertSame(2016, $point->year()->toInt()); $this->assertSame(10, $point->month()->toInt()); $this->assertSame(5, $point->day()->toInt()); @@ -45,7 +45,7 @@ public function testInterface() (new \DateTimeImmutable('2016-10-05T08:01:30.123+02:00'))->getTimestamp() * 1000 + $point->millisecond()->toInt(), $point->milliseconds(), ); - $this->assertSame('+02:00', $point->timezone()->toString()); + $this->assertSame('+02:00', $point->offset()->toString()); $this->assertSame('2016-10-05T08:01:30+02:00', $point->toString()); } @@ -67,10 +67,10 @@ public function testFormat() ); } - public function testChangeTimezone() + public function testChangeOffset() { $point = PointInTime::at('2016-10-05T08:01:30.123+02:00'); - $point2 = $point->changeTimezone(Timezone::of(-2, 30)); + $point2 = $point->changeOffset(Offset::of(-2, 30)); $this->assertNotSame($point, $point2); $this->assertNotSame($point->year(), $point2->year()); @@ -88,7 +88,7 @@ public function testChangeTimezone() $this->assertSame(31, $point2->minute()->toInt()); $this->assertSame(30, $point2->second()->toInt()); $this->assertSame(123, $point2->millisecond()->toInt()); - $this->assertSame('-02:30', $point2->timezone()->toString()); + $this->assertSame('-02:30', $point2->offset()->toString()); } public function testElapsedSince() From 81dd9e3262339e2c8c972a939e6316e00b759c96 Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Thu, 21 Nov 2024 18:37:14 +0100 Subject: [PATCH 25/85] remove unused exceptions --- CHANGELOG.md | 1 + src/Exception/DomainException.php | 8 -------- src/Exception/ElapsedPeriodCantBeNegative.php | 8 -------- src/Exception/Exception.php | 8 -------- src/Exception/InvalidTimezone.php | 8 -------- src/Exception/LogicException.php | 8 -------- src/Exception/PeriodCantBeNegative.php | 8 -------- 7 files changed, 1 insertion(+), 48 deletions(-) delete mode 100644 src/Exception/DomainException.php delete mode 100644 src/Exception/ElapsedPeriodCantBeNegative.php delete mode 100644 src/Exception/Exception.php delete mode 100644 src/Exception/InvalidTimezone.php delete mode 100644 src/Exception/LogicException.php delete mode 100644 src/Exception/PeriodCantBeNegative.php diff --git a/CHANGELOG.md b/CHANGELOG.md index 92f239b..5abd33c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,6 +34,7 @@ - `Innmind\TimeContinuum\Earth\PointInTime\HighResolution` - Earth timezones - `Innmind\TimeContinuum\Timezone::daylightSavingTimeApplied()` +- `Innmind\TimeContinuum\Exception` ## 3.4.1 - 2023-09-17 diff --git a/src/Exception/DomainException.php b/src/Exception/DomainException.php deleted file mode 100644 index a0f4b70..0000000 --- a/src/Exception/DomainException.php +++ /dev/null @@ -1,8 +0,0 @@ - Date: Thu, 21 Nov 2024 18:48:17 +0100 Subject: [PATCH 26/85] remove wrong type --- src/PointInTime.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/PointInTime.php b/src/PointInTime.php index a4384f3..ba71eb7 100644 --- a/src/PointInTime.php +++ b/src/PointInTime.php @@ -61,12 +61,9 @@ public static function now(): self /** * Since 1970-01-01T00:00:00+00:00 - * - * @return int<0, max> */ public function milliseconds(): int { - /** @var int<0, max> */ return (int) $this->date->format('Uv'); } From c0811f1bf8e2974fb6a92c793881eacb3931f9ce Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Thu, 21 Nov 2024 20:03:16 +0100 Subject: [PATCH 27/85] allow to switch the clock timezone --- CHANGELOG.md | 4 + src/Clock.php | 12 +- src/Clock/Frozen.php | 17 +- src/Clock/Live.php | 27 +- src/Clock/Logger.php | 13 + src/Timezone.php | 31 ++ src/Timezone/Africa.php | 297 +++++++++++ src/Timezone/America.php | 712 +++++++++++++++++++++++++++ src/Timezone/America/Argentina.php | 92 ++++ src/Timezone/America/Indiana.php | 67 +++ src/Timezone/America/NorthDakota.php | 42 ++ src/Timezone/Antartica.php | 87 ++++ src/Timezone/Arctic.php | 32 ++ src/Timezone/Asia.php | 482 ++++++++++++++++++ src/Timezone/Atlantic.php | 87 ++++ src/Timezone/Australia.php | 137 ++++++ src/Timezone/Europe.php | 322 ++++++++++++ src/Timezone/India.php | 82 +++ src/Timezone/Pacific.php | 237 +++++++++ src/Timezones.php | 93 ++++ 20 files changed, 2867 insertions(+), 6 deletions(-) create mode 100644 src/Timezone.php create mode 100644 src/Timezone/Africa.php create mode 100644 src/Timezone/America.php create mode 100644 src/Timezone/America/Argentina.php create mode 100644 src/Timezone/America/Indiana.php create mode 100644 src/Timezone/America/NorthDakota.php create mode 100644 src/Timezone/Antartica.php create mode 100644 src/Timezone/Arctic.php create mode 100644 src/Timezone/Asia.php create mode 100644 src/Timezone/Atlantic.php create mode 100644 src/Timezone/Australia.php create mode 100644 src/Timezone/Europe.php create mode 100644 src/Timezone/India.php create mode 100644 src/Timezone/Pacific.php create mode 100644 src/Timezones.php diff --git a/CHANGELOG.md b/CHANGELOG.md index 5abd33c..847bfa3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## [Unreleased] +## Added + +- `Innmind\TimeContinuum\Clock::switch()` + ### Changed - `Innmind\TimeContinuum\Format` is now a `final class` diff --git a/src/Clock.php b/src/Clock.php index 259bf6f..8a0773f 100644 --- a/src/Clock.php +++ b/src/Clock.php @@ -20,12 +20,12 @@ private function __construct( public static function live(): self { - return new self(new Live); + return new self(new Live(Offset::utc())); } public static function frozen(PointInTime $point): self { - return new self(new Frozen($point)); + return new self(new Frozen($point, new Live(Offset::utc()))); } public static function logger(self $clock, LoggerInterface $logger): self @@ -38,6 +38,14 @@ public function now(): PointInTime return $this->implementation->now(); } + /** + * @param callable(Timezones): Timezone $changeTimezone + */ + public function switch(callable $changeTimezone): self + { + return new self($this->implementation->switch($changeTimezone)); + } + /** * @psalm-pure * diff --git a/src/Clock/Frozen.php b/src/Clock/Frozen.php index 60b01a2..2347944 100644 --- a/src/Clock/Frozen.php +++ b/src/Clock/Frozen.php @@ -6,6 +6,8 @@ use Innmind\TimeContinuum\{ PointInTime, Format, + Timezones, + Timezone, }; use Innmind\Immutable\Maybe; @@ -17,10 +19,21 @@ final class Frozen private PointInTime $now; private Live $concrete; - public function __construct(PointInTime $now) + public function __construct(PointInTime $now, Live $concrete) { $this->now = $now; - $this->concrete = new Live; + $this->concrete = $concrete; + } + + /** + * @param callable(Timezones): Timezone $changeTimezone + */ + public function switch(callable $changeTimezone): self + { + return new self( + $this->now, + $this->concrete->switch($changeTimezone), + ); } public function now(): PointInTime diff --git a/src/Clock/Live.php b/src/Clock/Live.php index 72497a1..e0f7ffc 100644 --- a/src/Clock/Live.php +++ b/src/Clock/Live.php @@ -7,6 +7,8 @@ Offset, PointInTime, Format, + Timezones, + Timezone, }; use Innmind\Immutable\Maybe; @@ -17,9 +19,30 @@ final class Live { private Offset $offset; - public function __construct() + public function __construct(Offset $offset) { - $this->offset = Offset::utc(); + $this->offset = $offset; + } + + /** + * @param callable(Timezones): Timezone $changeTimezone + */ + public function switch(callable $changeTimezone): self + { + /** @var callable(non-empty-string): Timezone */ + $of = static function(string $zone): Timezone { + /** @var non-empty-string $zone */ + $now = (new \DateTimeImmutable('now'))->setTimezone(new \DateTimeZone($zone)); + + return Timezone::of( + Offset::from($now->format('P')), + (bool) (int) $now->format('I'), + ); + }; + + return new self( + $changeTimezone(Timezones::new($of))->offset(), + ); } public function now(): PointInTime diff --git a/src/Clock/Logger.php b/src/Clock/Logger.php index 82fe186..bde7884 100644 --- a/src/Clock/Logger.php +++ b/src/Clock/Logger.php @@ -7,6 +7,8 @@ Clock, PointInTime, Format, + Timezones, + Timezone, }; use Innmind\Immutable\Maybe; use Psr\Log\LoggerInterface; @@ -25,6 +27,17 @@ public function __construct(Clock $clock, LoggerInterface $logger) $this->logger = $logger; } + /** + * @param callable(Timezones): Timezone $changeTimezone + */ + public function switch(callable $changeTimezone): self + { + return new self( + $this->clock->switch($changeTimezone), + $this->logger, + ); + } + public function now(): PointInTime { $now = $this->clock->now(); diff --git a/src/Timezone.php b/src/Timezone.php new file mode 100644 index 0000000..2e58ddd --- /dev/null +++ b/src/Timezone.php @@ -0,0 +1,31 @@ +offset; + } + + public function daylightSavingTimeApplied(): bool + { + return $this->dst; + } +} diff --git a/src/Timezone/Africa.php b/src/Timezone/Africa.php new file mode 100644 index 0000000..52dcfab --- /dev/null +++ b/src/Timezone/Africa.php @@ -0,0 +1,297 @@ +of)('Africa/Lome'); + } + + public function ceuta(): Timezone + { + return ($this->of)('Africa/Ceuta'); + } + + public function elAaiun(): Timezone + { + return ($this->of)('Africa/El_Aaiun'); + } + + public function portoNovo(): Timezone + { + return ($this->of)('Africa/Porto-Novo'); + } + + public function djibouti(): Timezone + { + return ($this->of)('Africa/Djibouti'); + } + + public function windhoek(): Timezone + { + return ($this->of)('Africa/Windhoek'); + } + + public function algiers(): Timezone + { + return ($this->of)('Africa/Algiers'); + } + + public function ouagadougou(): Timezone + { + return ($this->of)('Africa/Ouagadougou'); + } + + public function bamako(): Timezone + { + return ($this->of)('Africa/Bamako'); + } + + public function harare(): Timezone + { + return ($this->of)('Africa/Harare'); + } + + public function bujumbura(): Timezone + { + return ($this->of)('Africa/Bujumbura'); + } + + public function douala(): Timezone + { + return ($this->of)('Africa/Douala'); + } + + public function brazzaville(): Timezone + { + return ($this->of)('Africa/Brazzaville'); + } + + public function tripoli(): Timezone + { + return ($this->of)('Africa/Tripoli'); + } + + public function casablanca(): Timezone + { + return ($this->of)('Africa/Casablanca'); + } + + public function niamey(): Timezone + { + return ($this->of)('Africa/Niamey'); + } + + public function mbabane(): Timezone + { + return ($this->of)('Africa/Mbabane'); + } + + public function blantyre(): Timezone + { + return ($this->of)('Africa/Blantyre'); + } + + public function conakry(): Timezone + { + return ($this->of)('Africa/Conakry'); + } + + public function khartoum(): Timezone + { + return ($this->of)('Africa/Khartoum'); + } + + public function luanda(): Timezone + { + return ($this->of)('Africa/Luanda'); + } + + public function libreville(): Timezone + { + return ($this->of)('Africa/Libreville'); + } + + public function maseru(): Timezone + { + return ($this->of)('Africa/Maseru'); + } + + public function lusaka(): Timezone + { + return ($this->of)('Africa/Lusaka'); + } + + public function darEsSalaam(): Timezone + { + return ($this->of)('Africa/Dar_es_Salaam'); + } + + public function nairobi(): Timezone + { + return ($this->of)('Africa/Nairobi'); + } + + public function banjul(): Timezone + { + return ($this->of)('Africa/Banjul'); + } + + public function bissau(): Timezone + { + return ($this->of)('Africa/Bissau'); + } + + public function nouakchott(): Timezone + { + return ($this->of)('Africa/Nouakchott'); + } + + public function johannesburg(): Timezone + { + return ($this->of)('Africa/Johannesburg'); + } + + public function timbuktu(): Timezone + { + return ($this->of)('Africa/Timbuktu'); + } + + public function saoTome(): Timezone + { + return ($this->of)('Africa/Sao_Tome'); + } + + public function freetown(): Timezone + { + return ($this->of)('Africa/Freetown'); + } + + public function kampala(): Timezone + { + return ($this->of)('Africa/Kampala'); + } + + public function dakar(): Timezone + { + return ($this->of)('Africa/Dakar'); + } + + public function lagos(): Timezone + { + return ($this->of)('Africa/Lagos'); + } + + public function cairo(): Timezone + { + return ($this->of)('Africa/Cairo'); + } + + public function mogadishu(): Timezone + { + return ($this->of)('Africa/Mogadishu'); + } + + public function gaborone(): Timezone + { + return ($this->of)('Africa/Gaborone'); + } + + public function tunis(): Timezone + { + return ($this->of)('Africa/Tunis'); + } + + public function kigali(): Timezone + { + return ($this->of)('Africa/Kigali'); + } + + public function malabo(): Timezone + { + return ($this->of)('Africa/Malabo'); + } + + public function abidjan(): Timezone + { + return ($this->of)('Africa/Abidjan'); + } + + public function accra(): Timezone + { + return ($this->of)('Africa/Accra'); + } + + public function asmera(): Timezone + { + return ($this->of)('Africa/Asmera'); + } + + public function ndjamena(): Timezone + { + return ($this->of)('Africa/Ndjamena'); + } + + public function lubumbashi(): Timezone + { + return ($this->of)('Africa/Lubumbashi'); + } + + public function juba(): Timezone + { + return ($this->of)('Africa/Juba'); + } + + public function monrovia(): Timezone + { + return ($this->of)('Africa/Monrovia'); + } + + public function maputo(): Timezone + { + return ($this->of)('Africa/Maputo'); + } + + public function kinshasa(): Timezone + { + return ($this->of)('Africa/Kinshasa'); + } + + public function asmara(): Timezone + { + return ($this->of)('Africa/Asmara'); + } + + public function bangui(): Timezone + { + return ($this->of)('Africa/Bangui'); + } + + public function addisAbaba(): Timezone + { + return ($this->of)('Africa/Addis_Ababa'); + } +} diff --git a/src/Timezone/America.php b/src/Timezone/America.php new file mode 100644 index 0000000..ccce24d --- /dev/null +++ b/src/Timezone/America.php @@ -0,0 +1,712 @@ +of); + } + + public function indiana(): Indiana + { + return Indiana::new($this->of); + } + + public function northDakota(): NorthDakota + { + return NorthDakota::new($this->of); + } + + public function montreal(): Timezone + { + return ($this->of)('America/Montreal'); + } + + public function guatemala(): Timezone + { + return ($this->of)('America/Guatemala'); + } + + public function boaVista(): Timezone + { + return ($this->of)('America/Boa_Vista'); + } + + public function portoAcre(): Timezone + { + return ($this->of)('America/Porto_Acre'); + } + + public function winnipeg(): Timezone + { + return ($this->of)('America/Winnipeg'); + } + + public function santiago(): Timezone + { + return ($this->of)('America/Santiago'); + } + + public function virgin(): Timezone + { + return ($this->of)('America/Virgin'); + } + + public function moncton(): Timezone + { + return ($this->of)('America/Moncton'); + } + + public function noronha(): Timezone + { + return ($this->of)('America/Noronha'); + } + + public function recife(): Timezone + { + return ($this->of)('America/Recife'); + } + + public function saintKitts(): Timezone + { + return ($this->of)('America/St_Kitts'); + } + + public function rankinInlet(): Timezone + { + return ($this->of)('America/Rankin_Inlet'); + } + + public function jamaica(): Timezone + { + return ($this->of)('America/Jamaica'); + } + + public function lima(): Timezone + { + return ($this->of)('America/Lima'); + } + + public function rosario(): Timezone + { + return ($this->of)('America/Rosario'); + } + + public function cambridgeBay(): Timezone + { + return ($this->of)('America/Cambridge_Bay'); + } + + public function coralHarbour(): Timezone + { + return ($this->of)('America/Coral_Harbour'); + } + + public function fortWayne(): Timezone + { + return ($this->of)('America/Fort_Wayne'); + } + + public function nassau(): Timezone + { + return ($this->of)('America/Nassau'); + } + + public function mazatlan(): Timezone + { + return ($this->of)('America/Mazatlan'); + } + + public function grandTurk(): Timezone + { + return ($this->of)('America/Grand_Turk'); + } + + public function merida(): Timezone + { + return ($this->of)('America/Merida'); + } + + public function ensenada(): Timezone + { + return ($this->of)('America/Ensenada'); + } + + public function rainyRiver(): Timezone + { + return ($this->of)('America/Rainy_River'); + } + + public function bahiaBanderas(): Timezone + { + return ($this->of)('America/Bahia_Banderas'); + } + + public function guadeloupe(): Timezone + { + return ($this->of)('America/Guadeloupe'); + } + + public function cuiaba(): Timezone + { + return ($this->of)('America/Cuiaba'); + } + + public function scoresbysund(): Timezone + { + return ($this->of)('America/Scoresbysund'); + } + + public function maceio(): Timezone + { + return ($this->of)('America/Maceio'); + } + + public function curacao(): Timezone + { + return ($this->of)('America/Curacao'); + } + + public function aruba(): Timezone + { + return ($this->of)('America/Aruba'); + } + + public function monterrey(): Timezone + { + return ($this->of)('America/Monterrey'); + } + + public function hermosillo(): Timezone + { + return ($this->of)('America/Hermosillo'); + } + + public function guayaquil(): Timezone + { + return ($this->of)('America/Guayaquil'); + } + + public function managua(): Timezone + { + return ($this->of)('America/Managua'); + } + + public function matamoros(): Timezone + { + return ($this->of)('America/Matamoros'); + } + + public function losAngeles(): Timezone + { + return ($this->of)('America/Los_Angeles'); + } + + public function tegucigalpa(): Timezone + { + return ($this->of)('America/Tegucigalpa'); + } + + public function monticello(): Timezone + { + return ($this->of)('America/Kentucky/Monticello'); + } + + public function nome(): Timezone + { + return ($this->of)('America/Nome'); + } + + public function montevideo(): Timezone + { + return ($this->of)('America/Montevideo'); + } + + public function gooseBay(): Timezone + { + return ($this->of)('America/Goose_Bay'); + } + + public function boise(): Timezone + { + return ($this->of)('America/Boise'); + } + + public function belem(): Timezone + { + return ($this->of)('America/Belem'); + } + + public function atikokan(): Timezone + { + return ($this->of)('America/Atikokan'); + } + + public function swiftCurrent(): Timezone + { + return ($this->of)('America/Swift_Current'); + } + + public function detroit(): Timezone + { + return ($this->of)('America/Detroit'); + } + + public function laPaz(): Timezone + { + return ($this->of)('America/La_Paz'); + } + + public function chicago(): Timezone + { + return ($this->of)('America/Chicago'); + } + + public function creston(): Timezone + { + return ($this->of)('America/Creston'); + } + + public function nipigon(): Timezone + { + return ($this->of)('America/Nipigon'); + } + + public function costaRica(): Timezone + { + return ($this->of)('America/Costa_Rica'); + } + + public function halifax(): Timezone + { + return ($this->of)('America/Halifax'); + } + + public function yellowknife(): Timezone + { + return ($this->of)('America/Yellowknife'); + } + + public function puertoRico(): Timezone + { + return ($this->of)('America/Puerto_Rico'); + } + + public function edmonton(): Timezone + { + return ($this->of)('America/Edmonton'); + } + + public function mexicoCity(): Timezone + { + return ($this->of)('America/Mexico_City'); + } + + public function saoPaulo(): Timezone + { + return ($this->of)('America/Sao_Paulo'); + } + + public function yakutat(): Timezone + { + return ($this->of)('America/Yakutat'); + } + + public function saintThomas(): Timezone + { + return ($this->of)('America/St_Thomas'); + } + + public function chihuahua(): Timezone + { + return ($this->of)('America/Chihuahua'); + } + + public function grenada(): Timezone + { + return ($this->of)('America/Grenada'); + } + + public function elSalvador(): Timezone + { + return ($this->of)('America/El_Salvador'); + } + + public function santoDomingo(): Timezone + { + return ($this->of)('America/Santo_Domingo'); + } + + public function montserrat(): Timezone + { + return ($this->of)('America/Montserrat'); + } + + public function portoVelho(): Timezone + { + return ($this->of)('America/Porto_Velho'); + } + + public function panama(): Timezone + { + return ($this->of)('America/Panama'); + } + + public function antigua(): Timezone + { + return ($this->of)('America/Antigua'); + } + + public function santarem(): Timezone + { + return ($this->of)('America/Santarem'); + } + + public function dawson(): Timezone + { + return ($this->of)('America/Dawson'); + } + + public function saintBarthelemy(): Timezone + { + return ($this->of)('America/St_Barthelemy'); + } + + public function iqaluit(): Timezone + { + return ($this->of)('America/Iqaluit'); + } + + public function eirunepe(): Timezone + { + return ($this->of)('America/Eirunepe'); + } + + public function inuvik(): Timezone + { + return ($this->of)('America/Inuvik'); + } + + public function anguilla(): Timezone + { + return ($this->of)('America/Anguilla'); + } + + public function portOfSpain(): Timezone + { + return ($this->of)('America/Port_of_Spain'); + } + + public function araguaina(): Timezone + { + return ($this->of)('America/Araguaina'); + } + + public function guyana(): Timezone + { + return ($this->of)('America/Guyana'); + } + + public function fortaleza(): Timezone + { + return ($this->of)('America/Fortaleza'); + } + + public function blancSablon(): Timezone + { + return ($this->of)('America/Blanc-Sablon'); + } + + public function juneau(): Timezone + { + return ($this->of)('America/Juneau'); + } + + public function cayman(): Timezone + { + return ($this->of)('America/Cayman'); + } + + public function menominee(): Timezone + { + return ($this->of)('America/Menominee'); + } + + public function cayenne(): Timezone + { + return ($this->of)('America/Cayenne'); + } + + public function pangnirtung(): Timezone + { + return ($this->of)('America/Pangnirtung'); + } + + public function metlakatla(): Timezone + { + return ($this->of)('America/Metlakatla'); + } + + public function asuncion(): Timezone + { + return ($this->of)('America/Asuncion'); + } + + public function saintLucia(): Timezone + { + return ($this->of)('America/St_Lucia'); + } + + public function saintVincent(): Timezone + { + return ($this->of)('America/St_Vincent'); + } + + public function martinique(): Timezone + { + return ($this->of)('America/Martinique'); + } + + public function kralendijk(): Timezone + { + return ($this->of)('America/Kralendijk'); + } + + public function newYork(): Timezone + { + return ($this->of)('America/New_York'); + } + + public function vancouver(): Timezone + { + return ($this->of)('America/Vancouver'); + } + + public function bogota(): Timezone + { + return ($this->of)('America/Bogota'); + } + + public function dominica(): Timezone + { + return ($this->of)('America/Dominica'); + } + + public function danmarkshavn(): Timezone + { + return ($this->of)('America/Danmarkshavn'); + } + + public function anchorage(): Timezone + { + return ($this->of)('America/Anchorage'); + } + + public function marigot(): Timezone + { + return ($this->of)('America/Marigot'); + } + + public function rioBranco(): Timezone + { + return ($this->of)('America/Rio_Branco'); + } + + public function paramaribo(): Timezone + { + return ($this->of)('America/Paramaribo'); + } + + public function caracas(): Timezone + { + return ($this->of)('America/Caracas'); + } + + public function resolute(): Timezone + { + return ($this->of)('America/Resolute'); + } + + public function godthab(): Timezone + { + return ($this->of)('America/Godthab'); + } + + public function catamarca(): Timezone + { + return ($this->of)('America/Catamarca'); + } + + public function glaceBay(): Timezone + { + return ($this->of)('America/Glace_Bay'); + } + + public function regina(): Timezone + { + return ($this->of)('America/Regina'); + } + + public function toronto(): Timezone + { + return ($this->of)('America/Toronto'); + } + + public function barbados(): Timezone + { + return ($this->of)('America/Barbados'); + } + + public function santaIsabel(): Timezone + { + return ($this->of)('America/Santa_Isabel'); + } + + public function miquelon(): Timezone + { + return ($this->of)('America/Miquelon'); + } + + public function havana(): Timezone + { + return ($this->of)('America/Havana'); + } + + public function ojinaga(): Timezone + { + return ($this->of)('America/Ojinaga'); + } + + public function denver(): Timezone + { + return ($this->of)('America/Denver'); + } + + public function cancun(): Timezone + { + return ($this->of)('America/Cancun'); + } + + public function thunderBay(): Timezone + { + return ($this->of)('America/Thunder_Bay'); + } + + public function adak(): Timezone + { + return ($this->of)('America/Adak'); + } + + public function saintJohns(): Timezone + { + return ($this->of)('America/St_Johns'); + } + + public function portAuPrince(): Timezone + { + return ($this->of)('America/Port-au-Prince'); + } + + public function whitehorse(): Timezone + { + return ($this->of)('America/Whitehorse'); + } + + public function louisville(): Timezone + { + return ($this->of)('America/Louisville'); + } + + public function manaus(): Timezone + { + return ($this->of)('America/Manaus'); + } + + public function lowerPrinces(): Timezone + { + return ($this->of)('America/Lower_Princes'); + } + + public function sitka(): Timezone + { + return ($this->of)('America/Sitka'); + } + + public function thule(): Timezone + { + return ($this->of)('America/Thule'); + } + + public function campoGrande(): Timezone + { + return ($this->of)('America/Campo_Grande'); + } + + public function phoenix(): Timezone + { + return ($this->of)('America/Phoenix'); + } + + public function shiprock(): Timezone + { + return ($this->of)('America/Shiprock'); + } + + public function bahia(): Timezone + { + return ($this->of)('America/Bahia'); + } + + public function tortola(): Timezone + { + return ($this->of)('America/Tortola'); + } + + public function dawsonCreek(): Timezone + { + return ($this->of)('America/Dawson_Creek'); + } + + public function tijuana(): Timezone + { + return ($this->of)('America/Tijuana'); + } + + public function belize(): Timezone + { + return ($this->of)('America/Belize'); + } + + public function atka(): Timezone + { + return ($this->of)('America/Atka'); + } +} diff --git a/src/Timezone/America/Argentina.php b/src/Timezone/America/Argentina.php new file mode 100644 index 0000000..d9bee7a --- /dev/null +++ b/src/Timezone/America/Argentina.php @@ -0,0 +1,92 @@ +of)('America/Argentina/Rio_Gallegos'); + } + + public function mendoza(): Timezone + { + return ($this->of)('America/Argentina/Mendoza'); + } + + public function buenosAires(): Timezone + { + return ($this->of)('America/Argentina/Buenos_Aires'); + } + + public function ushuaia(): Timezone + { + return ($this->of)('America/Argentina/Ushuaia'); + } + + public function sanJuan(): Timezone + { + return ($this->of)('America/Argentina/San_Juan'); + } + + public function laRioja(): Timezone + { + return ($this->of)('America/Argentina/La_Rioja'); + } + + public function salta(): Timezone + { + return ($this->of)('America/Argentina/Salta'); + } + + public function sanLuis(): Timezone + { + return ($this->of)('America/Argentina/San_Luis'); + } + + public function jujuy(): Timezone + { + return ($this->of)('America/Argentina/Jujuy'); + } + + public function tucuman(): Timezone + { + return ($this->of)('America/Argentina/Tucuman'); + } + + public function comodRivadavia(): Timezone + { + return ($this->of)('America/Argentina/ComodRivadavia'); + } + + public function catamarca(): Timezone + { + return ($this->of)('America/Argentina/Catamarca'); + } + + public function cordoba(): Timezone + { + return ($this->of)('America/Argentina/Cordoba'); + } +} diff --git a/src/Timezone/America/Indiana.php b/src/Timezone/America/Indiana.php new file mode 100644 index 0000000..830c397 --- /dev/null +++ b/src/Timezone/America/Indiana.php @@ -0,0 +1,67 @@ +of)('America/Indiana/Vincennes'); + } + + public function marengo(): Timezone + { + return ($this->of)('America/Indiana/Marengo'); + } + + public function tellCity(): Timezone + { + return ($this->of)('America/Indiana/Tell_City'); + } + + public function knox(): Timezone + { + return ($this->of)('America/Indiana/Knox'); + } + + public function vevay(): Timezone + { + return ($this->of)('America/Indiana/Vevay'); + } + + public function indianapolis(): Timezone + { + return ($this->of)('America/Indiana/Indianapolis'); + } + + public function petersburg(): Timezone + { + return ($this->of)('America/Indiana/Petersburg'); + } + + public function winamac(): Timezone + { + return ($this->of)('America/Indiana/Winamac'); + } +} diff --git a/src/Timezone/America/NorthDakota.php b/src/Timezone/America/NorthDakota.php new file mode 100644 index 0000000..577a428 --- /dev/null +++ b/src/Timezone/America/NorthDakota.php @@ -0,0 +1,42 @@ +of)('America/North_Dakota/Beulah'); + } + + public function newSalem(): Timezone + { + return ($this->of)('America/North_Dakota/New_Salem'); + } + + public function center(): Timezone + { + return ($this->of)('America/North_Dakota/Center'); + } +} diff --git a/src/Timezone/Antartica.php b/src/Timezone/Antartica.php new file mode 100644 index 0000000..93a957a --- /dev/null +++ b/src/Timezone/Antartica.php @@ -0,0 +1,87 @@ +of)('Antarctica/Davis'); + } + + public function palmer(): Timezone + { + return ($this->of)('Antarctica/Palmer'); + } + + public function syowa(): Timezone + { + return ($this->of)('Antarctica/Syowa'); + } + + public function casey(): Timezone + { + return ($this->of)('Antarctica/Casey'); + } + + public function troll(): Timezone + { + return ($this->of)('Antarctica/Troll'); + } + + public function mcMurdo(): Timezone + { + return ($this->of)('Antarctica/McMurdo'); + } + + public function vostok(): Timezone + { + return ($this->of)('Antarctica/Vostok'); + } + + public function rothera(): Timezone + { + return ($this->of)('Antarctica/Rothera'); + } + + public function mawson(): Timezone + { + return ($this->of)('Antarctica/Mawson'); + } + + public function macquarie(): Timezone + { + return ($this->of)('Antarctica/Macquarie'); + } + + public function southPole(): Timezone + { + return ($this->of)('Antarctica/South_Pole'); + } + + public function dumontDUrville(): Timezone + { + return ($this->of)('Antarctica/DumontDUrville'); + } +} diff --git a/src/Timezone/Arctic.php b/src/Timezone/Arctic.php new file mode 100644 index 0000000..bf58a51 --- /dev/null +++ b/src/Timezone/Arctic.php @@ -0,0 +1,32 @@ +of)('Arctic/Longyearbyen'); + } +} diff --git a/src/Timezone/Asia.php b/src/Timezone/Asia.php new file mode 100644 index 0000000..fa939c0 --- /dev/null +++ b/src/Timezone/Asia.php @@ -0,0 +1,482 @@ +of)('Asia/Manila'); + } + + public function baghdad(): Timezone + { + return ($this->of)('Asia/Baghdad'); + } + + public function ulaanbaatar(): Timezone + { + return ($this->of)('Asia/Ulaanbaatar'); + } + + public function almaty(): Timezone + { + return ($this->of)('Asia/Almaty'); + } + + public function samarkand(): Timezone + { + return ($this->of)('Asia/Samarkand'); + } + + public function ustNera(): Timezone + { + return ($this->of)('Asia/Ust'); + } + + public function pontianak(): Timezone + { + return ($this->of)('Asia/Pontianak'); + } + + public function tehran(): Timezone + { + return ($this->of)('Asia/Tehran'); + } + + public function saigon(): Timezone + { + return ($this->of)('Asia/Saigon'); + } + + public function krasnoyarsk(): Timezone + { + return ($this->of)('Asia/Krasnoyarsk'); + } + + public function hebron(): Timezone + { + return ($this->of)('Asia/Hebron'); + } + + public function kuching(): Timezone + { + return ($this->of)('Asia/Kuching'); + } + + public function katmandu(): Timezone + { + return ($this->of)('Asia/Katmandu'); + } + + public function shanghai(): Timezone + { + return ($this->of)('Asia/Shanghai'); + } + + public function calcutta(): Timezone + { + return ($this->of)('Asia/Calcutta'); + } + + public function jayapura(): Timezone + { + return ($this->of)('Asia/Jayapura'); + } + + public function muscat(): Timezone + { + return ($this->of)('Asia/Muscat'); + } + + public function omsk(): Timezone + { + return ($this->of)('Asia/Omsk'); + } + + public function aqtau(): Timezone + { + return ($this->of)('Asia/Aqtau'); + } + + public function khandyga(): Timezone + { + return ($this->of)('Asia/Khandyga'); + } + + public function riyadh(): Timezone + { + return ($this->of)('Asia/Riyadh'); + } + + public function bangkok(): Timezone + { + return ($this->of)('Asia/Bangkok'); + } + + public function thimphu(): Timezone + { + return ($this->of)('Asia/Thimphu'); + } + + public function aden(): Timezone + { + return ($this->of)('Asia/Aden'); + } + + public function yekaterinburg(): Timezone + { + return ($this->of)('Asia/Yekaterinburg'); + } + + public function oral(): Timezone + { + return ($this->of)('Asia/Oral'); + } + + public function novokuznetsk(): Timezone + { + return ($this->of)('Asia/Novokuznetsk'); + } + + public function bishkek(): Timezone + { + return ($this->of)('Asia/Bishkek'); + } + + public function macau(): Timezone + { + return ($this->of)('Asia/Macau'); + } + + public function qyzylorda(): Timezone + { + return ($this->of)('Asia/Qyzylorda'); + } + + public function seoul(): Timezone + { + return ($this->of)('Asia/Seoul'); + } + + public function irkutsk(): Timezone + { + return ($this->of)('Asia/Irkutsk'); + } + + public function aqtobe(): Timezone + { + return ($this->of)('Asia/Aqtobe'); + } + + public function chongqing(): Timezone + { + return ($this->of)('Asia/Chongqing'); + } + + public function kabul(): Timezone + { + return ($this->of)('Asia/Kabul'); + } + + public function thimbu(): Timezone + { + return ($this->of)('Asia/Thimbu'); + } + + public function karachi(): Timezone + { + return ($this->of)('Asia/Karachi'); + } + + public function jakarta(): Timezone + { + return ($this->of)('Asia/Jakarta'); + } + + public function harbin(): Timezone + { + return ($this->of)('Asia/Harbin'); + } + + public function novosibirsk(): Timezone + { + return ($this->of)('Asia/Novosibirsk'); + } + + public function dili(): Timezone + { + return ($this->of)('Asia/Dili'); + } + + public function colombo(): Timezone + { + return ($this->of)('Asia/Colombo'); + } + + public function ashkhabad(): Timezone + { + return ($this->of)('Asia/Ashkhabad'); + } + + public function dacca(): Timezone + { + return ($this->of)('Asia/Dacca'); + } + + public function ashgabat(): Timezone + { + return ($this->of)('Asia/Ashgabat'); + } + + public function ujungPandang(): Timezone + { + return ($this->of)('Asia/Ujung_Pandang'); + } + + public function qatar(): Timezone + { + return ($this->of)('Asia/Qatar'); + } + + public function tokyo(): Timezone + { + return ($this->of)('Asia/Tokyo'); + } + + public function macao(): Timezone + { + return ($this->of)('Asia/Macao'); + } + + public function tashkent(): Timezone + { + return ($this->of)('Asia/Tashkent'); + } + + public function baku(): Timezone + { + return ($this->of)('Asia/Baku'); + } + + public function pyongyang(): Timezone + { + return ($this->of)('Asia/Pyongyang'); + } + + public function tbilisi(): Timezone + { + return ($this->of)('Asia/Tbilisi'); + } + + public function amman(): Timezone + { + return ($this->of)('Asia/Amman'); + } + + public function vladivostok(): Timezone + { + return ($this->of)('Asia/Vladivostok'); + } + + public function damascus(): Timezone + { + return ($this->of)('Asia/Damascus'); + } + + public function bahrain(): Timezone + { + return ($this->of)('Asia/Bahrain'); + } + + public function vientiane(): Timezone + { + return ($this->of)('Asia/Vientiane'); + } + + public function hovd(): Timezone + { + return ($this->of)('Asia/Hovd'); + } + + public function kuwait(): Timezone + { + return ($this->of)('Asia/Kuwait'); + } + + public function magadan(): Timezone + { + return ($this->of)('Asia/Magadan'); + } + + public function ulanBator(): Timezone + { + return ($this->of)('Asia/Ulan_Bator'); + } + + public function nicosia(): Timezone + { + return ($this->of)('Asia/Nicosia'); + } + + public function telAviv(): Timezone + { + return ($this->of)('Asia/Tel_Aviv'); + } + + public function choibalsan(): Timezone + { + return ($this->of)('Asia/Choibalsan'); + } + + public function brunei(): Timezone + { + return ($this->of)('Asia/Brunei'); + } + + public function kualaLumpur(): Timezone + { + return ($this->of)('Asia/Kuala_Lumpur'); + } + + public function kathmandu(): Timezone + { + return ($this->of)('Asia/Kathmandu'); + } + + public function srednekolymsk(): Timezone + { + return ($this->of)('Asia/Srednekolymsk'); + } + + public function dubai(): Timezone + { + return ($this->of)('Asia/Dubai'); + } + + public function yakutsk(): Timezone + { + return ($this->of)('Asia/Yakutsk'); + } + + public function beirut(): Timezone + { + return ($this->of)('Asia/Beirut'); + } + + public function gaza(): Timezone + { + return ($this->of)('Asia/Gaza'); + } + + public function singapore(): Timezone + { + return ($this->of)('Asia/Singapore'); + } + + public function rangoon(): Timezone + { + return ($this->of)('Asia/Rangoon'); + } + + public function sakhalin(): Timezone + { + return ($this->of)('Asia/Sakhalin'); + } + + public function phnomPenh(): Timezone + { + return ($this->of)('Asia/Phnom_Penh'); + } + + public function kamchatka(): Timezone + { + return ($this->of)('Asia/Kamchatka'); + } + + public function yerevan(): Timezone + { + return ($this->of)('Asia/Yerevan'); + } + + public function chungking(): Timezone + { + return ($this->of)('Asia/Chungking'); + } + + public function hoChiMinh(): Timezone + { + return ($this->of)('Asia/Ho_Chi_Minh'); + } + + public function chita(): Timezone + { + return ($this->of)('Asia/Chita'); + } + + public function istanbul(): Timezone + { + return ($this->of)('Asia/Istanbul'); + } + + public function hongKong(): Timezone + { + return ($this->of)('Asia/Hong_Kong'); + } + + public function dhaka(): Timezone + { + return ($this->of)('Asia/Dhaka'); + } + + public function jerusalem(): Timezone + { + return ($this->of)('Asia/Jerusalem'); + } + + public function makassar(): Timezone + { + return ($this->of)('Asia/Makassar'); + } + + public function kolkata(): Timezone + { + return ($this->of)('Asia/Kolkata'); + } + + public function taipei(): Timezone + { + return ($this->of)('Asia/Taipei'); + } + + public function dushanbe(): Timezone + { + return ($this->of)('Asia/Dushanbe'); + } + + public function anadyr(): Timezone + { + return ($this->of)('Asia/Anadyr'); + } +} diff --git a/src/Timezone/Atlantic.php b/src/Timezone/Atlantic.php new file mode 100644 index 0000000..826665c --- /dev/null +++ b/src/Timezone/Atlantic.php @@ -0,0 +1,87 @@ +of)('Atlantic/Faroe'); + } + + public function southGeorgia(): Timezone + { + return ($this->of)('Atlantic/South_Georgia'); + } + + public function capeVerde(): Timezone + { + return ($this->of)('Atlantic/Cape_Verde'); + } + + public function faeroe(): Timezone + { + return ($this->of)('Atlantic/Faeroe'); + } + + public function bermuda(): Timezone + { + return ($this->of)('Atlantic/Bermuda'); + } + + public function janMayen(): Timezone + { + return ($this->of)('Atlantic/Jan_Mayen'); + } + + public function reykjavik(): Timezone + { + return ($this->of)('Atlantic/Reykjavik'); + } + + public function saintHelena(): Timezone + { + return ($this->of)('Atlantic/St_Helena'); + } + + public function canary(): Timezone + { + return ($this->of)('Atlantic/Canary'); + } + + public function madeira(): Timezone + { + return ($this->of)('Atlantic/Madeira'); + } + + public function azores(): Timezone + { + return ($this->of)('Atlantic/Azores'); + } + + public function stanley(): Timezone + { + return ($this->of)('Atlantic/Stanley'); + } +} diff --git a/src/Timezone/Australia.php b/src/Timezone/Australia.php new file mode 100644 index 0000000..a4886b4 --- /dev/null +++ b/src/Timezone/Australia.php @@ -0,0 +1,137 @@ +of)('Australia/Lindeman'); + } + + public function currie(): Timezone + { + return ($this->of)('Australia/Currie'); + } + + public function victoria(): Timezone + { + return ($this->of)('Australia/Victoria'); + } + + public function adelaide(): Timezone + { + return ($this->of)('Australia/Adelaide'); + } + + public function perth(): Timezone + { + return ($this->of)('Australia/Perth'); + } + + public function brisbane(): Timezone + { + return ($this->of)('Australia/Brisbane'); + } + + public function west(): Timezone + { + return ($this->of)('Australia/West'); + } + + public function australianCapitalTerritory(): Timezone + { + return ($this->of)('Australia/ACT'); + } + + public function north(): Timezone + { + return ($this->of)('Australia/North'); + } + + public function eucla(): Timezone + { + return ($this->of)('Australia/Eucla'); + } + + public function lordeHoweIsland(): Timezone + { + return ($this->of)('Australia/LHI'); + } + + public function newSouthWales(): Timezone + { + return ($this->of)('Australia/NSW'); + } + + public function queensland(): Timezone + { + return ($this->of)('Australia/Queensland'); + } + + public function south(): Timezone + { + return ($this->of)('Australia/South'); + } + + public function melbourne(): Timezone + { + return ($this->of)('Australia/Melbourne'); + } + + public function yancowinna(): Timezone + { + return ($this->of)('Australia/Yancowinna'); + } + + public function canberra(): Timezone + { + return ($this->of)('Australia/Canberra'); + } + + public function sydney(): Timezone + { + return ($this->of)('Australia/Sydney'); + } + + public function darwin(): Timezone + { + return ($this->of)('Australia/Darwin'); + } + + public function hobart(): Timezone + { + return ($this->of)('Australia/Hobart'); + } + + public function brokenHill(): Timezone + { + return ($this->of)('Australia/Broken_Hill'); + } + + public function tasmania(): Timezone + { + return ($this->of)('Australia/Tasmania'); + } +} diff --git a/src/Timezone/Europe.php b/src/Timezone/Europe.php new file mode 100644 index 0000000..8c025bd --- /dev/null +++ b/src/Timezone/Europe.php @@ -0,0 +1,322 @@ +of)('Europe/Uzhgorod'); + } + + public function riga(): Timezone + { + return ($this->of)('Europe/Riga'); + } + + public function paris(): Timezone + { + return ($this->of)('Europe/Paris'); + } + + public function guernsey(): Timezone + { + return ($this->of)('Europe/Guernsey'); + } + + public function samara(): Timezone + { + return ($this->of)('Europe/Samara'); + } + + public function athens(): Timezone + { + return ($this->of)('Europe/Athens'); + } + + public function tirane(): Timezone + { + return ($this->of)('Europe/Tirane'); + } + + public function london(): Timezone + { + return ($this->of)('Europe/London'); + } + + public function helsinki(): Timezone + { + return ($this->of)('Europe/Helsinki'); + } + + public function oslo(): Timezone + { + return ($this->of)('Europe/Oslo'); + } + + public function podgorica(): Timezone + { + return ($this->of)('Europe/Podgorica'); + } + + public function minsk(): Timezone + { + return ($this->of)('Europe/Minsk'); + } + + public function monaco(): Timezone + { + return ($this->of)('Europe/Monaco'); + } + + public function lisbon(): Timezone + { + return ($this->of)('Europe/Lisbon'); + } + + public function tallinn(): Timezone + { + return ($this->of)('Europe/Tallinn'); + } + + public function berlin(): Timezone + { + return ($this->of)('Europe/Berlin'); + } + + public function gibraltar(): Timezone + { + return ($this->of)('Europe/Gibraltar'); + } + + public function prague(): Timezone + { + return ($this->of)('Europe/Prague'); + } + + public function stockholm(): Timezone + { + return ($this->of)('Europe/Stockholm'); + } + + public function moscow(): Timezone + { + return ($this->of)('Europe/Moscow'); + } + + public function bucharest(): Timezone + { + return ($this->of)('Europe/Bucharest'); + } + + public function andorra(): Timezone + { + return ($this->of)('Europe/Andorra'); + } + + public function vilnius(): Timezone + { + return ($this->of)('Europe/Vilnius'); + } + + public function rome(): Timezone + { + return ($this->of)('Europe/Rome'); + } + + public function kiev(): Timezone + { + return ($this->of)('Europe/Kiev'); + } + + public function copenhagen(): Timezone + { + return ($this->of)('Europe/Copenhagen'); + } + + public function belgrade(): Timezone + { + return ($this->of)('Europe/Belgrade'); + } + + public function isleOfMan(): Timezone + { + return ($this->of)('Europe/Isle_of_Man'); + } + + public function budapest(): Timezone + { + return ($this->of)('Europe/Budapest'); + } + + public function tiraspol(): Timezone + { + return ($this->of)('Europe/Tiraspol'); + } + + public function vaduz(): Timezone + { + return ($this->of)('Europe/Vaduz'); + } + + public function sarajevo(): Timezone + { + return ($this->of)('Europe/Sarajevo'); + } + + public function amsterdam(): Timezone + { + return ($this->of)('Europe/Amsterdam'); + } + + public function mariehamn(): Timezone + { + return ($this->of)('Europe/Mariehamn'); + } + + public function skopje(): Timezone + { + return ($this->of)('Europe/Skopje'); + } + + public function kaliningrad(): Timezone + { + return ($this->of)('Europe/Kaliningrad'); + } + + public function bratislava(): Timezone + { + return ($this->of)('Europe/Bratislava'); + } + + public function sanMarino(): Timezone + { + return ($this->of)('Europe/San_Marino'); + } + + public function busingen(): Timezone + { + return ($this->of)('Europe/Busingen'); + } + + public function zaporozhye(): Timezone + { + return ($this->of)('Europe/Zaporozhye'); + } + + public function chisinau(): Timezone + { + return ($this->of)('Europe/Chisinau'); + } + + public function brussels(): Timezone + { + return ($this->of)('Europe/Brussels'); + } + + public function luxembourg(): Timezone + { + return ($this->of)('Europe/Luxembourg'); + } + + public function belfast(): Timezone + { + return ($this->of)('Europe/Belfast'); + } + + public function vienna(): Timezone + { + return ($this->of)('Europe/Vienna'); + } + + public function ljubljana(): Timezone + { + return ($this->of)('Europe/Ljubljana'); + } + + public function simferopol(): Timezone + { + return ($this->of)('Europe/Simferopol'); + } + + public function dublin(): Timezone + { + return ($this->of)('Europe/Dublin'); + } + + public function nicosia(): Timezone + { + return ($this->of)('Europe/Nicosia'); + } + + public function zagreb(): Timezone + { + return ($this->of)('Europe/Zagreb'); + } + + public function jersey(): Timezone + { + return ($this->of)('Europe/Jersey'); + } + + public function madrid(): Timezone + { + return ($this->of)('Europe/Madrid'); + } + + public function vatican(): Timezone + { + return ($this->of)('Europe/Vatican'); + } + + public function istanbul(): Timezone + { + return ($this->of)('Europe/Istanbul'); + } + + public function zurich(): Timezone + { + return ($this->of)('Europe/Zurich'); + } + + public function sofia(): Timezone + { + return ($this->of)('Europe/Sofia'); + } + + public function volgograd(): Timezone + { + return ($this->of)('Europe/Volgograd'); + } + + public function malta(): Timezone + { + return ($this->of)('Europe/Malta'); + } + + public function warsaw(): Timezone + { + return ($this->of)('Europe/Warsaw'); + } +} diff --git a/src/Timezone/India.php b/src/Timezone/India.php new file mode 100644 index 0000000..53342ba --- /dev/null +++ b/src/Timezone/India.php @@ -0,0 +1,82 @@ +of)('India/Cocos'); + } + + public function antananarivo(): Timezone + { + return ($this->of)('India/Antananarivo'); + } + + public function reunion(): Timezone + { + return ($this->of)('India/Reunion'); + } + + public function chagos(): Timezone + { + return ($this->of)('India/Chagos'); + } + + public function comoro(): Timezone + { + return ($this->of)('India/Comoro'); + } + + public function mayotte(): Timezone + { + return ($this->of)('India/Mayotte'); + } + + public function maldives(): Timezone + { + return ($this->of)('India/Maldives'); + } + + public function mauritius(): Timezone + { + return ($this->of)('India/Mauritius'); + } + + public function mahe(): Timezone + { + return ($this->of)('India/Mahe'); + } + + public function kerguelen(): Timezone + { + return ($this->of)('India/Kerguelen'); + } + + public function christmas(): Timezone + { + return ($this->of)('India/Christmas'); + } +} diff --git a/src/Timezone/Pacific.php b/src/Timezone/Pacific.php new file mode 100644 index 0000000..a1b0eb1 --- /dev/null +++ b/src/Timezone/Pacific.php @@ -0,0 +1,237 @@ +of)('Pacific/Kosrae'); + } + + public function enderbury(): Timezone + { + return ($this->of)('Pacific/Enderbury'); + } + + public function apia(): Timezone + { + return ($this->of)('Pacific/Apia'); + } + + public function noumea(): Timezone + { + return ($this->of)('Pacific/Noumea'); + } + + public function chatham(): Timezone + { + return ($this->of)('Pacific/Chatham'); + } + + public function wake(): Timezone + { + return ($this->of)('Pacific/Wake'); + } + + public function wallis(): Timezone + { + return ($this->of)('Pacific/Wallis'); + } + + public function johnston(): Timezone + { + return ($this->of)('Pacific/Johnston'); + } + + public function saipan(): Timezone + { + return ($this->of)('Pacific/Saipan'); + } + + public function tarawa(): Timezone + { + return ($this->of)('Pacific/Tarawa'); + } + + public function pitcairn(): Timezone + { + return ($this->of)('Pacific/Pitcairn'); + } + + public function niue(): Timezone + { + return ($this->of)('Pacific/Niue'); + } + + public function ponape(): Timezone + { + return ($this->of)('Pacific/Ponape'); + } + + public function guam(): Timezone + { + return ($this->of)('Pacific/Guam'); + } + + public function auckland(): Timezone + { + return ($this->of)('Pacific/Auckland'); + } + + public function pagoPago(): Timezone + { + return ($this->of)('Pacific/Pago_Pago'); + } + + public function chuuk(): Timezone + { + return ($this->of)('Pacific/Chuuk'); + } + + public function kwajalein(): Timezone + { + return ($this->of)('Pacific/Kwajalein'); + } + + public function fakaofo(): Timezone + { + return ($this->of)('Pacific/Fakaofo'); + } + + public function majuro(): Timezone + { + return ($this->of)('Pacific/Majuro'); + } + + public function guadalcanal(): Timezone + { + return ($this->of)('Pacific/Guadalcanal'); + } + + public function efate(): Timezone + { + return ($this->of)('Pacific/Efate'); + } + + public function tongatapu(): Timezone + { + return ($this->of)('Pacific/Tongatapu'); + } + + public function pohnpei(): Timezone + { + return ($this->of)('Pacific/Pohnpei'); + } + + public function honolulu(): Timezone + { + return ($this->of)('Pacific/Honolulu'); + } + + public function bougainville(): Timezone + { + return ($this->of)('Pacific/Bougainville'); + } + + public function galapagos(): Timezone + { + return ($this->of)('Pacific/Galapagos'); + } + + public function gambier(): Timezone + { + return ($this->of)('Pacific/Gambier'); + } + + public function palau(): Timezone + { + return ($this->of)('Pacific/Palau'); + } + + public function midway(): Timezone + { + return ($this->of)('Pacific/Midway'); + } + + public function marquesas(): Timezone + { + return ($this->of)('Pacific/Marquesas'); + } + + public function funafuti(): Timezone + { + return ($this->of)('Pacific/Funafuti'); + } + + public function norfolk(): Timezone + { + return ($this->of)('Pacific/Norfolk'); + } + + public function portMoresby(): Timezone + { + return ($this->of)('Pacific/Port_Moresby'); + } + + public function tahiti(): Timezone + { + return ($this->of)('Pacific/Tahiti'); + } + + public function fiji(): Timezone + { + return ($this->of)('Pacific/Fiji'); + } + + public function kiritimati(): Timezone + { + return ($this->of)('Pacific/Kiritimati'); + } + + public function truk(): Timezone + { + return ($this->of)('Pacific/Truk'); + } + + public function easter(): Timezone + { + return ($this->of)('Pacific/Easter'); + } + + public function rarotonga(): Timezone + { + return ($this->of)('Pacific/Rarotonga'); + } + + public function yap(): Timezone + { + return ($this->of)('Pacific/Yap'); + } + + public function nauru(): Timezone + { + return ($this->of)('Pacific/Nauru'); + } +} diff --git a/src/Timezones.php b/src/Timezones.php new file mode 100644 index 0000000..5b31c42 --- /dev/null +++ b/src/Timezones.php @@ -0,0 +1,93 @@ +of)('UTC'); + } + + public function africa(): Africa + { + return Africa::new($this->of); + } + + public function america(): America + { + return America::new($this->of); + } + + public function antartica(): Antartica + { + return Antartica::new($this->of); + } + + public function arctic(): Arctic + { + return Arctic::new($this->of); + } + + public function asia(): Asia + { + return Asia::new($this->of); + } + + public function atlantic(): Atlantic + { + return Atlantic::new($this->of); + } + + public function australia(): Australia + { + return Australia::new($this->of); + } + + public function europe(): Europe + { + return Europe::new($this->of); + } + + public function india(): India + { + return India::new($this->of); + } + + public function pacific(): Pacific + { + return Pacific::new($this->of); + } +} From 98a7ddaeb1a5537b09ffea1676c617388da014da Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Sat, 23 Nov 2024 11:52:51 +0100 Subject: [PATCH 28/85] test timezones --- src/Timezone/Asia.php | 2 +- src/Timezone/India.php | 22 +- tests/ClockTest.php | 503 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 515 insertions(+), 12 deletions(-) create mode 100644 tests/ClockTest.php diff --git a/src/Timezone/Asia.php b/src/Timezone/Asia.php index fa939c0..09e8595 100644 --- a/src/Timezone/Asia.php +++ b/src/Timezone/Asia.php @@ -52,7 +52,7 @@ public function samarkand(): Timezone public function ustNera(): Timezone { - return ($this->of)('Asia/Ust'); + return ($this->of)('Asia/Ust-Nera'); } public function pontianak(): Timezone diff --git a/src/Timezone/India.php b/src/Timezone/India.php index 53342ba..107a798 100644 --- a/src/Timezone/India.php +++ b/src/Timezone/India.php @@ -27,56 +27,56 @@ public static function new(callable $of): self public function cocos(): Timezone { - return ($this->of)('India/Cocos'); + return ($this->of)('Indian/Cocos'); } public function antananarivo(): Timezone { - return ($this->of)('India/Antananarivo'); + return ($this->of)('Indian/Antananarivo'); } public function reunion(): Timezone { - return ($this->of)('India/Reunion'); + return ($this->of)('Indian/Reunion'); } public function chagos(): Timezone { - return ($this->of)('India/Chagos'); + return ($this->of)('Indian/Chagos'); } public function comoro(): Timezone { - return ($this->of)('India/Comoro'); + return ($this->of)('Indian/Comoro'); } public function mayotte(): Timezone { - return ($this->of)('India/Mayotte'); + return ($this->of)('Indian/Mayotte'); } public function maldives(): Timezone { - return ($this->of)('India/Maldives'); + return ($this->of)('Indian/Maldives'); } public function mauritius(): Timezone { - return ($this->of)('India/Mauritius'); + return ($this->of)('Indian/Mauritius'); } public function mahe(): Timezone { - return ($this->of)('India/Mahe'); + return ($this->of)('Indian/Mahe'); } public function kerguelen(): Timezone { - return ($this->of)('India/Kerguelen'); + return ($this->of)('Indian/Kerguelen'); } public function christmas(): Timezone { - return ($this->of)('India/Christmas'); + return ($this->of)('Indian/Christmas'); } } diff --git a/tests/ClockTest.php b/tests/ClockTest.php new file mode 100644 index 0000000..2a074ce --- /dev/null +++ b/tests/ClockTest.php @@ -0,0 +1,503 @@ +switch(static fn($timezones) => $timezones->utc()); + + $this->assertSame( + $live->now()->format(Format::of('Y-m-d H:i.P')), + $utc->now()->format(Format::of('Y-m-d H:i.P')), + ); + } + + #[DataProvider('zones')] + public function testSwitchTimezone($switch) + { + $live = Clock::live(); + $clock = $live->switch($switch); + + $this->assertNotEquals($live, $clock); + $this->assertIsString($clock->now()->format(Format::iso8601())); + } + + public static function zones() + { + yield 'lome' => [static fn($timezones) => $timezones->africa()->lome()]; + yield 'ceuta' => [static fn($timezones) => $timezones->africa()->ceuta()]; + yield 'elAaiun' => [static fn($timezones) => $timezones->africa()->elAaiun()]; + yield 'portoNovo' => [static fn($timezones) => $timezones->africa()->portoNovo()]; + yield 'djibouti' => [static fn($timezones) => $timezones->africa()->djibouti()]; + yield 'windhoek' => [static fn($timezones) => $timezones->africa()->windhoek()]; + yield 'algiers' => [static fn($timezones) => $timezones->africa()->algiers()]; + yield 'ouagadougou' => [static fn($timezones) => $timezones->africa()->ouagadougou()]; + yield 'bamako' => [static fn($timezones) => $timezones->africa()->bamako()]; + yield 'harare' => [static fn($timezones) => $timezones->africa()->harare()]; + yield 'bujumbura' => [static fn($timezones) => $timezones->africa()->bujumbura()]; + yield 'douala' => [static fn($timezones) => $timezones->africa()->douala()]; + yield 'brazzaville' => [static fn($timezones) => $timezones->africa()->brazzaville()]; + yield 'tripoli' => [static fn($timezones) => $timezones->africa()->tripoli()]; + yield 'casablanca' => [static fn($timezones) => $timezones->africa()->casablanca()]; + yield 'niamey' => [static fn($timezones) => $timezones->africa()->niamey()]; + yield 'mbabane' => [static fn($timezones) => $timezones->africa()->mbabane()]; + yield 'blantyre' => [static fn($timezones) => $timezones->africa()->blantyre()]; + yield 'conakry' => [static fn($timezones) => $timezones->africa()->conakry()]; + yield 'khartoum' => [static fn($timezones) => $timezones->africa()->khartoum()]; + yield 'luanda' => [static fn($timezones) => $timezones->africa()->luanda()]; + yield 'libreville' => [static fn($timezones) => $timezones->africa()->libreville()]; + yield 'maseru' => [static fn($timezones) => $timezones->africa()->maseru()]; + yield 'lusaka' => [static fn($timezones) => $timezones->africa()->lusaka()]; + yield 'darEsSalaam' => [static fn($timezones) => $timezones->africa()->darEsSalaam()]; + yield 'nairobi' => [static fn($timezones) => $timezones->africa()->nairobi()]; + yield 'banjul' => [static fn($timezones) => $timezones->africa()->banjul()]; + yield 'bissau' => [static fn($timezones) => $timezones->africa()->bissau()]; + yield 'nouakchott' => [static fn($timezones) => $timezones->africa()->nouakchott()]; + yield 'johannesburg' => [static fn($timezones) => $timezones->africa()->johannesburg()]; + yield 'timbuktu' => [static fn($timezones) => $timezones->africa()->timbuktu()]; + yield 'saoTome' => [static fn($timezones) => $timezones->africa()->saoTome()]; + yield 'freetown' => [static fn($timezones) => $timezones->africa()->freetown()]; + yield 'kampala' => [static fn($timezones) => $timezones->africa()->kampala()]; + yield 'dakar' => [static fn($timezones) => $timezones->africa()->dakar()]; + yield 'lagos' => [static fn($timezones) => $timezones->africa()->lagos()]; + yield 'cairo' => [static fn($timezones) => $timezones->africa()->cairo()]; + yield 'mogadishu' => [static fn($timezones) => $timezones->africa()->mogadishu()]; + yield 'gaborone' => [static fn($timezones) => $timezones->africa()->gaborone()]; + yield 'tunis' => [static fn($timezones) => $timezones->africa()->tunis()]; + yield 'kigali' => [static fn($timezones) => $timezones->africa()->kigali()]; + yield 'malabo' => [static fn($timezones) => $timezones->africa()->malabo()]; + yield 'abidjan' => [static fn($timezones) => $timezones->africa()->abidjan()]; + yield 'accra' => [static fn($timezones) => $timezones->africa()->accra()]; + yield 'asmera' => [static fn($timezones) => $timezones->africa()->asmera()]; + yield 'ndjamena' => [static fn($timezones) => $timezones->africa()->ndjamena()]; + yield 'lubumbashi' => [static fn($timezones) => $timezones->africa()->lubumbashi()]; + yield 'juba' => [static fn($timezones) => $timezones->africa()->juba()]; + yield 'monrovia' => [static fn($timezones) => $timezones->africa()->monrovia()]; + yield 'maputo' => [static fn($timezones) => $timezones->africa()->maputo()]; + yield 'kinshasa' => [static fn($timezones) => $timezones->africa()->kinshasa()]; + yield 'asmara' => [static fn($timezones) => $timezones->africa()->asmara()]; + yield 'bangui' => [static fn($timezones) => $timezones->africa()->bangui()]; + yield 'addisAbaba' => [static fn($timezones) => $timezones->africa()->addisAbaba()]; + yield 'rioGallegos' => [static fn($timezones) => $timezones->america()->argentina()->rioGallegos()]; + yield 'mendoza' => [static fn($timezones) => $timezones->america()->argentina()->mendoza()]; + yield 'buenosAires' => [static fn($timezones) => $timezones->america()->argentina()->buenosAires()]; + yield 'ushuaia' => [static fn($timezones) => $timezones->america()->argentina()->ushuaia()]; + yield 'sanJuan' => [static fn($timezones) => $timezones->america()->argentina()->sanJuan()]; + yield 'laRioja' => [static fn($timezones) => $timezones->america()->argentina()->laRioja()]; + yield 'salta' => [static fn($timezones) => $timezones->america()->argentina()->salta()]; + yield 'sanLuis' => [static fn($timezones) => $timezones->america()->argentina()->sanLuis()]; + yield 'jujuy' => [static fn($timezones) => $timezones->america()->argentina()->jujuy()]; + yield 'tucuman' => [static fn($timezones) => $timezones->america()->argentina()->tucuman()]; + yield 'comodRivadavia' => [static fn($timezones) => $timezones->america()->argentina()->comodRivadavia()]; + yield 'argantina catamarca' => [static fn($timezones) => $timezones->america()->argentina()->catamarca()]; + yield 'cordoba' => [static fn($timezones) => $timezones->america()->argentina()->cordoba()]; + yield 'vincennes' => [static fn($timezones) => $timezones->america()->indiana()->vincennes()]; + yield 'marengo' => [static fn($timezones) => $timezones->america()->indiana()->marengo()]; + yield 'tellCity' => [static fn($timezones) => $timezones->america()->indiana()->tellCity()]; + yield 'knox' => [static fn($timezones) => $timezones->america()->indiana()->knox()]; + yield 'vevay' => [static fn($timezones) => $timezones->america()->indiana()->vevay()]; + yield 'indianapolis' => [static fn($timezones) => $timezones->america()->indiana()->indianapolis()]; + yield 'petersburg' => [static fn($timezones) => $timezones->america()->indiana()->petersburg()]; + yield 'winamac' => [static fn($timezones) => $timezones->america()->indiana()->winamac()]; + yield 'beulah' => [static fn($timezones) => $timezones->america()->northDakota()->beulah()]; + yield 'newSalem' => [static fn($timezones) => $timezones->america()->northDakota()->newSalem()]; + yield 'center' => [static fn($timezones) => $timezones->america()->northDakota()->center()]; + yield 'montreal' => [static fn($timezones) => $timezones->america()->montreal()]; + yield 'guatemala' => [static fn($timezones) => $timezones->america()->guatemala()]; + yield 'boaVista' => [static fn($timezones) => $timezones->america()->boaVista()]; + yield 'portoAcre' => [static fn($timezones) => $timezones->america()->portoAcre()]; + yield 'winnipeg' => [static fn($timezones) => $timezones->america()->winnipeg()]; + yield 'santiago' => [static fn($timezones) => $timezones->america()->santiago()]; + yield 'virgin' => [static fn($timezones) => $timezones->america()->virgin()]; + yield 'moncton' => [static fn($timezones) => $timezones->america()->moncton()]; + yield 'noronha' => [static fn($timezones) => $timezones->america()->noronha()]; + yield 'recife' => [static fn($timezones) => $timezones->america()->recife()]; + yield 'saintKitts' => [static fn($timezones) => $timezones->america()->saintKitts()]; + yield 'rankinInlet' => [static fn($timezones) => $timezones->america()->rankinInlet()]; + yield 'jamaica' => [static fn($timezones) => $timezones->america()->jamaica()]; + yield 'lima' => [static fn($timezones) => $timezones->america()->lima()]; + yield 'rosario' => [static fn($timezones) => $timezones->america()->rosario()]; + yield 'cambridgeBay' => [static fn($timezones) => $timezones->america()->cambridgeBay()]; + yield 'coralHarbour' => [static fn($timezones) => $timezones->america()->coralHarbour()]; + yield 'fortWayne' => [static fn($timezones) => $timezones->america()->fortWayne()]; + yield 'nassau' => [static fn($timezones) => $timezones->america()->nassau()]; + yield 'mazatlan' => [static fn($timezones) => $timezones->america()->mazatlan()]; + yield 'grandTurk' => [static fn($timezones) => $timezones->america()->grandTurk()]; + yield 'merida' => [static fn($timezones) => $timezones->america()->merida()]; + yield 'ensenada' => [static fn($timezones) => $timezones->america()->ensenada()]; + yield 'rainyRiver' => [static fn($timezones) => $timezones->america()->rainyRiver()]; + yield 'bahiaBanderas' => [static fn($timezones) => $timezones->america()->bahiaBanderas()]; + yield 'guadeloupe' => [static fn($timezones) => $timezones->america()->guadeloupe()]; + yield 'cuiaba' => [static fn($timezones) => $timezones->america()->cuiaba()]; + yield 'scoresbysund' => [static fn($timezones) => $timezones->america()->scoresbysund()]; + yield 'maceio' => [static fn($timezones) => $timezones->america()->maceio()]; + yield 'curacao' => [static fn($timezones) => $timezones->america()->curacao()]; + yield 'aruba' => [static fn($timezones) => $timezones->america()->aruba()]; + yield 'monterrey' => [static fn($timezones) => $timezones->america()->monterrey()]; + yield 'hermosillo' => [static fn($timezones) => $timezones->america()->hermosillo()]; + yield 'guayaquil' => [static fn($timezones) => $timezones->america()->guayaquil()]; + yield 'managua' => [static fn($timezones) => $timezones->america()->managua()]; + yield 'matamoros' => [static fn($timezones) => $timezones->america()->matamoros()]; + yield 'losAngeles' => [static fn($timezones) => $timezones->america()->losAngeles()]; + yield 'tegucigalpa' => [static fn($timezones) => $timezones->america()->tegucigalpa()]; + yield 'monticello' => [static fn($timezones) => $timezones->america()->monticello()]; + yield 'nome' => [static fn($timezones) => $timezones->america()->nome()]; + yield 'montevideo' => [static fn($timezones) => $timezones->america()->montevideo()]; + yield 'gooseBay' => [static fn($timezones) => $timezones->america()->gooseBay()]; + yield 'boise' => [static fn($timezones) => $timezones->america()->boise()]; + yield 'belem' => [static fn($timezones) => $timezones->america()->belem()]; + yield 'atikokan' => [static fn($timezones) => $timezones->america()->atikokan()]; + yield 'swiftCurrent' => [static fn($timezones) => $timezones->america()->swiftCurrent()]; + yield 'detroit' => [static fn($timezones) => $timezones->america()->detroit()]; + yield 'laPaz' => [static fn($timezones) => $timezones->america()->laPaz()]; + yield 'chicago' => [static fn($timezones) => $timezones->america()->chicago()]; + yield 'creston' => [static fn($timezones) => $timezones->america()->creston()]; + yield 'nipigon' => [static fn($timezones) => $timezones->america()->nipigon()]; + yield 'costaRica' => [static fn($timezones) => $timezones->america()->costaRica()]; + yield 'halifax' => [static fn($timezones) => $timezones->america()->halifax()]; + yield 'yellowknife' => [static fn($timezones) => $timezones->america()->yellowknife()]; + yield 'puertoRico' => [static fn($timezones) => $timezones->america()->puertoRico()]; + yield 'edmonton' => [static fn($timezones) => $timezones->america()->edmonton()]; + yield 'mexicoCity' => [static fn($timezones) => $timezones->america()->mexicoCity()]; + yield 'saoPaulo' => [static fn($timezones) => $timezones->america()->saoPaulo()]; + yield 'yakutat' => [static fn($timezones) => $timezones->america()->yakutat()]; + yield 'saintThomas' => [static fn($timezones) => $timezones->america()->saintThomas()]; + yield 'chihuahua' => [static fn($timezones) => $timezones->america()->chihuahua()]; + yield 'grenada' => [static fn($timezones) => $timezones->america()->grenada()]; + yield 'elSalvador' => [static fn($timezones) => $timezones->america()->elSalvador()]; + yield 'santoDomingo' => [static fn($timezones) => $timezones->america()->santoDomingo()]; + yield 'montserrat' => [static fn($timezones) => $timezones->america()->montserrat()]; + yield 'portoVelho' => [static fn($timezones) => $timezones->america()->portoVelho()]; + yield 'panama' => [static fn($timezones) => $timezones->america()->panama()]; + yield 'antigua' => [static fn($timezones) => $timezones->america()->antigua()]; + yield 'santarem' => [static fn($timezones) => $timezones->america()->santarem()]; + yield 'dawson' => [static fn($timezones) => $timezones->america()->dawson()]; + yield 'saintBarthelemy' => [static fn($timezones) => $timezones->america()->saintBarthelemy()]; + yield 'iqaluit' => [static fn($timezones) => $timezones->america()->iqaluit()]; + yield 'eirunepe' => [static fn($timezones) => $timezones->america()->eirunepe()]; + yield 'inuvik' => [static fn($timezones) => $timezones->america()->inuvik()]; + yield 'anguilla' => [static fn($timezones) => $timezones->america()->anguilla()]; + yield 'portOfSpain' => [static fn($timezones) => $timezones->america()->portOfSpain()]; + yield 'araguaina' => [static fn($timezones) => $timezones->america()->araguaina()]; + yield 'guyana' => [static fn($timezones) => $timezones->america()->guyana()]; + yield 'fortaleza' => [static fn($timezones) => $timezones->america()->fortaleza()]; + yield 'blancSablon' => [static fn($timezones) => $timezones->america()->blancSablon()]; + yield 'juneau' => [static fn($timezones) => $timezones->america()->juneau()]; + yield 'cayman' => [static fn($timezones) => $timezones->america()->cayman()]; + yield 'menominee' => [static fn($timezones) => $timezones->america()->menominee()]; + yield 'cayenne' => [static fn($timezones) => $timezones->america()->cayenne()]; + yield 'pangnirtung' => [static fn($timezones) => $timezones->america()->pangnirtung()]; + yield 'metlakatla' => [static fn($timezones) => $timezones->america()->metlakatla()]; + yield 'asuncion' => [static fn($timezones) => $timezones->america()->asuncion()]; + yield 'saintLucia' => [static fn($timezones) => $timezones->america()->saintLucia()]; + yield 'saintVincent' => [static fn($timezones) => $timezones->america()->saintVincent()]; + yield 'martinique' => [static fn($timezones) => $timezones->america()->martinique()]; + yield 'kralendijk' => [static fn($timezones) => $timezones->america()->kralendijk()]; + yield 'newYork' => [static fn($timezones) => $timezones->america()->newYork()]; + yield 'vancouver' => [static fn($timezones) => $timezones->america()->vancouver()]; + yield 'bogota' => [static fn($timezones) => $timezones->america()->bogota()]; + yield 'dominica' => [static fn($timezones) => $timezones->america()->dominica()]; + yield 'danmarkshavn' => [static fn($timezones) => $timezones->america()->danmarkshavn()]; + yield 'anchorage' => [static fn($timezones) => $timezones->america()->anchorage()]; + yield 'marigot' => [static fn($timezones) => $timezones->america()->marigot()]; + yield 'rioBranco' => [static fn($timezones) => $timezones->america()->rioBranco()]; + yield 'paramaribo' => [static fn($timezones) => $timezones->america()->paramaribo()]; + yield 'caracas' => [static fn($timezones) => $timezones->america()->caracas()]; + yield 'resolute' => [static fn($timezones) => $timezones->america()->resolute()]; + yield 'godthab' => [static fn($timezones) => $timezones->america()->godthab()]; + yield 'catamarca' => [static fn($timezones) => $timezones->america()->catamarca()]; + yield 'glaceBay' => [static fn($timezones) => $timezones->america()->glaceBay()]; + yield 'regina' => [static fn($timezones) => $timezones->america()->regina()]; + yield 'toronto' => [static fn($timezones) => $timezones->america()->toronto()]; + yield 'barbados' => [static fn($timezones) => $timezones->america()->barbados()]; + yield 'santaIsabel' => [static fn($timezones) => $timezones->america()->santaIsabel()]; + yield 'miquelon' => [static fn($timezones) => $timezones->america()->miquelon()]; + yield 'havana' => [static fn($timezones) => $timezones->america()->havana()]; + yield 'ojinaga' => [static fn($timezones) => $timezones->america()->ojinaga()]; + yield 'denver' => [static fn($timezones) => $timezones->america()->denver()]; + yield 'cancun' => [static fn($timezones) => $timezones->america()->cancun()]; + yield 'thunderBay' => [static fn($timezones) => $timezones->america()->thunderBay()]; + yield 'adak' => [static fn($timezones) => $timezones->america()->adak()]; + yield 'saintJohns' => [static fn($timezones) => $timezones->america()->saintJohns()]; + yield 'portAuPrince' => [static fn($timezones) => $timezones->america()->portAuPrince()]; + yield 'whitehorse' => [static fn($timezones) => $timezones->america()->whitehorse()]; + yield 'louisville' => [static fn($timezones) => $timezones->america()->louisville()]; + yield 'manaus' => [static fn($timezones) => $timezones->america()->manaus()]; + yield 'lowerPrinces' => [static fn($timezones) => $timezones->america()->lowerPrinces()]; + yield 'sitka' => [static fn($timezones) => $timezones->america()->sitka()]; + yield 'thule' => [static fn($timezones) => $timezones->america()->thule()]; + yield 'campoGrande' => [static fn($timezones) => $timezones->america()->campoGrande()]; + yield 'phoenix' => [static fn($timezones) => $timezones->america()->phoenix()]; + yield 'shiprock' => [static fn($timezones) => $timezones->america()->shiprock()]; + yield 'bahia' => [static fn($timezones) => $timezones->america()->bahia()]; + yield 'tortola' => [static fn($timezones) => $timezones->america()->tortola()]; + yield 'dawsonCreek' => [static fn($timezones) => $timezones->america()->dawsonCreek()]; + yield 'tijuana' => [static fn($timezones) => $timezones->america()->tijuana()]; + yield 'belize' => [static fn($timezones) => $timezones->america()->belize()]; + yield 'atka' => [static fn($timezones) => $timezones->america()->atka()]; + yield 'davis' => [static fn($timezones) => $timezones->antartica()->davis()]; + yield 'palmer' => [static fn($timezones) => $timezones->antartica()->palmer()]; + yield 'syowa' => [static fn($timezones) => $timezones->antartica()->syowa()]; + yield 'casey' => [static fn($timezones) => $timezones->antartica()->casey()]; + yield 'troll' => [static fn($timezones) => $timezones->antartica()->troll()]; + yield 'mcMurdo' => [static fn($timezones) => $timezones->antartica()->mcMurdo()]; + yield 'vostok' => [static fn($timezones) => $timezones->antartica()->vostok()]; + yield 'rothera' => [static fn($timezones) => $timezones->antartica()->rothera()]; + yield 'mawson' => [static fn($timezones) => $timezones->antartica()->mawson()]; + yield 'macquarie' => [static fn($timezones) => $timezones->antartica()->macquarie()]; + yield 'southPole' => [static fn($timezones) => $timezones->antartica()->southPole()]; + yield 'dumontDUrville' => [static fn($timezones) => $timezones->antartica()->dumontDUrville()]; + yield 'longyearbyen' => [static fn($timezones) => $timezones->arctic()->longyearbyen()]; + yield 'manila' => [static fn($timezones) => $timezones->asia()->manila()]; + yield 'baghdad' => [static fn($timezones) => $timezones->asia()->baghdad()]; + yield 'ulaanbaatar' => [static fn($timezones) => $timezones->asia()->ulaanbaatar()]; + yield 'almaty' => [static fn($timezones) => $timezones->asia()->almaty()]; + yield 'samarkand' => [static fn($timezones) => $timezones->asia()->samarkand()]; + yield 'ustNera' => [static fn($timezones) => $timezones->asia()->ustNera()]; + yield 'pontianak' => [static fn($timezones) => $timezones->asia()->pontianak()]; + yield 'tehran' => [static fn($timezones) => $timezones->asia()->tehran()]; + yield 'saigon' => [static fn($timezones) => $timezones->asia()->saigon()]; + yield 'krasnoyarsk' => [static fn($timezones) => $timezones->asia()->krasnoyarsk()]; + yield 'hebron' => [static fn($timezones) => $timezones->asia()->hebron()]; + yield 'kuching' => [static fn($timezones) => $timezones->asia()->kuching()]; + yield 'katmandu' => [static fn($timezones) => $timezones->asia()->katmandu()]; + yield 'shanghai' => [static fn($timezones) => $timezones->asia()->shanghai()]; + yield 'calcutta' => [static fn($timezones) => $timezones->asia()->calcutta()]; + yield 'jayapura' => [static fn($timezones) => $timezones->asia()->jayapura()]; + yield 'muscat' => [static fn($timezones) => $timezones->asia()->muscat()]; + yield 'omsk' => [static fn($timezones) => $timezones->asia()->omsk()]; + yield 'aqtau' => [static fn($timezones) => $timezones->asia()->aqtau()]; + yield 'khandyga' => [static fn($timezones) => $timezones->asia()->khandyga()]; + yield 'riyadh' => [static fn($timezones) => $timezones->asia()->riyadh()]; + yield 'bangkok' => [static fn($timezones) => $timezones->asia()->bangkok()]; + yield 'thimphu' => [static fn($timezones) => $timezones->asia()->thimphu()]; + yield 'aden' => [static fn($timezones) => $timezones->asia()->aden()]; + yield 'yekaterinburg' => [static fn($timezones) => $timezones->asia()->yekaterinburg()]; + yield 'oral' => [static fn($timezones) => $timezones->asia()->oral()]; + yield 'novokuznetsk' => [static fn($timezones) => $timezones->asia()->novokuznetsk()]; + yield 'bishkek' => [static fn($timezones) => $timezones->asia()->bishkek()]; + yield 'macau' => [static fn($timezones) => $timezones->asia()->macau()]; + yield 'qyzylorda' => [static fn($timezones) => $timezones->asia()->qyzylorda()]; + yield 'seoul' => [static fn($timezones) => $timezones->asia()->seoul()]; + yield 'irkutsk' => [static fn($timezones) => $timezones->asia()->irkutsk()]; + yield 'aqtobe' => [static fn($timezones) => $timezones->asia()->aqtobe()]; + yield 'chongqing' => [static fn($timezones) => $timezones->asia()->chongqing()]; + yield 'kabul' => [static fn($timezones) => $timezones->asia()->kabul()]; + yield 'thimbu' => [static fn($timezones) => $timezones->asia()->thimbu()]; + yield 'karachi' => [static fn($timezones) => $timezones->asia()->karachi()]; + yield 'jakarta' => [static fn($timezones) => $timezones->asia()->jakarta()]; + yield 'harbin' => [static fn($timezones) => $timezones->asia()->harbin()]; + yield 'novosibirsk' => [static fn($timezones) => $timezones->asia()->novosibirsk()]; + yield 'dili' => [static fn($timezones) => $timezones->asia()->dili()]; + yield 'colombo' => [static fn($timezones) => $timezones->asia()->colombo()]; + yield 'ashkhabad' => [static fn($timezones) => $timezones->asia()->ashkhabad()]; + yield 'dacca' => [static fn($timezones) => $timezones->asia()->dacca()]; + yield 'ashgabat' => [static fn($timezones) => $timezones->asia()->ashgabat()]; + yield 'ujungPandang' => [static fn($timezones) => $timezones->asia()->ujungPandang()]; + yield 'qatar' => [static fn($timezones) => $timezones->asia()->qatar()]; + yield 'tokyo' => [static fn($timezones) => $timezones->asia()->tokyo()]; + yield 'macao' => [static fn($timezones) => $timezones->asia()->macao()]; + yield 'tashkent' => [static fn($timezones) => $timezones->asia()->tashkent()]; + yield 'baku' => [static fn($timezones) => $timezones->asia()->baku()]; + yield 'pyongyang' => [static fn($timezones) => $timezones->asia()->pyongyang()]; + yield 'tbilisi' => [static fn($timezones) => $timezones->asia()->tbilisi()]; + yield 'amman' => [static fn($timezones) => $timezones->asia()->amman()]; + yield 'vladivostok' => [static fn($timezones) => $timezones->asia()->vladivostok()]; + yield 'damascus' => [static fn($timezones) => $timezones->asia()->damascus()]; + yield 'bahrain' => [static fn($timezones) => $timezones->asia()->bahrain()]; + yield 'vientiane' => [static fn($timezones) => $timezones->asia()->vientiane()]; + yield 'hovd' => [static fn($timezones) => $timezones->asia()->hovd()]; + yield 'kuwait' => [static fn($timezones) => $timezones->asia()->kuwait()]; + yield 'magadan' => [static fn($timezones) => $timezones->asia()->magadan()]; + yield 'ulanBator' => [static fn($timezones) => $timezones->asia()->ulanBator()]; + yield 'asia nicosia' => [static fn($timezones) => $timezones->asia()->nicosia()]; + yield 'telAviv' => [static fn($timezones) => $timezones->asia()->telAviv()]; + yield 'choibalsan' => [static fn($timezones) => $timezones->asia()->choibalsan()]; + yield 'brunei' => [static fn($timezones) => $timezones->asia()->brunei()]; + yield 'kualaLumpur' => [static fn($timezones) => $timezones->asia()->kualaLumpur()]; + yield 'kathmandu' => [static fn($timezones) => $timezones->asia()->kathmandu()]; + yield 'srednekolymsk' => [static fn($timezones) => $timezones->asia()->srednekolymsk()]; + yield 'dubai' => [static fn($timezones) => $timezones->asia()->dubai()]; + yield 'yakutsk' => [static fn($timezones) => $timezones->asia()->yakutsk()]; + yield 'beirut' => [static fn($timezones) => $timezones->asia()->beirut()]; + yield 'gaza' => [static fn($timezones) => $timezones->asia()->gaza()]; + yield 'singapore' => [static fn($timezones) => $timezones->asia()->singapore()]; + yield 'rangoon' => [static fn($timezones) => $timezones->asia()->rangoon()]; + yield 'sakhalin' => [static fn($timezones) => $timezones->asia()->sakhalin()]; + yield 'phnomPenh' => [static fn($timezones) => $timezones->asia()->phnomPenh()]; + yield 'kamchatka' => [static fn($timezones) => $timezones->asia()->kamchatka()]; + yield 'yerevan' => [static fn($timezones) => $timezones->asia()->yerevan()]; + yield 'chungking' => [static fn($timezones) => $timezones->asia()->chungking()]; + yield 'hoChiMinh' => [static fn($timezones) => $timezones->asia()->hoChiMinh()]; + yield 'chita' => [static fn($timezones) => $timezones->asia()->chita()]; + yield 'asia istanbul' => [static fn($timezones) => $timezones->asia()->istanbul()]; + yield 'hongKong' => [static fn($timezones) => $timezones->asia()->hongKong()]; + yield 'dhaka' => [static fn($timezones) => $timezones->asia()->dhaka()]; + yield 'jerusalem' => [static fn($timezones) => $timezones->asia()->jerusalem()]; + yield 'makassar' => [static fn($timezones) => $timezones->asia()->makassar()]; + yield 'kolkata' => [static fn($timezones) => $timezones->asia()->kolkata()]; + yield 'taipei' => [static fn($timezones) => $timezones->asia()->taipei()]; + yield 'dushanbe' => [static fn($timezones) => $timezones->asia()->dushanbe()]; + yield 'anadyr' => [static fn($timezones) => $timezones->asia()->anadyr()]; + yield 'faroe' => [static fn($timezones) => $timezones->atlantic()->faroe()]; + yield 'southGeorgia' => [static fn($timezones) => $timezones->atlantic()->southGeorgia()]; + yield 'capeVerde' => [static fn($timezones) => $timezones->atlantic()->capeVerde()]; + yield 'faeroe' => [static fn($timezones) => $timezones->atlantic()->faeroe()]; + yield 'bermuda' => [static fn($timezones) => $timezones->atlantic()->bermuda()]; + yield 'janMayen' => [static fn($timezones) => $timezones->atlantic()->janMayen()]; + yield 'reykjavik' => [static fn($timezones) => $timezones->atlantic()->reykjavik()]; + yield 'saintHelena' => [static fn($timezones) => $timezones->atlantic()->saintHelena()]; + yield 'canary' => [static fn($timezones) => $timezones->atlantic()->canary()]; + yield 'madeira' => [static fn($timezones) => $timezones->atlantic()->madeira()]; + yield 'azores' => [static fn($timezones) => $timezones->atlantic()->azores()]; + yield 'stanley' => [static fn($timezones) => $timezones->atlantic()->stanley()]; + yield 'lindeman' => [static fn($timezones) => $timezones->australia()->lindeman()]; + yield 'currie' => [static fn($timezones) => $timezones->australia()->currie()]; + yield 'victoria' => [static fn($timezones) => $timezones->australia()->victoria()]; + yield 'adelaide' => [static fn($timezones) => $timezones->australia()->adelaide()]; + yield 'perth' => [static fn($timezones) => $timezones->australia()->perth()]; + yield 'brisbane' => [static fn($timezones) => $timezones->australia()->brisbane()]; + yield 'west' => [static fn($timezones) => $timezones->australia()->west()]; + yield 'australianCapitalTerritory' => [static fn($timezones) => $timezones->australia()->australianCapitalTerritory()]; + yield 'north' => [static fn($timezones) => $timezones->australia()->north()]; + yield 'eucla' => [static fn($timezones) => $timezones->australia()->eucla()]; + yield 'lordeHoweIsland' => [static fn($timezones) => $timezones->australia()->lordeHoweIsland()]; + yield 'newSouthWales' => [static fn($timezones) => $timezones->australia()->newSouthWales()]; + yield 'queensland' => [static fn($timezones) => $timezones->australia()->queensland()]; + yield 'south' => [static fn($timezones) => $timezones->australia()->south()]; + yield 'melbourne' => [static fn($timezones) => $timezones->australia()->melbourne()]; + yield 'yancowinna' => [static fn($timezones) => $timezones->australia()->yancowinna()]; + yield 'canberra' => [static fn($timezones) => $timezones->australia()->canberra()]; + yield 'sydney' => [static fn($timezones) => $timezones->australia()->sydney()]; + yield 'darwin' => [static fn($timezones) => $timezones->australia()->darwin()]; + yield 'hobart' => [static fn($timezones) => $timezones->australia()->hobart()]; + yield 'brokenHill' => [static fn($timezones) => $timezones->australia()->brokenHill()]; + yield 'tasmania' => [static fn($timezones) => $timezones->australia()->tasmania()]; + yield 'uzhgorod' => [static fn($timezones) => $timezones->europe()->uzhgorod()]; + yield 'riga' => [static fn($timezones) => $timezones->europe()->riga()]; + yield 'paris' => [static fn($timezones) => $timezones->europe()->paris()]; + yield 'guernsey' => [static fn($timezones) => $timezones->europe()->guernsey()]; + yield 'samara' => [static fn($timezones) => $timezones->europe()->samara()]; + yield 'athens' => [static fn($timezones) => $timezones->europe()->athens()]; + yield 'tirane' => [static fn($timezones) => $timezones->europe()->tirane()]; + yield 'london' => [static fn($timezones) => $timezones->europe()->london()]; + yield 'helsinki' => [static fn($timezones) => $timezones->europe()->helsinki()]; + yield 'oslo' => [static fn($timezones) => $timezones->europe()->oslo()]; + yield 'podgorica' => [static fn($timezones) => $timezones->europe()->podgorica()]; + yield 'minsk' => [static fn($timezones) => $timezones->europe()->minsk()]; + yield 'monaco' => [static fn($timezones) => $timezones->europe()->monaco()]; + yield 'lisbon' => [static fn($timezones) => $timezones->europe()->lisbon()]; + yield 'tallinn' => [static fn($timezones) => $timezones->europe()->tallinn()]; + yield 'berlin' => [static fn($timezones) => $timezones->europe()->berlin()]; + yield 'gibraltar' => [static fn($timezones) => $timezones->europe()->gibraltar()]; + yield 'prague' => [static fn($timezones) => $timezones->europe()->prague()]; + yield 'stockholm' => [static fn($timezones) => $timezones->europe()->stockholm()]; + yield 'moscow' => [static fn($timezones) => $timezones->europe()->moscow()]; + yield 'bucharest' => [static fn($timezones) => $timezones->europe()->bucharest()]; + yield 'andorra' => [static fn($timezones) => $timezones->europe()->andorra()]; + yield 'vilnius' => [static fn($timezones) => $timezones->europe()->vilnius()]; + yield 'rome' => [static fn($timezones) => $timezones->europe()->rome()]; + yield 'kiev' => [static fn($timezones) => $timezones->europe()->kiev()]; + yield 'copenhagen' => [static fn($timezones) => $timezones->europe()->copenhagen()]; + yield 'belgrade' => [static fn($timezones) => $timezones->europe()->belgrade()]; + yield 'isleOfMan' => [static fn($timezones) => $timezones->europe()->isleOfMan()]; + yield 'budapest' => [static fn($timezones) => $timezones->europe()->budapest()]; + yield 'tiraspol' => [static fn($timezones) => $timezones->europe()->tiraspol()]; + yield 'vaduz' => [static fn($timezones) => $timezones->europe()->vaduz()]; + yield 'sarajevo' => [static fn($timezones) => $timezones->europe()->sarajevo()]; + yield 'amsterdam' => [static fn($timezones) => $timezones->europe()->amsterdam()]; + yield 'mariehamn' => [static fn($timezones) => $timezones->europe()->mariehamn()]; + yield 'skopje' => [static fn($timezones) => $timezones->europe()->skopje()]; + yield 'kaliningrad' => [static fn($timezones) => $timezones->europe()->kaliningrad()]; + yield 'bratislava' => [static fn($timezones) => $timezones->europe()->bratislava()]; + yield 'sanMarino' => [static fn($timezones) => $timezones->europe()->sanMarino()]; + yield 'busingen' => [static fn($timezones) => $timezones->europe()->busingen()]; + yield 'zaporozhye' => [static fn($timezones) => $timezones->europe()->zaporozhye()]; + yield 'chisinau' => [static fn($timezones) => $timezones->europe()->chisinau()]; + yield 'brussels' => [static fn($timezones) => $timezones->europe()->brussels()]; + yield 'luxembourg' => [static fn($timezones) => $timezones->europe()->luxembourg()]; + yield 'belfast' => [static fn($timezones) => $timezones->europe()->belfast()]; + yield 'vienna' => [static fn($timezones) => $timezones->europe()->vienna()]; + yield 'ljubljana' => [static fn($timezones) => $timezones->europe()->ljubljana()]; + yield 'simferopol' => [static fn($timezones) => $timezones->europe()->simferopol()]; + yield 'dublin' => [static fn($timezones) => $timezones->europe()->dublin()]; + yield 'europe nicosia' => [static fn($timezones) => $timezones->europe()->nicosia()]; + yield 'zagreb' => [static fn($timezones) => $timezones->europe()->zagreb()]; + yield 'jersey' => [static fn($timezones) => $timezones->europe()->jersey()]; + yield 'madrid' => [static fn($timezones) => $timezones->europe()->madrid()]; + yield 'vatican' => [static fn($timezones) => $timezones->europe()->vatican()]; + yield 'europe istanbul' => [static fn($timezones) => $timezones->europe()->istanbul()]; + yield 'zurich' => [static fn($timezones) => $timezones->europe()->zurich()]; + yield 'sofia' => [static fn($timezones) => $timezones->europe()->sofia()]; + yield 'volgograd' => [static fn($timezones) => $timezones->europe()->volgograd()]; + yield 'malta' => [static fn($timezones) => $timezones->europe()->malta()]; + yield 'warsaw' => [static fn($timezones) => $timezones->europe()->warsaw()]; + yield 'cocos' => [static fn($timezones) => $timezones->india()->cocos()]; + yield 'antananarivo' => [static fn($timezones) => $timezones->india()->antananarivo()]; + yield 'reunion' => [static fn($timezones) => $timezones->india()->reunion()]; + yield 'chagos' => [static fn($timezones) => $timezones->india()->chagos()]; + yield 'comoro' => [static fn($timezones) => $timezones->india()->comoro()]; + yield 'mayotte' => [static fn($timezones) => $timezones->india()->mayotte()]; + yield 'maldives' => [static fn($timezones) => $timezones->india()->maldives()]; + yield 'mauritius' => [static fn($timezones) => $timezones->india()->mauritius()]; + yield 'mahe' => [static fn($timezones) => $timezones->india()->mahe()]; + yield 'kerguelen' => [static fn($timezones) => $timezones->india()->kerguelen()]; + yield 'christmas' => [static fn($timezones) => $timezones->india()->christmas()]; + yield 'kosrae' => [static fn($timezones) => $timezones->pacific()->kosrae()]; + yield 'enderbury' => [static fn($timezones) => $timezones->pacific()->enderbury()]; + yield 'apia' => [static fn($timezones) => $timezones->pacific()->apia()]; + yield 'noumea' => [static fn($timezones) => $timezones->pacific()->noumea()]; + yield 'chatham' => [static fn($timezones) => $timezones->pacific()->chatham()]; + yield 'wake' => [static fn($timezones) => $timezones->pacific()->wake()]; + yield 'wallis' => [static fn($timezones) => $timezones->pacific()->wallis()]; + yield 'johnston' => [static fn($timezones) => $timezones->pacific()->johnston()]; + yield 'saipan' => [static fn($timezones) => $timezones->pacific()->saipan()]; + yield 'tarawa' => [static fn($timezones) => $timezones->pacific()->tarawa()]; + yield 'pitcairn' => [static fn($timezones) => $timezones->pacific()->pitcairn()]; + yield 'niue' => [static fn($timezones) => $timezones->pacific()->niue()]; + yield 'ponape' => [static fn($timezones) => $timezones->pacific()->ponape()]; + yield 'guam' => [static fn($timezones) => $timezones->pacific()->guam()]; + yield 'auckland' => [static fn($timezones) => $timezones->pacific()->auckland()]; + yield 'pagoPago' => [static fn($timezones) => $timezones->pacific()->pagoPago()]; + yield 'chuuk' => [static fn($timezones) => $timezones->pacific()->chuuk()]; + yield 'kwajalein' => [static fn($timezones) => $timezones->pacific()->kwajalein()]; + yield 'fakaofo' => [static fn($timezones) => $timezones->pacific()->fakaofo()]; + yield 'majuro' => [static fn($timezones) => $timezones->pacific()->majuro()]; + yield 'guadalcanal' => [static fn($timezones) => $timezones->pacific()->guadalcanal()]; + yield 'efate' => [static fn($timezones) => $timezones->pacific()->efate()]; + yield 'tongatapu' => [static fn($timezones) => $timezones->pacific()->tongatapu()]; + yield 'pohnpei' => [static fn($timezones) => $timezones->pacific()->pohnpei()]; + yield 'honolulu' => [static fn($timezones) => $timezones->pacific()->honolulu()]; + yield 'bougainville' => [static fn($timezones) => $timezones->pacific()->bougainville()]; + yield 'galapagos' => [static fn($timezones) => $timezones->pacific()->galapagos()]; + yield 'gambier' => [static fn($timezones) => $timezones->pacific()->gambier()]; + yield 'palau' => [static fn($timezones) => $timezones->pacific()->palau()]; + yield 'midway' => [static fn($timezones) => $timezones->pacific()->midway()]; + yield 'marquesas' => [static fn($timezones) => $timezones->pacific()->marquesas()]; + yield 'funafuti' => [static fn($timezones) => $timezones->pacific()->funafuti()]; + yield 'norfolk' => [static fn($timezones) => $timezones->pacific()->norfolk()]; + yield 'portMoresby' => [static fn($timezones) => $timezones->pacific()->portMoresby()]; + yield 'tahiti' => [static fn($timezones) => $timezones->pacific()->tahiti()]; + yield 'fiji' => [static fn($timezones) => $timezones->pacific()->fiji()]; + yield 'kiritimati' => [static fn($timezones) => $timezones->pacific()->kiritimati()]; + yield 'truk' => [static fn($timezones) => $timezones->pacific()->truk()]; + yield 'easter' => [static fn($timezones) => $timezones->pacific()->easter()]; + yield 'rarotonga' => [static fn($timezones) => $timezones->pacific()->rarotonga()]; + yield 'yap' => [static fn($timezones) => $timezones->pacific()->yap()]; + yield 'nauru' => [static fn($timezones) => $timezones->pacific()->nauru()]; + } +} From fc82ed467905d432f70da87b244345d020ec0ab1 Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Sat, 23 Nov 2024 12:22:01 +0100 Subject: [PATCH 29/85] test all clocks timezone switching --- tests/ClockTest.php | 157 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 156 insertions(+), 1 deletion(-) diff --git a/tests/ClockTest.php b/tests/ClockTest.php index 2a074ce..1c8dcf0 100644 --- a/tests/ClockTest.php +++ b/tests/ClockTest.php @@ -11,9 +11,20 @@ TestCase, Attributes\DataProvider, }; +use Psr\Log\{ + LoggerInterface, + LoggerTrait, +}; +use Innmind\BlackBox\{ + PHPUnit\BlackBox, + Set, +}; +use Fixtures\Innmind\TimeContinuum\PointInTime; class ClockTest extends TestCase { + use BlackBox; + public function testUtcIsDefaultTimezones() { $live = Clock::live(); @@ -36,7 +47,120 @@ public function testSwitchTimezone($switch) $this->assertIsString($clock->now()->format(Format::iso8601())); } + public function testTimezoneDifferences() + { + $this + ->forAll( + Set\Elements::of(...\array_values(\iterator_to_array(self::america()))) + ->map(static fn($switch) => $switch[0]), + Set\Either::any( + Set\Elements::of(...\array_values(\iterator_to_array(self::africa()))), + Set\Elements::of(...\array_values(\iterator_to_array(self::europe()))), + Set\Elements::of(...\array_values(\iterator_to_array(self::india()))), + Set\Elements::of(...\array_values(\iterator_to_array(self::asia()))), + Set\Elements::of(...\array_values(\iterator_to_array(self::australia()))), + ) + ->map(static fn($switch) => $switch[0]), + ) + ->then(function($america, $other) { + $america = Clock::live()->switch($america); + $other = Clock::live()->switch($other); + + $this->assertNotSame( + $america->now()->toString(), + $other->now()->toString(), + ); + }); + } + + public function testFrozenClockDoesntChangeItsTimezone() + { + $this + ->forAll(PointInTime::any()) + ->then(function($point) { + $frozen = Clock::frozen($point); + $clock = $frozen->switch(static fn($timezones) => $timezones->europe()->paris()); + + $this->assertSame( + $point->toString(), + $clock->now()->toString(), + ); + $this->assertSame( + $frozen->now()->toString(), + $clock->now()->toString(), + ); + $this->assertSame( + $frozen->now()->toString(), + $clock->at($point->toString())->match( + static fn($point) => $point->toString(), + static fn() => null, + ), + ); + }); + } + + public function testLoggerUseNewTimezone() + { + $this + ->forAll( + Set\Elements::of(...\array_values(\iterator_to_array(self::america()))) + ->map(static fn($switch) => $switch[0]), + Set\Either::any( + Set\Elements::of(...\array_values(\iterator_to_array(self::africa()))), + Set\Elements::of(...\array_values(\iterator_to_array(self::europe()))), + Set\Elements::of(...\array_values(\iterator_to_array(self::india()))), + Set\Elements::of(...\array_values(\iterator_to_array(self::asia()))), + Set\Elements::of(...\array_values(\iterator_to_array(self::australia()))), + ) + ->map(static fn($switch) => $switch[0]), + ) + ->then(function($america, $other) { + $gather = new class implements LoggerInterface { + use LoggerTrait; + + public array $logs = []; + + public function log($level, string|\Stringable $message, array $context = []): void + { + $this->logs[] = $context; + } + }; + $america = Clock::logger(Clock::live(), $gather)->switch($america); + $new = $america->switch($other); + + $now1 = $america->now(); + $now2 = $new->now(); + + $this->assertSame( + $now1->toString(), + $gather->logs[0]['point'], + ); + $this->assertSame( + $now2->toString(), + $gather->logs[1]['point'], + ); + $this->assertNotSame( + $gather->logs[0], + $gather->logs[1], + ); + }); + } + public static function zones() + { + yield from self::africa(); + yield from self::america(); + yield from self::antartica(); + yield 'longyearbyen' => [static fn($timezones) => $timezones->arctic()->longyearbyen()]; + yield from self::asia(); + yield from self::atlantic(); + yield from self::australia(); + yield from self::europe(); + yield from self::india(); + yield from self::pacific(); + } + + public static function africa() { yield 'lome' => [static fn($timezones) => $timezones->africa()->lome()]; yield 'ceuta' => [static fn($timezones) => $timezones->africa()->ceuta()]; @@ -92,6 +216,10 @@ public static function zones() yield 'asmara' => [static fn($timezones) => $timezones->africa()->asmara()]; yield 'bangui' => [static fn($timezones) => $timezones->africa()->bangui()]; yield 'addisAbaba' => [static fn($timezones) => $timezones->africa()->addisAbaba()]; + } + + public static function america() + { yield 'rioGallegos' => [static fn($timezones) => $timezones->america()->argentina()->rioGallegos()]; yield 'mendoza' => [static fn($timezones) => $timezones->america()->argentina()->mendoza()]; yield 'buenosAires' => [static fn($timezones) => $timezones->america()->argentina()->buenosAires()]; @@ -249,6 +377,10 @@ public static function zones() yield 'tijuana' => [static fn($timezones) => $timezones->america()->tijuana()]; yield 'belize' => [static fn($timezones) => $timezones->america()->belize()]; yield 'atka' => [static fn($timezones) => $timezones->america()->atka()]; + } + + public static function antartica() + { yield 'davis' => [static fn($timezones) => $timezones->antartica()->davis()]; yield 'palmer' => [static fn($timezones) => $timezones->antartica()->palmer()]; yield 'syowa' => [static fn($timezones) => $timezones->antartica()->syowa()]; @@ -261,7 +393,10 @@ public static function zones() yield 'macquarie' => [static fn($timezones) => $timezones->antartica()->macquarie()]; yield 'southPole' => [static fn($timezones) => $timezones->antartica()->southPole()]; yield 'dumontDUrville' => [static fn($timezones) => $timezones->antartica()->dumontDUrville()]; - yield 'longyearbyen' => [static fn($timezones) => $timezones->arctic()->longyearbyen()]; + } + + public static function asia() + { yield 'manila' => [static fn($timezones) => $timezones->asia()->manila()]; yield 'baghdad' => [static fn($timezones) => $timezones->asia()->baghdad()]; yield 'ulaanbaatar' => [static fn($timezones) => $timezones->asia()->ulaanbaatar()]; @@ -353,6 +488,10 @@ public static function zones() yield 'taipei' => [static fn($timezones) => $timezones->asia()->taipei()]; yield 'dushanbe' => [static fn($timezones) => $timezones->asia()->dushanbe()]; yield 'anadyr' => [static fn($timezones) => $timezones->asia()->anadyr()]; + } + + public static function atlantic() + { yield 'faroe' => [static fn($timezones) => $timezones->atlantic()->faroe()]; yield 'southGeorgia' => [static fn($timezones) => $timezones->atlantic()->southGeorgia()]; yield 'capeVerde' => [static fn($timezones) => $timezones->atlantic()->capeVerde()]; @@ -365,6 +504,10 @@ public static function zones() yield 'madeira' => [static fn($timezones) => $timezones->atlantic()->madeira()]; yield 'azores' => [static fn($timezones) => $timezones->atlantic()->azores()]; yield 'stanley' => [static fn($timezones) => $timezones->atlantic()->stanley()]; + } + + public static function australia() + { yield 'lindeman' => [static fn($timezones) => $timezones->australia()->lindeman()]; yield 'currie' => [static fn($timezones) => $timezones->australia()->currie()]; yield 'victoria' => [static fn($timezones) => $timezones->australia()->victoria()]; @@ -387,6 +530,10 @@ public static function zones() yield 'hobart' => [static fn($timezones) => $timezones->australia()->hobart()]; yield 'brokenHill' => [static fn($timezones) => $timezones->australia()->brokenHill()]; yield 'tasmania' => [static fn($timezones) => $timezones->australia()->tasmania()]; + } + + public static function europe() + { yield 'uzhgorod' => [static fn($timezones) => $timezones->europe()->uzhgorod()]; yield 'riga' => [static fn($timezones) => $timezones->europe()->riga()]; yield 'paris' => [static fn($timezones) => $timezones->europe()->paris()]; @@ -446,6 +593,10 @@ public static function zones() yield 'volgograd' => [static fn($timezones) => $timezones->europe()->volgograd()]; yield 'malta' => [static fn($timezones) => $timezones->europe()->malta()]; yield 'warsaw' => [static fn($timezones) => $timezones->europe()->warsaw()]; + } + + public static function india() + { yield 'cocos' => [static fn($timezones) => $timezones->india()->cocos()]; yield 'antananarivo' => [static fn($timezones) => $timezones->india()->antananarivo()]; yield 'reunion' => [static fn($timezones) => $timezones->india()->reunion()]; @@ -457,6 +608,10 @@ public static function zones() yield 'mahe' => [static fn($timezones) => $timezones->india()->mahe()]; yield 'kerguelen' => [static fn($timezones) => $timezones->india()->kerguelen()]; yield 'christmas' => [static fn($timezones) => $timezones->india()->christmas()]; + } + + public static function pacific() + { yield 'kosrae' => [static fn($timezones) => $timezones->pacific()->kosrae()]; yield 'enderbury' => [static fn($timezones) => $timezones->pacific()->enderbury()]; yield 'apia' => [static fn($timezones) => $timezones->pacific()->apia()]; From c51dd0f68139c6c3c9506e0d1b838f03ac4c33c3 Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Sat, 23 Nov 2024 12:24:09 +0100 Subject: [PATCH 30/85] rename India timezone to Indian --- src/Timezone/{India.php => Indian.php} | 2 +- src/Timezones.php | 6 +++--- tests/ClockTest.php | 30 +++++++++++++------------- 3 files changed, 19 insertions(+), 19 deletions(-) rename src/Timezone/{India.php => Indian.php} (98%) diff --git a/src/Timezone/India.php b/src/Timezone/Indian.php similarity index 98% rename from src/Timezone/India.php rename to src/Timezone/Indian.php index 107a798..c247d73 100644 --- a/src/Timezone/India.php +++ b/src/Timezone/Indian.php @@ -5,7 +5,7 @@ use Innmind\TimeContinuum\Timezone; -final class India +final class Indian { /** * @param callable(non-empty-string): Timezone $of diff --git a/src/Timezones.php b/src/Timezones.php index 5b31c42..ece13f2 100644 --- a/src/Timezones.php +++ b/src/Timezones.php @@ -12,7 +12,7 @@ Atlantic, Australia, Europe, - India, + Indian, Pacific, }; @@ -81,9 +81,9 @@ public function europe(): Europe return Europe::new($this->of); } - public function india(): India + public function indian(): Indian { - return India::new($this->of); + return Indian::new($this->of); } public function pacific(): Pacific diff --git a/tests/ClockTest.php b/tests/ClockTest.php index 1c8dcf0..bb14d66 100644 --- a/tests/ClockTest.php +++ b/tests/ClockTest.php @@ -56,7 +56,7 @@ public function testTimezoneDifferences() Set\Either::any( Set\Elements::of(...\array_values(\iterator_to_array(self::africa()))), Set\Elements::of(...\array_values(\iterator_to_array(self::europe()))), - Set\Elements::of(...\array_values(\iterator_to_array(self::india()))), + Set\Elements::of(...\array_values(\iterator_to_array(self::indian()))), Set\Elements::of(...\array_values(\iterator_to_array(self::asia()))), Set\Elements::of(...\array_values(\iterator_to_array(self::australia()))), ) @@ -108,7 +108,7 @@ public function testLoggerUseNewTimezone() Set\Either::any( Set\Elements::of(...\array_values(\iterator_to_array(self::africa()))), Set\Elements::of(...\array_values(\iterator_to_array(self::europe()))), - Set\Elements::of(...\array_values(\iterator_to_array(self::india()))), + Set\Elements::of(...\array_values(\iterator_to_array(self::indian()))), Set\Elements::of(...\array_values(\iterator_to_array(self::asia()))), Set\Elements::of(...\array_values(\iterator_to_array(self::australia()))), ) @@ -156,7 +156,7 @@ public static function zones() yield from self::atlantic(); yield from self::australia(); yield from self::europe(); - yield from self::india(); + yield from self::indian(); yield from self::pacific(); } @@ -595,19 +595,19 @@ public static function europe() yield 'warsaw' => [static fn($timezones) => $timezones->europe()->warsaw()]; } - public static function india() + public static function indian() { - yield 'cocos' => [static fn($timezones) => $timezones->india()->cocos()]; - yield 'antananarivo' => [static fn($timezones) => $timezones->india()->antananarivo()]; - yield 'reunion' => [static fn($timezones) => $timezones->india()->reunion()]; - yield 'chagos' => [static fn($timezones) => $timezones->india()->chagos()]; - yield 'comoro' => [static fn($timezones) => $timezones->india()->comoro()]; - yield 'mayotte' => [static fn($timezones) => $timezones->india()->mayotte()]; - yield 'maldives' => [static fn($timezones) => $timezones->india()->maldives()]; - yield 'mauritius' => [static fn($timezones) => $timezones->india()->mauritius()]; - yield 'mahe' => [static fn($timezones) => $timezones->india()->mahe()]; - yield 'kerguelen' => [static fn($timezones) => $timezones->india()->kerguelen()]; - yield 'christmas' => [static fn($timezones) => $timezones->india()->christmas()]; + yield 'cocos' => [static fn($timezones) => $timezones->indian()->cocos()]; + yield 'antananarivo' => [static fn($timezones) => $timezones->indian()->antananarivo()]; + yield 'reunion' => [static fn($timezones) => $timezones->indian()->reunion()]; + yield 'chagos' => [static fn($timezones) => $timezones->indian()->chagos()]; + yield 'comoro' => [static fn($timezones) => $timezones->indian()->comoro()]; + yield 'mayotte' => [static fn($timezones) => $timezones->indian()->mayotte()]; + yield 'maldives' => [static fn($timezones) => $timezones->indian()->maldives()]; + yield 'mauritius' => [static fn($timezones) => $timezones->indian()->mauritius()]; + yield 'mahe' => [static fn($timezones) => $timezones->indian()->mahe()]; + yield 'kerguelen' => [static fn($timezones) => $timezones->indian()->kerguelen()]; + yield 'christmas' => [static fn($timezones) => $timezones->indian()->christmas()]; } public static function pacific() From 269915689ad189c6915f3164bbb637fc0b31005b Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Sat, 23 Nov 2024 12:42:42 +0100 Subject: [PATCH 31/85] represent months via an enum --- CHANGELOG.md | 4 ++ src/Calendar/Month.php | 66 +++++++++++++++++++++++++++++++++ src/Move/EndOfYear.php | 2 +- src/Move/StartOfYear.php | 2 +- src/PointInTime.php | 5 +-- src/PointInTime/Day.php | 2 +- src/PointInTime/Month.php | 34 ++++------------- tests/NowTest.php | 4 +- tests/PointInTime/DayTest.php | 10 ++++- tests/PointInTime/MonthTest.php | 7 ++-- tests/PointInTimeTest.php | 12 +++--- 11 files changed, 102 insertions(+), 46 deletions(-) create mode 100644 src/Calendar/Month.php diff --git a/CHANGELOG.md b/CHANGELOG.md index 847bfa3..a6fe85f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ ## Added - `Innmind\TimeContinuum\Clock::switch()` +- `Innmind\TimeContinuum\Calendar\Month` +- `Innmind\TimeContinuum\PointInTime\Month::calendar()` ### Changed @@ -39,6 +41,8 @@ - Earth timezones - `Innmind\TimeContinuum\Timezone::daylightSavingTimeApplied()` - `Innmind\TimeContinuum\Exception` +- `Innmind\TimeContinuum\PointInTime\Month::toInt()` +- `Innmind\TimeContinuum\PointInTime\Month::toString()` ## 3.4.1 - 2023-09-17 diff --git a/src/Calendar/Month.php b/src/Calendar/Month.php new file mode 100644 index 0000000..824e704 --- /dev/null +++ b/src/Calendar/Month.php @@ -0,0 +1,66 @@ + self::january, + 2 => self::february, + 3 => self::march, + 4 => self::april, + 5 => self::may, + 6 => self::june, + 7 => self::july, + 8 => self::august, + 9 => self::september, + 10 => self::october, + 11 => self::november, + 12 => self::december, + }; + } + + /** + * @return int<1, 12> + */ + public function toInt(): int + { + return match ($this) { + self::january => 1, + self::february => 2, + self::march => 3, + self::april => 4, + self::may => 5, + self::june => 6, + self::july => 7, + self::august => 8, + self::september => 9, + self::october => 10, + self::november => 11, + self::december => 12, + }; + } +} diff --git a/src/Move/EndOfYear.php b/src/Move/EndOfYear.php index 7ae9892..2a52dd4 100644 --- a/src/Move/EndOfYear.php +++ b/src/Move/EndOfYear.php @@ -13,7 +13,7 @@ final class EndOfYear public function __invoke(PointInTime $point): PointInTime { $point = (new StartOfMonth)($point)->goForward( - Month::of(12 - $point->month()->toInt()), + Month::of(12 - $point->month()->calendar()->toInt()), ); return (new EndOfMonth)($point); diff --git a/src/Move/StartOfYear.php b/src/Move/StartOfYear.php index 3652952..d946786 100644 --- a/src/Move/StartOfYear.php +++ b/src/Move/StartOfYear.php @@ -13,7 +13,7 @@ final class StartOfYear public function __invoke(PointInTime $point): PointInTime { return (new StartOfMonth)($point)->goBack( - Month::of($point->month()->toInt() - 1), + Month::of($point->month()->calendar()->toInt() - 1), ); } } diff --git a/src/PointInTime.php b/src/PointInTime.php index ba71eb7..0ad8112 100644 --- a/src/PointInTime.php +++ b/src/PointInTime.php @@ -74,12 +74,9 @@ public function year(): Year public function month(): Month { - /** @var int<1, 12> */ - $month = (int) $this->date->format('n'); - return Month::of( $this->year(), - $month, + Calendar\Month::of((int) $this->date->format('n')), ); } diff --git a/src/PointInTime/Day.php b/src/PointInTime/Day.php index af8bfd7..d06067f 100644 --- a/src/PointInTime/Day.php +++ b/src/PointInTime/Day.php @@ -26,7 +26,7 @@ private function __construct(Year $year, Month $month, int $day) /** @var int<0, 6> */ $this->week = (int) \date( 'w', - $time = \mktime(0, 0, 0, $month->toInt(), $day, $year->toInt()), + $time = \mktime(0, 0, 0, $month->calendar()->toInt(), $day, $year->toInt()), ); /** @var int<0, 365> */ $this->ofYear = (int) \date('z', $time); diff --git a/src/PointInTime/Month.php b/src/PointInTime/Month.php index cb68ec7..ef93c62 100644 --- a/src/PointInTime/Month.php +++ b/src/PointInTime/Month.php @@ -3,41 +3,32 @@ namespace Innmind\TimeContinuum\PointInTime; +use Innmind\TimeContinuum\Calendar; + /** * @psalm-immutable */ final class Month { - /** @var int<1, 12> */ - private int $month; + private Calendar\Month $month; /** @var int<28, 31> */ private int $days; - /** @var 'January'|'February'|'March'|'April'|'May'|'June'|'July'|'August'|'September'|'October'|'November'|'December' */ - private string $string; - /** - * @param int<1, 12> $month - */ - private function __construct(Year $year, int $month) + private function __construct(Year $year, Calendar\Month $month) { - // todo transform into an enum $this->month = $month; /** @var int<28, 31> */ $this->days = (int) \date( 't', - $time = \mktime(0, 0, 0, $month, 1, $year->toInt()), + \mktime(0, 0, 0, $month->toInt(), 1, $year->toInt()), ); - /** @var 'January'|'February'|'March'|'April'|'May'|'June'|'July'|'August'|'September'|'October'|'November'|'December' */ - $this->string = \date('F', $time); } /** * @psalm-pure * @internal - * - * @param int<1, 12> $month */ - public static function of(Year $year, int $month): self + public static function of(Year $year, Calendar\Month $month): self { return new self($year, $month); } @@ -50,19 +41,8 @@ public function numberOfDays(): int return $this->days; } - /** - * @return int<1, 12> - */ - public function toInt(): int + public function calendar(): Calendar\Month { return $this->month; } - - /** - * @return 'January'|'February'|'March'|'April'|'May'|'June'|'July'|'August'|'September'|'October'|'November'|'December' - */ - public function toString(): string - { - return $this->string; - } } diff --git a/tests/NowTest.php b/tests/NowTest.php index a1f04fa..403021e 100644 --- a/tests/NowTest.php +++ b/tests/NowTest.php @@ -39,7 +39,7 @@ public function testInterface() $this->assertInstanceOf(Millisecond::class, $point->millisecond()); $this->assertInstanceOf(Offset::class, $point->offset()); $this->assertSame((int) \date('Y', $timestamp), $point->year()->toInt()); - $this->assertSame((int) \date('m', $timestamp), $point->month()->toInt()); + $this->assertSame((int) \date('m', $timestamp), $point->month()->calendar()->toInt()); $this->assertSame((int) \date('d', $timestamp), $point->day()->toInt()); $this->assertSame((int) \date('H', $timestamp), $point->hour()->toInt()); $this->assertSame((int) \date('i', $timestamp), $point->minute()->toInt()); @@ -83,7 +83,7 @@ public function testChangeOffset() $this->assertNotSame($point->millisecond(), $point2->millisecond()); $this->assertSame($point->milliseconds(), $point2->milliseconds()); $this->assertSame((int) $now->format('Y'), $point2->year()->toInt()); - $this->assertSame((int) $now->format('m'), $point2->month()->toInt()); + $this->assertSame((int) $now->format('m'), $point2->month()->calendar()->toInt()); $this->assertSame((int) $now->format('d'), $point2->day()->toInt()); $this->assertSame((int) $now->format('H'), $point2->hour()->toInt()); $this->assertSame((int) $now->format('i'), $point2->minute()->toInt()); diff --git a/tests/PointInTime/DayTest.php b/tests/PointInTime/DayTest.php index 5c8723f..4fdf99e 100644 --- a/tests/PointInTime/DayTest.php +++ b/tests/PointInTime/DayTest.php @@ -7,6 +7,7 @@ PointInTime\Day, PointInTime\Month, PointInTime\Year, + Calendar, }; use PHPUnit\Framework\TestCase; @@ -14,7 +15,14 @@ class DayTest extends TestCase { public function testInterface() { - $day = Day::of($year = Year::of(2016), Month::of($year, 10), 5); + $day = Day::of( + $year = Year::of(2016), + Month::of( + $year, + Calendar\Month::of(10), + ), + 5, + ); $this->assertSame(3, $day->weekNumber()); $this->assertSame(278, $day->ofYear()); diff --git a/tests/PointInTime/MonthTest.php b/tests/PointInTime/MonthTest.php index fe88819..3850066 100644 --- a/tests/PointInTime/MonthTest.php +++ b/tests/PointInTime/MonthTest.php @@ -6,6 +6,7 @@ use Innmind\TimeContinuum\{ PointInTime\Month, PointInTime\Year, + Calendar, }; use PHPUnit\Framework\TestCase; @@ -13,10 +14,10 @@ class MonthTest extends TestCase { public function testInterface() { - $month = Month::of(Year::of(2016), 10); + $month = Month::of(Year::of(2016), Calendar\Month::of(10)); $this->assertSame(31, $month->numberOfDays()); - $this->assertSame(10, $month->toInt()); - $this->assertSame('October', $month->toString()); + $this->assertSame(10, $month->calendar()->toInt()); + $this->assertSame('october', $month->calendar()->name); } } diff --git a/tests/PointInTimeTest.php b/tests/PointInTimeTest.php index 0d7849c..a896914 100644 --- a/tests/PointInTimeTest.php +++ b/tests/PointInTimeTest.php @@ -35,7 +35,7 @@ public function testInterface() $this->assertInstanceOf(Millisecond::class, $point->millisecond()); $this->assertInstanceOf(Offset::class, $point->offset()); $this->assertSame(2016, $point->year()->toInt()); - $this->assertSame(10, $point->month()->toInt()); + $this->assertSame(10, $point->month()->calendar()->toInt()); $this->assertSame(5, $point->day()->toInt()); $this->assertSame(8, $point->hour()->toInt()); $this->assertSame(1, $point->minute()->toInt()); @@ -82,7 +82,7 @@ public function testChangeOffset() $this->assertNotSame($point->millisecond(), $point2->millisecond()); $this->assertSame($point->milliseconds(), $point2->milliseconds()); $this->assertSame(2016, $point2->year()->toInt()); - $this->assertSame(10, $point2->month()->toInt()); + $this->assertSame(10, $point2->month()->calendar()->toInt()); $this->assertSame(5, $point2->day()->toInt()); $this->assertSame(3, $point2->hour()->toInt()); $this->assertSame(31, $point2->minute()->toInt()); @@ -128,14 +128,14 @@ public function testGoForward() ); $this->assertSame(2016, $point->year()->toInt()); - $this->assertSame(10, $point->month()->toInt()); + $this->assertSame(10, $point->month()->calendar()->toInt()); $this->assertSame(5, $point->day()->toInt()); $this->assertSame(8, $point->hour()->toInt()); $this->assertSame(1, $point->minute()->toInt()); $this->assertSame(30, $point->second()->toInt()); $this->assertSame(123, $point->millisecond()->toInt()); $this->assertSame(2017, $point2->year()->toInt()); - $this->assertSame(11, $point2->month()->toInt()); + $this->assertSame(11, $point2->month()->calendar()->toInt()); $this->assertSame(6, $point2->day()->toInt()); $this->assertSame(9, $point2->hour()->toInt()); $this->assertSame(3, $point2->minute()->toInt()); @@ -151,14 +151,14 @@ public function testGoBack() ); $this->assertSame(2016, $point->year()->toInt()); - $this->assertSame(10, $point->month()->toInt()); + $this->assertSame(10, $point->month()->calendar()->toInt()); $this->assertSame(5, $point->day()->toInt()); $this->assertSame(8, $point->hour()->toInt()); $this->assertSame(1, $point->minute()->toInt()); $this->assertSame(30, $point->second()->toInt()); $this->assertSame(123, $point->millisecond()->toInt()); $this->assertSame(2015, $point2->year()->toInt()); - $this->assertSame(9, $point2->month()->toInt()); + $this->assertSame(9, $point2->month()->calendar()->toInt()); $this->assertSame(4, $point2->day()->toInt()); $this->assertSame(6, $point2->hour()->toInt()); $this->assertSame(59, $point2->minute()->toInt()); From 7835485413448fe996452f15f7b51d98cf926f4d Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Sat, 23 Nov 2024 12:51:35 +0100 Subject: [PATCH 32/85] represent days via an enum --- CHANGELOG.md | 4 +++ src/Calendar/Day.php | 51 +++++++++++++++++++++++++++++++++++ src/PointInTime/Day.php | 29 +++++--------------- tests/PointInTime/DayTest.php | 4 +-- 4 files changed, 63 insertions(+), 25 deletions(-) create mode 100644 src/Calendar/Day.php diff --git a/CHANGELOG.md b/CHANGELOG.md index a6fe85f..0c6d809 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ - `Innmind\TimeContinuum\Clock::switch()` - `Innmind\TimeContinuum\Calendar\Month` - `Innmind\TimeContinuum\PointInTime\Month::calendar()` +- `Innmind\TimeContinuum\Calendar\Day` +- `Innmind\TimeContinuum\PointInTime\Day::ofWeek()` ### Changed @@ -43,6 +45,8 @@ - `Innmind\TimeContinuum\Exception` - `Innmind\TimeContinuum\PointInTime\Month::toInt()` - `Innmind\TimeContinuum\PointInTime\Month::toString()` +- `Innmind\TimeContinuum\PointInTime\Day::weekNumber()` +- `Innmind\TimeContinuum\PointInTime\Day::toString()` ## 3.4.1 - 2023-09-17 diff --git a/src/Calendar/Day.php b/src/Calendar/Day.php new file mode 100644 index 0000000..8592f92 --- /dev/null +++ b/src/Calendar/Day.php @@ -0,0 +1,51 @@ + self::monday, + 2 => self::tuesday, + 3 => self::wednesday, + 4 => self::thursday, + 5 => self::friday, + 6 => self::saturday, + 0 => self::sunday, + }; + } + + /** + * @return int<0, 6> + */ + public function toInt(): int + { + return match ($this) { + self::monday => 1, + self::tuesday => 2, + self::wednesday => 3, + self::thursday => 4, + self::friday => 5, + self::saturday => 6, + self::sunday => 0, + }; + } +} diff --git a/src/PointInTime/Day.php b/src/PointInTime/Day.php index d06067f..7399691 100644 --- a/src/PointInTime/Day.php +++ b/src/PointInTime/Day.php @@ -3,6 +3,8 @@ namespace Innmind\TimeContinuum\PointInTime; +use Innmind\TimeContinuum\Calendar; + /** * @psalm-immutable */ @@ -10,12 +12,9 @@ final class Day { /** @var int<1, 31> */ private int $day; - /** @var int<0, 6> */ - private int $week; + private Calendar\Day $week; /** @var int<0, 365> */ private int $ofYear; - /** @var 'Monday'|'Tuesday'|'Wednesday'|'Thursday'|'Friday'|'Saturday'|'Sunday' */ - private string $string; /** * @param int<1, 31> $day @@ -23,15 +22,12 @@ final class Day private function __construct(Year $year, Month $month, int $day) { $this->day = $day; - /** @var int<0, 6> */ - $this->week = (int) \date( + $this->week = Calendar\Day::of((int) \date( 'w', $time = \mktime(0, 0, 0, $month->calendar()->toInt(), $day, $year->toInt()), - ); + )); /** @var int<0, 365> */ $this->ofYear = (int) \date('z', $time); - /** @var 'Monday'|'Tuesday'|'Wednesday'|'Thursday'|'Friday'|'Saturday'|'Sunday' */ - $this->string = \date('l', $time); } /** @@ -45,12 +41,8 @@ public static function of(Year $year, Month $month, int $day): self return new self($year, $month, $day); } - /** - * @return int<0, 6> - */ - public function weekNumber(): int + public function ofWeek(): Calendar\Day { - // todo move to the Day\Week enum return $this->week; } @@ -78,13 +70,4 @@ public function toInt(): int // todo rename to ofMonth return $this->day; } - - /** - * @return 'Monday'|'Tuesday'|'Wednesday'|'Thursday'|'Friday'|'Saturday'|'Sunday' - */ - public function toString(): string - { - // todo transform into an enum - return $this->string; - } } diff --git a/tests/PointInTime/DayTest.php b/tests/PointInTime/DayTest.php index 4fdf99e..2fccc71 100644 --- a/tests/PointInTime/DayTest.php +++ b/tests/PointInTime/DayTest.php @@ -24,10 +24,10 @@ public function testInterface() 5, ); - $this->assertSame(3, $day->weekNumber()); + $this->assertSame(3, $day->ofWeek()->toInt()); $this->assertSame(278, $day->ofYear()); $this->assertSame(24, $day->numberOfHours()); $this->assertSame(5, $day->toInt()); - $this->assertSame('Wednesday', $day->toString()); + $this->assertSame('wednesday', $day->ofWeek()->name); } } From d6eb1a0ba52a24fa89729a92c1fa255ba483f834 Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Sat, 23 Nov 2024 12:54:02 +0100 Subject: [PATCH 33/85] rename Month::calendar() to ::ofYear() for consistency with Day class --- CHANGELOG.md | 2 +- src/Move/EndOfYear.php | 2 +- src/Move/StartOfYear.php | 2 +- src/PointInTime/Day.php | 2 +- src/PointInTime/Month.php | 2 +- tests/NowTest.php | 4 ++-- tests/PointInTime/MonthTest.php | 4 ++-- tests/PointInTimeTest.php | 12 ++++++------ 8 files changed, 15 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0c6d809..c3ee841 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ - `Innmind\TimeContinuum\Clock::switch()` - `Innmind\TimeContinuum\Calendar\Month` -- `Innmind\TimeContinuum\PointInTime\Month::calendar()` +- `Innmind\TimeContinuum\PointInTime\Month::ofYear()` - `Innmind\TimeContinuum\Calendar\Day` - `Innmind\TimeContinuum\PointInTime\Day::ofWeek()` diff --git a/src/Move/EndOfYear.php b/src/Move/EndOfYear.php index 2a52dd4..a2b5281 100644 --- a/src/Move/EndOfYear.php +++ b/src/Move/EndOfYear.php @@ -13,7 +13,7 @@ final class EndOfYear public function __invoke(PointInTime $point): PointInTime { $point = (new StartOfMonth)($point)->goForward( - Month::of(12 - $point->month()->calendar()->toInt()), + Month::of(12 - $point->month()->ofYear()->toInt()), ); return (new EndOfMonth)($point); diff --git a/src/Move/StartOfYear.php b/src/Move/StartOfYear.php index d946786..99bc572 100644 --- a/src/Move/StartOfYear.php +++ b/src/Move/StartOfYear.php @@ -13,7 +13,7 @@ final class StartOfYear public function __invoke(PointInTime $point): PointInTime { return (new StartOfMonth)($point)->goBack( - Month::of($point->month()->calendar()->toInt() - 1), + Month::of($point->month()->ofYear()->toInt() - 1), ); } } diff --git a/src/PointInTime/Day.php b/src/PointInTime/Day.php index 7399691..97099d2 100644 --- a/src/PointInTime/Day.php +++ b/src/PointInTime/Day.php @@ -24,7 +24,7 @@ private function __construct(Year $year, Month $month, int $day) $this->day = $day; $this->week = Calendar\Day::of((int) \date( 'w', - $time = \mktime(0, 0, 0, $month->calendar()->toInt(), $day, $year->toInt()), + $time = \mktime(0, 0, 0, $month->ofYear()->toInt(), $day, $year->toInt()), )); /** @var int<0, 365> */ $this->ofYear = (int) \date('z', $time); diff --git a/src/PointInTime/Month.php b/src/PointInTime/Month.php index ef93c62..997e365 100644 --- a/src/PointInTime/Month.php +++ b/src/PointInTime/Month.php @@ -41,7 +41,7 @@ public function numberOfDays(): int return $this->days; } - public function calendar(): Calendar\Month + public function ofYear(): Calendar\Month { return $this->month; } diff --git a/tests/NowTest.php b/tests/NowTest.php index 403021e..9a8041c 100644 --- a/tests/NowTest.php +++ b/tests/NowTest.php @@ -39,7 +39,7 @@ public function testInterface() $this->assertInstanceOf(Millisecond::class, $point->millisecond()); $this->assertInstanceOf(Offset::class, $point->offset()); $this->assertSame((int) \date('Y', $timestamp), $point->year()->toInt()); - $this->assertSame((int) \date('m', $timestamp), $point->month()->calendar()->toInt()); + $this->assertSame((int) \date('m', $timestamp), $point->month()->ofYear()->toInt()); $this->assertSame((int) \date('d', $timestamp), $point->day()->toInt()); $this->assertSame((int) \date('H', $timestamp), $point->hour()->toInt()); $this->assertSame((int) \date('i', $timestamp), $point->minute()->toInt()); @@ -83,7 +83,7 @@ public function testChangeOffset() $this->assertNotSame($point->millisecond(), $point2->millisecond()); $this->assertSame($point->milliseconds(), $point2->milliseconds()); $this->assertSame((int) $now->format('Y'), $point2->year()->toInt()); - $this->assertSame((int) $now->format('m'), $point2->month()->calendar()->toInt()); + $this->assertSame((int) $now->format('m'), $point2->month()->ofYear()->toInt()); $this->assertSame((int) $now->format('d'), $point2->day()->toInt()); $this->assertSame((int) $now->format('H'), $point2->hour()->toInt()); $this->assertSame((int) $now->format('i'), $point2->minute()->toInt()); diff --git a/tests/PointInTime/MonthTest.php b/tests/PointInTime/MonthTest.php index 3850066..ab01c89 100644 --- a/tests/PointInTime/MonthTest.php +++ b/tests/PointInTime/MonthTest.php @@ -17,7 +17,7 @@ public function testInterface() $month = Month::of(Year::of(2016), Calendar\Month::of(10)); $this->assertSame(31, $month->numberOfDays()); - $this->assertSame(10, $month->calendar()->toInt()); - $this->assertSame('october', $month->calendar()->name); + $this->assertSame(10, $month->ofYear()->toInt()); + $this->assertSame('october', $month->ofYear()->name); } } diff --git a/tests/PointInTimeTest.php b/tests/PointInTimeTest.php index a896914..b4e5d11 100644 --- a/tests/PointInTimeTest.php +++ b/tests/PointInTimeTest.php @@ -35,7 +35,7 @@ public function testInterface() $this->assertInstanceOf(Millisecond::class, $point->millisecond()); $this->assertInstanceOf(Offset::class, $point->offset()); $this->assertSame(2016, $point->year()->toInt()); - $this->assertSame(10, $point->month()->calendar()->toInt()); + $this->assertSame(10, $point->month()->ofYear()->toInt()); $this->assertSame(5, $point->day()->toInt()); $this->assertSame(8, $point->hour()->toInt()); $this->assertSame(1, $point->minute()->toInt()); @@ -82,7 +82,7 @@ public function testChangeOffset() $this->assertNotSame($point->millisecond(), $point2->millisecond()); $this->assertSame($point->milliseconds(), $point2->milliseconds()); $this->assertSame(2016, $point2->year()->toInt()); - $this->assertSame(10, $point2->month()->calendar()->toInt()); + $this->assertSame(10, $point2->month()->ofYear()->toInt()); $this->assertSame(5, $point2->day()->toInt()); $this->assertSame(3, $point2->hour()->toInt()); $this->assertSame(31, $point2->minute()->toInt()); @@ -128,14 +128,14 @@ public function testGoForward() ); $this->assertSame(2016, $point->year()->toInt()); - $this->assertSame(10, $point->month()->calendar()->toInt()); + $this->assertSame(10, $point->month()->ofYear()->toInt()); $this->assertSame(5, $point->day()->toInt()); $this->assertSame(8, $point->hour()->toInt()); $this->assertSame(1, $point->minute()->toInt()); $this->assertSame(30, $point->second()->toInt()); $this->assertSame(123, $point->millisecond()->toInt()); $this->assertSame(2017, $point2->year()->toInt()); - $this->assertSame(11, $point2->month()->calendar()->toInt()); + $this->assertSame(11, $point2->month()->ofYear()->toInt()); $this->assertSame(6, $point2->day()->toInt()); $this->assertSame(9, $point2->hour()->toInt()); $this->assertSame(3, $point2->minute()->toInt()); @@ -151,14 +151,14 @@ public function testGoBack() ); $this->assertSame(2016, $point->year()->toInt()); - $this->assertSame(10, $point->month()->calendar()->toInt()); + $this->assertSame(10, $point->month()->ofYear()->toInt()); $this->assertSame(5, $point->day()->toInt()); $this->assertSame(8, $point->hour()->toInt()); $this->assertSame(1, $point->minute()->toInt()); $this->assertSame(30, $point->second()->toInt()); $this->assertSame(123, $point->millisecond()->toInt()); $this->assertSame(2015, $point2->year()->toInt()); - $this->assertSame(9, $point2->month()->calendar()->toInt()); + $this->assertSame(9, $point2->month()->ofYear()->toInt()); $this->assertSame(4, $point2->day()->toInt()); $this->assertSame(6, $point2->hour()->toInt()); $this->assertSame(59, $point2->minute()->toInt()); From 9596bbf2f3079b60f5af84c1c5da30f6a61f719b Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Sat, 23 Nov 2024 12:58:32 +0100 Subject: [PATCH 34/85] rename Day::toInt() to ::ofMonth() --- CHANGELOG.md | 1 + src/Move/EndOfMonth.php | 2 +- src/Move/Month.php | 4 ++-- src/Move/StartOfMonth.php | 2 +- src/PointInTime/Day.php | 3 +-- tests/NowTest.php | 4 ++-- tests/PointInTime/DayTest.php | 2 +- tests/PointInTimeTest.php | 12 ++++++------ 8 files changed, 15 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c3ee841..03df0c4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,7 @@ - `Innmind\TimeContinuum\Timezone` has been renamed `Innmind\TimeContinuum\Offset` - `Innmind\TimeContinuum\PointInTime::changeTimezone()` has been renamed `Innmind\TimeContinuum\PointInTime::changeOffset()` - `Innmind\TimeContinuum\PointInTime::timezone()` has been renamed `Innmind\TimeContinuum\PointInTime::offset()` +- `Innmind\TimeContinuum\PointInTime\Day::toInt()` has been renamed `Innmind\TimeContinuum\PointInTime\Day::ofMonth()` ### Removed diff --git a/src/Move/EndOfMonth.php b/src/Move/EndOfMonth.php index c58f7b1..6d54c64 100644 --- a/src/Move/EndOfMonth.php +++ b/src/Move/EndOfMonth.php @@ -14,7 +14,7 @@ public function __invoke(PointInTime $point): PointInTime { /** @psalm-suppress InvalidArgument The negative values can only happen when working with 2 different points in time */ return (new EndOfDay)($point)->goForward( - Day::of($point->month()->numberOfDays() - $point->day()->toInt()), + Day::of($point->month()->numberOfDays() - $point->day()->ofMonth()), ); } } diff --git a/src/Move/Month.php b/src/Move/Month.php index d124aed..dd61750 100644 --- a/src/Move/Month.php +++ b/src/Move/Month.php @@ -35,14 +35,14 @@ public function __invoke(PointInTime $point): PointInTime ->add(Millisecond::of($point->millisecond()->toInt())), ); - if ($newPoint->month()->numberOfDays() < $point->day()->toInt()) { + if ($newPoint->month()->numberOfDays() < $point->day()->ofMonth()) { return $newPoint->goForward( Day::of($newPoint->month()->numberOfDays() - 1), ); } return $newPoint->goForward( - Day::of($point->day()->toInt() - 1), + Day::of($point->day()->ofMonth() - 1), ); } diff --git a/src/Move/StartOfMonth.php b/src/Move/StartOfMonth.php index 6ca5978..86f99da 100644 --- a/src/Move/StartOfMonth.php +++ b/src/Move/StartOfMonth.php @@ -13,7 +13,7 @@ final class StartOfMonth public function __invoke(PointInTime $point): PointInTime { return (new StartOfDay)($point)->goBack( - Day::of($point->day()->toInt() - 1), + Day::of($point->day()->ofMonth() - 1), ); } } diff --git a/src/PointInTime/Day.php b/src/PointInTime/Day.php index 97099d2..7dfeaff 100644 --- a/src/PointInTime/Day.php +++ b/src/PointInTime/Day.php @@ -65,9 +65,8 @@ public function numberOfHours(): int /** * @return int<1, 31> */ - public function toInt(): int + public function ofMonth(): int { - // todo rename to ofMonth return $this->day; } } diff --git a/tests/NowTest.php b/tests/NowTest.php index 9a8041c..8f6497d 100644 --- a/tests/NowTest.php +++ b/tests/NowTest.php @@ -40,7 +40,7 @@ public function testInterface() $this->assertInstanceOf(Offset::class, $point->offset()); $this->assertSame((int) \date('Y', $timestamp), $point->year()->toInt()); $this->assertSame((int) \date('m', $timestamp), $point->month()->ofYear()->toInt()); - $this->assertSame((int) \date('d', $timestamp), $point->day()->toInt()); + $this->assertSame((int) \date('d', $timestamp), $point->day()->ofMonth()); $this->assertSame((int) \date('H', $timestamp), $point->hour()->toInt()); $this->assertSame((int) \date('i', $timestamp), $point->minute()->toInt()); $this->assertSame((int) \date('s', $timestamp), $point->second()->toInt()); @@ -84,7 +84,7 @@ public function testChangeOffset() $this->assertSame($point->milliseconds(), $point2->milliseconds()); $this->assertSame((int) $now->format('Y'), $point2->year()->toInt()); $this->assertSame((int) $now->format('m'), $point2->month()->ofYear()->toInt()); - $this->assertSame((int) $now->format('d'), $point2->day()->toInt()); + $this->assertSame((int) $now->format('d'), $point2->day()->ofMonth()); $this->assertSame((int) $now->format('H'), $point2->hour()->toInt()); $this->assertSame((int) $now->format('i'), $point2->minute()->toInt()); $this->assertSame((int) $now->format('s'), $point2->second()->toInt()); diff --git a/tests/PointInTime/DayTest.php b/tests/PointInTime/DayTest.php index 2fccc71..61aa441 100644 --- a/tests/PointInTime/DayTest.php +++ b/tests/PointInTime/DayTest.php @@ -27,7 +27,7 @@ public function testInterface() $this->assertSame(3, $day->ofWeek()->toInt()); $this->assertSame(278, $day->ofYear()); $this->assertSame(24, $day->numberOfHours()); - $this->assertSame(5, $day->toInt()); + $this->assertSame(5, $day->ofMonth()); $this->assertSame('wednesday', $day->ofWeek()->name); } } diff --git a/tests/PointInTimeTest.php b/tests/PointInTimeTest.php index b4e5d11..b292a22 100644 --- a/tests/PointInTimeTest.php +++ b/tests/PointInTimeTest.php @@ -36,7 +36,7 @@ public function testInterface() $this->assertInstanceOf(Offset::class, $point->offset()); $this->assertSame(2016, $point->year()->toInt()); $this->assertSame(10, $point->month()->ofYear()->toInt()); - $this->assertSame(5, $point->day()->toInt()); + $this->assertSame(5, $point->day()->ofMonth()); $this->assertSame(8, $point->hour()->toInt()); $this->assertSame(1, $point->minute()->toInt()); $this->assertSame(30, $point->second()->toInt()); @@ -83,7 +83,7 @@ public function testChangeOffset() $this->assertSame($point->milliseconds(), $point2->milliseconds()); $this->assertSame(2016, $point2->year()->toInt()); $this->assertSame(10, $point2->month()->ofYear()->toInt()); - $this->assertSame(5, $point2->day()->toInt()); + $this->assertSame(5, $point2->day()->ofMonth()); $this->assertSame(3, $point2->hour()->toInt()); $this->assertSame(31, $point2->minute()->toInt()); $this->assertSame(30, $point2->second()->toInt()); @@ -129,14 +129,14 @@ public function testGoForward() $this->assertSame(2016, $point->year()->toInt()); $this->assertSame(10, $point->month()->ofYear()->toInt()); - $this->assertSame(5, $point->day()->toInt()); + $this->assertSame(5, $point->day()->ofMonth()); $this->assertSame(8, $point->hour()->toInt()); $this->assertSame(1, $point->minute()->toInt()); $this->assertSame(30, $point->second()->toInt()); $this->assertSame(123, $point->millisecond()->toInt()); $this->assertSame(2017, $point2->year()->toInt()); $this->assertSame(11, $point2->month()->ofYear()->toInt()); - $this->assertSame(6, $point2->day()->toInt()); + $this->assertSame(6, $point2->day()->ofMonth()); $this->assertSame(9, $point2->hour()->toInt()); $this->assertSame(3, $point2->minute()->toInt()); $this->assertSame(1, $point2->second()->toInt()); @@ -152,14 +152,14 @@ public function testGoBack() $this->assertSame(2016, $point->year()->toInt()); $this->assertSame(10, $point->month()->ofYear()->toInt()); - $this->assertSame(5, $point->day()->toInt()); + $this->assertSame(5, $point->day()->ofMonth()); $this->assertSame(8, $point->hour()->toInt()); $this->assertSame(1, $point->minute()->toInt()); $this->assertSame(30, $point->second()->toInt()); $this->assertSame(123, $point->millisecond()->toInt()); $this->assertSame(2015, $point2->year()->toInt()); $this->assertSame(9, $point2->month()->ofYear()->toInt()); - $this->assertSame(4, $point2->day()->toInt()); + $this->assertSame(4, $point2->day()->ofMonth()); $this->assertSame(6, $point2->hour()->toInt()); $this->assertSame(59, $point2->minute()->toInt()); $this->assertSame(59, $point2->second()->toInt()); From a4ba1b764418c694164e41fa75c458a36453c9a1 Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Sat, 23 Nov 2024 13:01:19 +0100 Subject: [PATCH 35/85] update readme --- README.md | 54 +++++++++++++++++++++++++++--------------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index ff7d515..2847f95 100644 --- a/README.md +++ b/README.md @@ -6,8 +6,6 @@ This library allows you to handle time down to the millisecond. The point was to also be explicit for every component of dates, this is why every php _magic strings_ have been converted into objects. -It also provides interfaces so you can make mocks for your unit tests, of course it's only helpful if you use an implementation of `Clock` in your code instead of directly instanciating dates. - **All objects are immutable.** ## Installation @@ -20,14 +18,14 @@ composer install innmind/time-continuum ```php use Innmind\TimeContinuum\{ - Earth\Clock, + Clock, PointInTime, }; use Innmind\Immutable\Maybe; -$clock = new Clock; +$clock = Clock::live(); $now = $clock->now(); // return an instance of PointInTime -echo $now->toString(); //2016-10-11T12:17:30+02:00 +echo $now->toString(); // 2016-10-11T12:17:30+02:00 $epoch = $clock->at('1970-01-01T00:00:00.000000Z'); // Maybe ``` @@ -41,36 +39,36 @@ The method `at()` accepts any string that is allowed by `\DateTimeImmutable`. Say you want to work only with `Europe/Paris` timezone in your app but don't know if every environment will have the same configuration (like between your machine and the CI), you can enforce the timezone you'll work with like so: ```php -use Innmind\TimeContinuum\Earth\{ - Clock, - Timezone\Europe\Paris, -}; +use Innmind\TimeContinuum\Clock; -$clock = new Clock(new Paris); +$clock = Clock::live()->switch( + static fn($timezones) => $timezones->europe()->paris(), +); -echo $clock->now()->timezone()->toString(); //+02:00 (when DST applied), otherwise +01:00 +echo $clock->now()->offset()->toString(); //+02:00 (when DST applied), otherwise +01:00 ``` -And if you're given a point in time via a method parameter but don't know its timezone, you can change it via: +And if you're given a point in time via a method parameter but don't know its offset, you can change it via: ```php use Innmind\TimeContinuum\{ PointInTime, - Earth\Timezone\Europe\Paris + Offset }; function foo(PointInTime $point) { - $point = $point->changeTimezone(new Paris); + $point = $point->changeOffset(Offset::of(1, 0)); } ``` -**Note**: Don't forget to reassign into a variable as all objects are immutable. +> [!NOTE] +> Don't forget to reassign into a variable as all objects are immutable. ### Time travel ```php -use Innmind\TimeContinuum\Earth\Period\{ +use Innmind\TimeContinuum\Period\{ Year, Month, Minute, @@ -80,27 +78,28 @@ use Innmind\TimeContinuum\Earth\Period\{ $point = $clock ->now() ->goBack( - (new Year(1)) - ->add(new Month(2)) - ->add(new Minute(24)) - ->add(new Millisecond(500)) + Year::of(1) + ->add(Month::of(2)) + ->add(Minute::of(24)) + ->add(Millisecond::of(500)), ); ``` Here we go back 1 year, 2 months, 24 minutes and half a second back in time. The same objects are used to `goForward()`. -**Note**: Objects from the `Innmind\TimeContinuum\Earth\Period` namespace will convert values if you go out of the component boundary. For example, `new Millisecond(121500)` will result in this: `milliseconds() === 500`, `seconds() === 1` and `minutes() === 2`. +> [!NOTE] +> Objects from the `Innmind\TimeContinuum\Period` namespace will convert values if you go out of the component boundary. For example, `Millisecond::of(121500)` will result in this: `milliseconds() === 500`, `seconds() === 1` and `minutes() === 2`. To ease some common operations this lib contains helpers such as `EndOfDay` to be used like this: ```php -use Innmind\TimeContinuum\Earth\Move\EndOfDay; +use Innmind\TimeContinuum\Move\EndOfDay; $endOfDay = new EndOfDay; $endOfDay($clock->now()); // will return 2018-04-28 23:59:59.999 ``` -Check all the [helpers](src/Earth/Move/) to help you travel in time. +Check all the [helpers](src/Move/) to help you travel in time. ### Elapsed period @@ -108,19 +107,20 @@ Sometimes we want to know how long a task takes in our code and we end up using ```php $start = $clock->now(); -//run some code... +// run some code... $duration = $clock ->now() ->elapsedSince($start) ->milliseconds(); ``` -And if you want a more comprehensible duration if it's above the second, you can reuse [`new Millisecond($duration)`](src/Earth/Period/Millisecond.php). +And if you want a more comprehensible duration if it's above the second, you can reuse [`Millisecond::of($duration)`](src/Period/Millisecond.php). ### Date formatting -In order to format a `PointInTime` you need to create a class implementing [`Format`](src/Format.php). This is done so you can make sure a date format will always have a name (and prevent you from putting _magic strings_ everywhere in your codebase). +In order to format a `PointInTime` you need to specify it as a [`Format`](src/Format.php) instance. This is done so you can make sure a date format will always have a name (and prevent you from putting _magic strings_ everywhere in your codebase). All formats described as `\DateTime` constants are already available as formats here. -**Important**: here `ISO8601` truely respect the ISO format as opposed to [`\DateTime::ISO8601`](http://us1.php.net/manual/en/class.datetime.php#datetime.constants.iso8601). +> [!IMPORTANT] +> here `ISO8601` truely respect the ISO format as opposed to [`\DateTime::ISO8601`](http://us1.php.net/manual/en/class.datetime.php#datetime.constants.iso8601). From 775c15097fde506d41e2a2c07602e4beb06748dd Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Sat, 23 Nov 2024 13:10:34 +0100 Subject: [PATCH 36/85] show timezone name to debug when there is a collision --- tests/ClockTest.php | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/tests/ClockTest.php b/tests/ClockTest.php index bb14d66..b7d963d 100644 --- a/tests/ClockTest.php +++ b/tests/ClockTest.php @@ -101,20 +101,32 @@ public function testFrozenClockDoesntChangeItsTimezone() public function testLoggerUseNewTimezone() { + $gen = static function($zones) { + $zones = \iterator_to_array($zones); + + return Set\Elements::of( + ...\array_map( + static fn($name, $switch) => [$name, $switch[0]], + \array_keys($zones), + \array_values($zones), + ), + ); + }; + $this ->forAll( - Set\Elements::of(...\array_values(\iterator_to_array(self::america()))) - ->map(static fn($switch) => $switch[0]), + $gen(self::america()), Set\Either::any( - Set\Elements::of(...\array_values(\iterator_to_array(self::africa()))), - Set\Elements::of(...\array_values(\iterator_to_array(self::europe()))), - Set\Elements::of(...\array_values(\iterator_to_array(self::indian()))), - Set\Elements::of(...\array_values(\iterator_to_array(self::asia()))), - Set\Elements::of(...\array_values(\iterator_to_array(self::australia()))), - ) - ->map(static fn($switch) => $switch[0]), + $gen(self::africa()), + $gen(self::europe()), + $gen(self::indian()), + $gen(self::asia()), + $gen(self::australia()), + ), ) ->then(function($america, $other) { + $america = $america[1]; + $other = $other[1]; $gather = new class implements LoggerInterface { use LoggerTrait; @@ -142,6 +154,7 @@ public function log($level, string|\Stringable $message, array $context = []): v $this->assertNotSame( $gather->logs[0], $gather->logs[1], + $gather->logs[0]['point'], ); }); } From 0e966dd67cb38728c85d706f0daccca6c329b2b5 Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Sat, 23 Nov 2024 13:14:00 +0100 Subject: [PATCH 37/85] avoid collision with danmarkshavn in tests --- tests/ClockTest.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/ClockTest.php b/tests/ClockTest.php index b7d963d..5bee2d4 100644 --- a/tests/ClockTest.php +++ b/tests/ClockTest.php @@ -115,7 +115,10 @@ public function testLoggerUseNewTimezone() $this ->forAll( - $gen(self::america()), + $gen(self::america())->filter( + // timezone that collides with other continents + static fn($pair) => $pair[0] !== 'danmarkshavn', + ), Set\Either::any( $gen(self::africa()), $gen(self::europe()), From bf641140b2cf828de2fe006db975216dcc423d2c Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Sat, 23 Nov 2024 13:20:49 +0100 Subject: [PATCH 38/85] delete useless code --- src/Period/Day.php | 4 ---- src/Period/Hour.php | 4 ---- src/Period/Millisecond.php | 4 ---- src/Period/Minute.php | 4 ---- src/Period/Month.php | 4 ---- src/Period/Second.php | 4 ---- src/Period/Year.php | 4 ---- 7 files changed, 28 deletions(-) diff --git a/src/Period/Day.php b/src/Period/Day.php index d3e26a3..6f62519 100644 --- a/src/Period/Day.php +++ b/src/Period/Day.php @@ -7,10 +7,6 @@ final class Day { - private function __construct() - { - } - /** * @psalm-pure * diff --git a/src/Period/Hour.php b/src/Period/Hour.php index 56d4853..d4bfeef 100644 --- a/src/Period/Hour.php +++ b/src/Period/Hour.php @@ -7,10 +7,6 @@ final class Hour { - private function __construct() - { - } - /** * @psalm-pure * diff --git a/src/Period/Millisecond.php b/src/Period/Millisecond.php index 6ce7a97..8fb858a 100644 --- a/src/Period/Millisecond.php +++ b/src/Period/Millisecond.php @@ -7,10 +7,6 @@ final class Millisecond { - private function __construct() - { - } - /** * @psalm-pure * diff --git a/src/Period/Minute.php b/src/Period/Minute.php index 576e3f1..319bc7c 100644 --- a/src/Period/Minute.php +++ b/src/Period/Minute.php @@ -7,10 +7,6 @@ final class Minute { - private function __construct() - { - } - /** * @psalm-pure * diff --git a/src/Period/Month.php b/src/Period/Month.php index 689c796..a040e27 100644 --- a/src/Period/Month.php +++ b/src/Period/Month.php @@ -7,10 +7,6 @@ final class Month { - private function __construct() - { - } - /** * @psalm-pure * diff --git a/src/Period/Second.php b/src/Period/Second.php index 7c241f4..c7b06fd 100644 --- a/src/Period/Second.php +++ b/src/Period/Second.php @@ -7,10 +7,6 @@ final class Second { - private function __construct() - { - } - /** * @psalm-pure * diff --git a/src/Period/Year.php b/src/Period/Year.php index ef68424..a537392 100644 --- a/src/Period/Year.php +++ b/src/Period/Year.php @@ -7,10 +7,6 @@ final class Year { - private function __construct() - { - } - /** * @psalm-pure * From 670a79dcb32e430cf946604241e852645eab4ffb Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Sat, 23 Nov 2024 13:22:03 +0100 Subject: [PATCH 39/85] make sure all default formats are valid --- tests/ClockTest.php | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/tests/ClockTest.php b/tests/ClockTest.php index 5bee2d4..2081cf7 100644 --- a/tests/ClockTest.php +++ b/tests/ClockTest.php @@ -162,6 +162,34 @@ public function log($level, string|\Stringable $message, array $context = []): v }); } + #[DataProvider('formats')] + public function testAllDefaultFormatsAreValid($format) + { + $clock = Clock::live(); + $now = $clock->now(); + + $this->assertSame( + $now->format($format), + $clock->at($now->format($format), $format)->match( + static fn($point) => $point->format($format), + static fn() => null, + ), + ); + } + + public static function formats() + { + yield [Format::cookie()]; + yield [Format::iso8601()]; + yield [Format::rfc1036()]; + yield [Format::rfc1123()]; + yield [Format::rfc2822()]; + yield [Format::rfc822()]; + yield [Format::rfc850()]; + yield [Format::rss()]; + yield [Format::w3c()]; + } + public static function zones() { yield from self::africa(); From cfb21ab2716bd57e6a76ebb831a68150adea3182 Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Sat, 23 Nov 2024 13:24:23 +0100 Subject: [PATCH 40/85] make sure all timezones are in bounds --- tests/ClockTest.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/ClockTest.php b/tests/ClockTest.php index 2081cf7..1561a15 100644 --- a/tests/ClockTest.php +++ b/tests/ClockTest.php @@ -47,6 +47,20 @@ public function testSwitchTimezone($switch) $this->assertIsString($clock->now()->format(Format::iso8601())); } + #[DataProvider('zones')] + public function testTimezoneAreAlwaysInBounds($switch) + { + $offset = Clock::live() + ->switch($switch) + ->now() + ->offset(); + + $this->assertGreaterThanOrEqual(-12, $offset->hours()); + $this->assertLessThanOrEqual(14, $offset->hours()); + $this->assertGreaterThanOrEqual(0, $offset->minutes()); + $this->assertLessThanOrEqual(59, $offset->minutes()); + } + public function testTimezoneDifferences() { $this From 37fe06d319f6f80c334da9a9c8c55eed00770ef4 Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Sat, 23 Nov 2024 13:30:32 +0100 Subject: [PATCH 41/85] inline formats for code coverage --- tests/ClockTest.php | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/tests/ClockTest.php b/tests/ClockTest.php index 1561a15..d481d18 100644 --- a/tests/ClockTest.php +++ b/tests/ClockTest.php @@ -176,32 +176,32 @@ public function log($level, string|\Stringable $message, array $context = []): v }); } - #[DataProvider('formats')] - public function testAllDefaultFormatsAreValid($format) + public function testAllDefaultFormatsAreValid() { $clock = Clock::live(); $now = $clock->now(); - $this->assertSame( - $now->format($format), - $clock->at($now->format($format), $format)->match( - static fn($point) => $point->format($format), - static fn() => null, - ), - ); - } - - public static function formats() - { - yield [Format::cookie()]; - yield [Format::iso8601()]; - yield [Format::rfc1036()]; - yield [Format::rfc1123()]; - yield [Format::rfc2822()]; - yield [Format::rfc822()]; - yield [Format::rfc850()]; - yield [Format::rss()]; - yield [Format::w3c()]; + $formats = [ + Format::cookie(), + Format::iso8601(), + Format::rfc1036(), + Format::rfc1123(), + Format::rfc2822(), + Format::rfc822(), + Format::rfc850(), + Format::rss(), + Format::w3c(), + ]; + + foreach ($formats as $format) { + $this->assertSame( + $now->format($format), + $clock->at($now->format($format), $format)->match( + static fn($point) => $point->format($format), + static fn() => null, + ), + ); + } } public static function zones() From 75f07a081262ea61e79ae69b377b86468dbd79cf Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Sat, 23 Nov 2024 14:01:14 +0100 Subject: [PATCH 42/85] fix generating colliding timezones --- tests/ClockTest.php | 59 ++++++++++++++++++++++++--------------------- 1 file changed, 32 insertions(+), 27 deletions(-) diff --git a/tests/ClockTest.php b/tests/ClockTest.php index d481d18..7aec384 100644 --- a/tests/ClockTest.php +++ b/tests/ClockTest.php @@ -65,18 +65,22 @@ public function testTimezoneDifferences() { $this ->forAll( - Set\Elements::of(...\array_values(\iterator_to_array(self::america()))) - ->map(static fn($switch) => $switch[0]), + self::genToSet(self::america())->filter( + // timezone that collides with other continents + static fn($pair) => $pair[0] !== 'danmarkshavn', + ), Set\Either::any( - Set\Elements::of(...\array_values(\iterator_to_array(self::africa()))), - Set\Elements::of(...\array_values(\iterator_to_array(self::europe()))), - Set\Elements::of(...\array_values(\iterator_to_array(self::indian()))), - Set\Elements::of(...\array_values(\iterator_to_array(self::asia()))), - Set\Elements::of(...\array_values(\iterator_to_array(self::australia()))), - ) - ->map(static fn($switch) => $switch[0]), + self::genToSet(self::africa()), + self::genToSet(self::europe()), + self::genToSet(self::indian()), + self::genToSet(self::asia()), + self::genToSet(self::australia()), + ), ) ->then(function($america, $other) { + $america = $america[1]; + $other = $other[1]; + $america = Clock::live()->switch($america); $other = Clock::live()->switch($other); @@ -115,30 +119,18 @@ public function testFrozenClockDoesntChangeItsTimezone() public function testLoggerUseNewTimezone() { - $gen = static function($zones) { - $zones = \iterator_to_array($zones); - - return Set\Elements::of( - ...\array_map( - static fn($name, $switch) => [$name, $switch[0]], - \array_keys($zones), - \array_values($zones), - ), - ); - }; - $this ->forAll( - $gen(self::america())->filter( + self::genToSet(self::america())->filter( // timezone that collides with other continents static fn($pair) => $pair[0] !== 'danmarkshavn', ), Set\Either::any( - $gen(self::africa()), - $gen(self::europe()), - $gen(self::indian()), - $gen(self::asia()), - $gen(self::australia()), + self::genToSet(self::africa()), + self::genToSet(self::europe()), + self::genToSet(self::indian()), + self::genToSet(self::asia()), + self::genToSet(self::australia()), ), ) ->then(function($america, $other) { @@ -204,6 +196,19 @@ public function testAllDefaultFormatsAreValid() } } + public static function genToSet($zones): Set + { + $zones = \iterator_to_array($zones); + + return Set\Elements::of( + ...\array_map( + static fn($name, $switch) => [$name, $switch[0]], + \array_keys($zones), + \array_values($zones), + ), + ); + } + public static function zones() { yield from self::africa(); From bb28fa03fce59fd3f5fd255621f21efd8a1b75c2 Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Sat, 23 Nov 2024 14:31:00 +0100 Subject: [PATCH 43/85] use anonymous classes instead of mocks --- tests/Clock/LoggerTest.php | 102 +++++++++++++++++++++++++------------ 1 file changed, 69 insertions(+), 33 deletions(-) diff --git a/tests/Clock/LoggerTest.php b/tests/Clock/LoggerTest.php index ecbca3d..b8600a9 100644 --- a/tests/Clock/LoggerTest.php +++ b/tests/Clock/LoggerTest.php @@ -8,7 +8,10 @@ Format, }; use Fixtures\Innmind\TimeContinuum\PointInTime; -use Psr\Log\LoggerInterface; +use Psr\Log\{ + LoggerInterface, + LoggerTrait, +}; use PHPUnit\Framework\TestCase; use Innmind\BlackBox\{ PHPUnit\BlackBox, @@ -25,18 +28,29 @@ public function testGeneratedNowIsLogged() ->forAll(PointInTime::any()) ->then(function($now) { $concrete = Clock::frozen($now); - $logger = $this->createMock(LoggerInterface::class); - $logger - ->expects($this->once()) - ->method('debug') - ->with( - 'Current time is {point}', - ['point' => $now->format(Format::iso8601())], - ); + $logger = new class implements LoggerInterface { + use LoggerTrait; + + public array $logs = []; + + public function log($level, string|\Stringable $message, array $context = []): void + { + $this->logs[] = [$level, $message, $context]; + } + }; $clock = Clock::logger($concrete, $logger); $this->assertSame($now, $clock->now()); + $this->assertCount(1, $logger->logs); + $this->assertSame( + [ + 'debug', + 'Current time is {point}', + ['point' => $now->format(Format::iso8601())], + ], + $logger->logs[0], + ); }); } @@ -48,18 +62,16 @@ public function testAskedDateIsLogged() ) ->then(function($point) { $concrete = Clock::frozen($point); - $logger = $this->createMock(LoggerInterface::class); - $logger - ->expects($this->once()) - ->method('debug') - ->with( - 'Asked time {date} ({format}) resolved to {point}', - [ - 'date' => $point->toString(), - 'format' => 'unknown', - 'point' => $point->format(Format::iso8601()), - ], - ); + $logger = new class implements LoggerInterface { + use LoggerTrait; + + public array $logs = []; + + public function log($level, string|\Stringable $message, array $context = []): void + { + $this->logs[] = [$level, $message, $context]; + } + }; $clock = Clock::logger($concrete, $logger); @@ -70,6 +82,19 @@ public function testAskedDateIsLogged() static fn() => null, ), ); + $this->assertCount(1, $logger->logs); + $this->assertSame( + [ + 'debug', + 'Asked time {date} ({format}) resolved to {point}', + [ + 'date' => $point->toString(), + 'format' => 'unknown', + 'point' => $point->format(Format::iso8601()), + ], + ], + $logger->logs[0], + ); }); } @@ -94,18 +119,16 @@ public function testAskedDateWithSpecificFormatIsLogged() ) ->then(function($point, $format) { $concrete = Clock::frozen($point); - $logger = $this->createMock(LoggerInterface::class); - $logger - ->expects($this->once()) - ->method('debug') - ->with( - 'Asked time {date} ({format}) resolved to {point}', - [ - 'date' => $point->format($format), - 'format' => $format->toString(), - 'point' => $point->format(Format::iso8601()), - ], - ); + $logger = new class implements LoggerInterface { + use LoggerTrait; + + public array $logs = []; + + public function log($level, string|\Stringable $message, array $context = []): void + { + $this->logs[] = [$level, $message, $context]; + } + }; $clock = Clock::logger($concrete, $logger); @@ -116,6 +139,19 @@ public function testAskedDateWithSpecificFormatIsLogged() static fn() => null, ), ); + $this->assertCount(1, $logger->logs); + $this->assertSame( + [ + 'debug', + 'Asked time {date} ({format}) resolved to {point}', + [ + 'date' => $point->format($format), + 'format' => $format->toString(), + 'point' => $point->format(Format::iso8601()), + ], + ], + $logger->logs[0], + ); }); } } From 324e3036e67821bb8e963f0218bb1736212d38fb Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Sat, 23 Nov 2024 14:32:48 +0100 Subject: [PATCH 44/85] run tests via blackbox --- .gitattributes | 2 +- .github/workflows/ci.yml | 8 ++++--- .gitignore | 1 - blackbox.php | 27 ++++++++++++++++++++++++ composer.json | 1 - phpunit.xml.dist | 22 ------------------- tests/Clock/FrozenTest.php | 6 ++++-- tests/Clock/LiveTest.php | 2 +- tests/Clock/LoggerTest.php | 2 +- tests/ClockTest.php | 6 ++---- tests/ElapsedPeriodTest.php | 2 +- tests/Fixtures/PeriodTest.php | 2 +- tests/Fixtures/PointInTimeTest.php | 19 ++++++++--------- tests/FormatTest.php | 6 ++---- tests/Move/EndOfDayTest.php | 7 +++--- tests/Move/EndOfMonthTest.php | 7 +++--- tests/Move/EndOfYearTest.php | 7 +++--- tests/Move/MonthTest.php | 7 +++--- tests/Move/StartOfDayTest.php | 7 +++--- tests/Move/StartOfMonthTest.php | 7 +++--- tests/Move/StartOfYearTest.php | 7 +++--- tests/NowTest.php | 2 +- tests/Period.php | 2 +- tests/Period/DayTest.php | 2 +- tests/Period/HourTest.php | 7 +++--- tests/Period/MillisecondTest.php | 7 +++--- tests/Period/MinuteTest.php | 7 +++--- tests/Period/MonthTest.php | 7 +++--- tests/Period/SecondTest.php | 7 +++--- tests/Period/YearTest.php | 2 +- tests/PointInTime/DayTest.php | 2 +- tests/PointInTime/HighResolutionTest.php | 2 +- tests/PointInTime/HourTest.php | 2 +- tests/PointInTime/MillisecondTest.php | 2 +- tests/PointInTime/MinuteTest.php | 2 +- tests/PointInTime/MonthTest.php | 2 +- tests/PointInTime/SecondTest.php | 2 +- tests/PointInTime/YearTest.php | 2 +- tests/PointInTimeTest.php | 2 +- 39 files changed, 103 insertions(+), 113 deletions(-) create mode 100644 blackbox.php delete mode 100644 phpunit.xml.dist diff --git a/.gitattributes b/.gitattributes index 4160131..0685136 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,4 +1,4 @@ /.gitattributes export-ignore /.gitignore export-ignore -/phpunit.xml.dist export-ignore +/blackbox.php export-ignore /tests export-ignore diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8de919d..c16aea5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,7 +10,7 @@ jobs: os: [ubuntu-latest, macOS-latest] php-version: ['8.2', '8.3'] dependencies: ['lowest', 'highest'] - name: 'PHPUnit' + name: 'BlackBox' steps: - name: Checkout uses: actions/checkout@v4 @@ -24,8 +24,10 @@ jobs: uses: "ramsey/composer-install@v3" with: dependency-versions: ${{ matrix.dependencies }} - - name: PHPUnit - run: vendor/bin/phpunit --coverage-clover=coverage.clover + - name: BlackBox + run: php blackbox.php + env: + ENABLE_COVERAGE: 'true' - uses: codecov/codecov-action@v4 with: token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.gitignore b/.gitignore index e96516b..987e2a2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,2 @@ composer.lock vendor -.phpunit.result.cache diff --git a/blackbox.php b/blackbox.php new file mode 100644 index 0000000..30bc4c3 --- /dev/null +++ b/blackbox.php @@ -0,0 +1,27 @@ +when( + \getenv('ENABLE_COVERAGE') !== false, + static fn(Application $app) => $app + ->codeCoverage( + CodeCoverage::of( + __DIR__.'/src/', + __DIR__.'/proofs/', + __DIR__.'/fixtures/', + ) + ->dumpTo('coverage.clover') + ->enableWhen(true), + ) + ) + ->tryToProve(Load::directory(__DIR__.'/tests/')) + ->exit(); diff --git a/composer.json b/composer.json index 13cb8d7..bfa2dff 100644 --- a/composer.json +++ b/composer.json @@ -31,7 +31,6 @@ } }, "require-dev": { - "phpunit/phpunit": "~10.2", "vimeo/psalm": "~5.13", "innmind/black-box": "~5.0", "innmind/coding-standard": "^2.0.1" diff --git a/phpunit.xml.dist b/phpunit.xml.dist deleted file mode 100644 index 1fb6f92..0000000 --- a/phpunit.xml.dist +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - ./tests - - - - - . - - - ./tests - ./vendor - - - diff --git a/tests/Clock/FrozenTest.php b/tests/Clock/FrozenTest.php index 5f0d0e8..f07c98f 100644 --- a/tests/Clock/FrozenTest.php +++ b/tests/Clock/FrozenTest.php @@ -9,8 +9,10 @@ PointInTime as PointInTimeInterface, }; use Fixtures\Innmind\TimeContinuum\PointInTime; -use PHPUnit\Framework\TestCase; -use Innmind\BlackBox\PHPUnit\BlackBox; +use Innmind\BlackBox\{ + PHPUnit\Framework\TestCase, + PHPUnit\BlackBox, +}; class FrozenTest extends TestCase { diff --git a/tests/Clock/LiveTest.php b/tests/Clock/LiveTest.php index 55683be..e8d416a 100644 --- a/tests/Clock/LiveTest.php +++ b/tests/Clock/LiveTest.php @@ -9,8 +9,8 @@ Format, Timezone, }; -use PHPUnit\Framework\TestCase; use Innmind\BlackBox\{ + PHPUnit\Framework\TestCase, PHPUnit\BlackBox, Set, }; diff --git a/tests/Clock/LoggerTest.php b/tests/Clock/LoggerTest.php index b8600a9..aa72f4c 100644 --- a/tests/Clock/LoggerTest.php +++ b/tests/Clock/LoggerTest.php @@ -12,8 +12,8 @@ LoggerInterface, LoggerTrait, }; -use PHPUnit\Framework\TestCase; use Innmind\BlackBox\{ + PHPUnit\Framework\TestCase, PHPUnit\BlackBox, Set, }; diff --git a/tests/ClockTest.php b/tests/ClockTest.php index 7aec384..c854ee9 100644 --- a/tests/ClockTest.php +++ b/tests/ClockTest.php @@ -7,18 +7,16 @@ Clock, Format, }; -use PHPUnit\Framework\{ - TestCase, - Attributes\DataProvider, -}; use Psr\Log\{ LoggerInterface, LoggerTrait, }; use Innmind\BlackBox\{ + PHPUnit\Framework\TestCase, PHPUnit\BlackBox, Set, }; +use PHPUnit\Framework\Attributes\DataProvider; use Fixtures\Innmind\TimeContinuum\PointInTime; class ClockTest extends TestCase diff --git a/tests/ElapsedPeriodTest.php b/tests/ElapsedPeriodTest.php index 12d55f9..ae0b96c 100644 --- a/tests/ElapsedPeriodTest.php +++ b/tests/ElapsedPeriodTest.php @@ -8,7 +8,7 @@ Period\Year, Period\Month, }; -use PHPUnit\Framework\TestCase; +use Innmind\BlackBox\PHPUnit\Framework\TestCase; class ElapsedPeriodTest extends TestCase { diff --git a/tests/Fixtures/PeriodTest.php b/tests/Fixtures/PeriodTest.php index 8b524fe..b931962 100644 --- a/tests/Fixtures/PeriodTest.php +++ b/tests/Fixtures/PeriodTest.php @@ -9,7 +9,7 @@ Random, }; use Innmind\TimeContinuum\Period as Model; -use PHPUnit\Framework\TestCase; +use Innmind\BlackBox\PHPUnit\Framework\TestCase; class PeriodTest extends TestCase { diff --git a/tests/Fixtures/PointInTimeTest.php b/tests/Fixtures/PointInTimeTest.php index d259b4d..52fc662 100644 --- a/tests/Fixtures/PointInTimeTest.php +++ b/tests/Fixtures/PointInTimeTest.php @@ -8,11 +8,8 @@ Set, Random, }; -use Innmind\TimeContinuum\{ - PointInTime as PointInTimeInterface, - Format, -}; -use PHPUnit\Framework\TestCase; +use Innmind\TimeContinuum\PointInTime as Model; +use Innmind\BlackBox\PHPUnit\Framework\TestCase; class PointInTimeTest extends TestCase { @@ -25,13 +22,14 @@ public function testAny() foreach ($pointsInTime->values(Random::default) as $pointInTime) { $this->assertInstanceOf(Set\Value::class, $pointInTime); - $this->assertInstanceOf(PointInTimeInterface::class, $pointInTime->unwrap()); + $this->assertInstanceOf(Model::class, $pointInTime->unwrap()); $this->assertTrue($pointInTime->isImmutable()); } } public function testAfter() { + $start = Model::at('1970-01-01T12:13:14+02:00'); $points = PointInTime::after('1970-01-01T12:13:14+02:00'); $this->assertInstanceOf(Set::class, $points); @@ -39,14 +37,15 @@ public function testAfter() foreach ($points->values(Random::default) as $point) { $this->assertGreaterThanOrEqual( - '1970-01-01T12:13:14+02:00', - $point->unwrap()->format(Format::iso8601()), + $start->milliseconds(), + $point->unwrap()->milliseconds(), ); } } public function testBefore() { + $start = Model::at('1970-01-01T12:13:14+02:00'); $points = PointInTime::before('1970-01-01T12:13:14+02:00'); $this->assertInstanceOf(Set::class, $points); @@ -54,8 +53,8 @@ public function testBefore() foreach ($points->values(Random::default) as $point) { $this->assertLessThanOrEqual( - '1970-01-01T12:13:14+02:00', - $point->unwrap()->format(Format::iso8601()), + $start->milliseconds(), + $point->unwrap()->milliseconds(), ); } } diff --git a/tests/FormatTest.php b/tests/FormatTest.php index 3608861..439196d 100644 --- a/tests/FormatTest.php +++ b/tests/FormatTest.php @@ -4,10 +4,8 @@ namespace Tests\Innmind\TimeContinuum; use Innmind\TimeContinuum\Format; -use PHPUnit\Framework\{ - TestCase, - Attributes\DataProvider, -}; +use Innmind\BlackBox\PHPUnit\Framework\TestCase; +use PHPUnit\Framework\Attributes\DataProvider; class FormatTest extends TestCase { diff --git a/tests/Move/EndOfDayTest.php b/tests/Move/EndOfDayTest.php index 89fedd0..6c9967f 100644 --- a/tests/Move/EndOfDayTest.php +++ b/tests/Move/EndOfDayTest.php @@ -8,13 +8,12 @@ PointInTime, Format, }; -use PHPUnit\Framework\TestCase; +use Innmind\BlackBox\PHPUnit\Framework\TestCase; +use PHPUnit\Framework\Attributes\DataProvider; class EndOfDayTest extends TestCase { - /** - * @dataProvider cases - */ + #[DataProvider('cases')] public function testInterface($time, $expected) { $endOfDay = new EndOfDay; diff --git a/tests/Move/EndOfMonthTest.php b/tests/Move/EndOfMonthTest.php index 96b4640..f097e6b 100644 --- a/tests/Move/EndOfMonthTest.php +++ b/tests/Move/EndOfMonthTest.php @@ -8,13 +8,12 @@ PointInTime, Format, }; -use PHPUnit\Framework\TestCase; +use Innmind\BlackBox\PHPUnit\Framework\TestCase; +use PHPUnit\Framework\Attributes\DataProvider; class EndOfMonthTest extends TestCase { - /** - * @dataProvider cases - */ + #[DataProvider('cases')] public function testInterface($time, $expected) { $endOfMonth = new EndOfMonth; diff --git a/tests/Move/EndOfYearTest.php b/tests/Move/EndOfYearTest.php index 592f164..d4731d4 100644 --- a/tests/Move/EndOfYearTest.php +++ b/tests/Move/EndOfYearTest.php @@ -8,13 +8,12 @@ PointInTime, Format, }; -use PHPUnit\Framework\TestCase; +use Innmind\BlackBox\PHPUnit\Framework\TestCase; +use PHPUnit\Framework\Attributes\DataProvider; class EndOfYearTest extends TestCase { - /** - * @dataProvider cases - */ + #[DataProvider('cases')] public function testInterface($time, $expected) { $endOfYear = new EndOfYear; diff --git a/tests/Move/MonthTest.php b/tests/Move/MonthTest.php index cfa242a..bc68f6a 100644 --- a/tests/Move/MonthTest.php +++ b/tests/Move/MonthTest.php @@ -8,13 +8,12 @@ PointInTime, Format, }; -use PHPUnit\Framework\TestCase; +use Innmind\BlackBox\PHPUnit\Framework\TestCase; +use PHPUnit\Framework\Attributes\DataProvider; class MonthTest extends TestCase { - /** - * @dataProvider cases - */ + #[DataProvider('cases')] public function testInterface($time, $expectedForward, $expectedBackward) { $format = Format::of('Y-m-d H:i:s.u'); diff --git a/tests/Move/StartOfDayTest.php b/tests/Move/StartOfDayTest.php index c0e58f7..226cc01 100644 --- a/tests/Move/StartOfDayTest.php +++ b/tests/Move/StartOfDayTest.php @@ -8,13 +8,12 @@ PointInTime, Format, }; -use PHPUnit\Framework\TestCase; +use Innmind\BlackBox\PHPUnit\Framework\TestCase; +use PHPUnit\Framework\Attributes\DataProvider; class StartOfDayTest extends TestCase { - /** - * @dataProvider cases - */ + #[DataProvider('cases')] public function testInterface($time, $expected) { $startOfDay = new StartOfDay; diff --git a/tests/Move/StartOfMonthTest.php b/tests/Move/StartOfMonthTest.php index 90217c0..dbf168b 100644 --- a/tests/Move/StartOfMonthTest.php +++ b/tests/Move/StartOfMonthTest.php @@ -8,13 +8,12 @@ PointInTime, Format, }; -use PHPUnit\Framework\TestCase; +use Innmind\BlackBox\PHPUnit\Framework\TestCase; +use PHPUnit\Framework\Attributes\DataProvider; class StartOfMonthTest extends TestCase { - /** - * @dataProvider cases - */ + #[DataProvider('cases')] public function testInterface($time, $expected) { $startOfMonth = new StartOfMonth; diff --git a/tests/Move/StartOfYearTest.php b/tests/Move/StartOfYearTest.php index 44ffad7..ad4dba7 100644 --- a/tests/Move/StartOfYearTest.php +++ b/tests/Move/StartOfYearTest.php @@ -8,13 +8,12 @@ PointInTime, Format, }; -use PHPUnit\Framework\TestCase; +use Innmind\BlackBox\PHPUnit\Framework\TestCase; +use PHPUnit\Framework\Attributes\DataProvider; class StartOfYearTest extends TestCase { - /** - * @dataProvider cases - */ + #[DataProvider('cases')] public function testInterface($time, $expected) { $startOfYear = new StartOfYear; diff --git a/tests/NowTest.php b/tests/NowTest.php index 8f6497d..004ad79 100644 --- a/tests/NowTest.php +++ b/tests/NowTest.php @@ -18,7 +18,7 @@ Period, Period\Year, }; -use PHPUnit\Framework\TestCase; +use Innmind\BlackBox\PHPUnit\Framework\TestCase; class NowTest extends TestCase { diff --git a/tests/Period.php b/tests/Period.php index 816c656..b0d9f78 100644 --- a/tests/Period.php +++ b/tests/Period.php @@ -4,7 +4,7 @@ namespace Tests\Innmind\TimeContinuum; use Innmind\TimeContinuum\Period; -use PHPUnit\Framework\TestCase; +use Innmind\BlackBox\PHPUnit\Framework\TestCase; class CompositeTest extends TestCase { diff --git a/tests/Period/DayTest.php b/tests/Period/DayTest.php index b064c28..8a29305 100644 --- a/tests/Period/DayTest.php +++ b/tests/Period/DayTest.php @@ -7,7 +7,7 @@ Period, Period\Day, }; -use PHPUnit\Framework\TestCase; +use Innmind\BlackBox\PHPUnit\Framework\TestCase; class DayTest extends TestCase { diff --git a/tests/Period/HourTest.php b/tests/Period/HourTest.php index 7ab0422..dc1f41f 100644 --- a/tests/Period/HourTest.php +++ b/tests/Period/HourTest.php @@ -7,7 +7,8 @@ Period, Period\Hour, }; -use PHPUnit\Framework\TestCase; +use Innmind\BlackBox\PHPUnit\Framework\TestCase; +use PHPUnit\Framework\Attributes\DataProvider; class HourTest extends TestCase { @@ -25,9 +26,7 @@ public function testInterface() $this->assertSame(0, $period->milliseconds()); } - /** - * @dataProvider cases - */ + #[DataProvider('cases')] public function testConvertToDays(int $hour, int $days, int $expectedHours) { $period = Hour::of($hour); diff --git a/tests/Period/MillisecondTest.php b/tests/Period/MillisecondTest.php index 031a454..2e3cc0e 100644 --- a/tests/Period/MillisecondTest.php +++ b/tests/Period/MillisecondTest.php @@ -7,7 +7,8 @@ Period, Period\Millisecond, }; -use PHPUnit\Framework\TestCase; +use Innmind\BlackBox\PHPUnit\Framework\TestCase; +use PHPUnit\Framework\Attributes\DataProvider; class MillisecondTest extends TestCase { @@ -25,9 +26,7 @@ public function testInterface() $this->assertSame(20, $period->milliseconds()); } - /** - * @dataProvider cases - */ + #[DataProvider('cases')] public function testConvertToSeconds( int $millisecond, int $days, diff --git a/tests/Period/MinuteTest.php b/tests/Period/MinuteTest.php index 4ba2437..80e37d3 100644 --- a/tests/Period/MinuteTest.php +++ b/tests/Period/MinuteTest.php @@ -7,7 +7,8 @@ Period, Period\Minute, }; -use PHPUnit\Framework\TestCase; +use Innmind\BlackBox\PHPUnit\Framework\TestCase; +use PHPUnit\Framework\Attributes\DataProvider; class MinuteTest extends TestCase { @@ -25,9 +26,7 @@ public function testInterface() $this->assertSame(0, $period->milliseconds()); } - /** - * @dataProvider cases - */ + #[DataProvider('cases')] public function testConvertToHours( int $minute, int $days, diff --git a/tests/Period/MonthTest.php b/tests/Period/MonthTest.php index 10c781d..face056 100644 --- a/tests/Period/MonthTest.php +++ b/tests/Period/MonthTest.php @@ -7,7 +7,8 @@ Period, Period\Month, }; -use PHPUnit\Framework\TestCase; +use Innmind\BlackBox\PHPUnit\Framework\TestCase; +use PHPUnit\Framework\Attributes\DataProvider; class MonthTest extends TestCase { @@ -25,9 +26,7 @@ public function testInterface() $this->assertSame(0, $period->milliseconds()); } - /** - * @dataProvider cases - */ + #[DataProvider('cases')] public function testConvertMonthsIntoYears(int $months, int $year, int $expectedMonths) { $period = Month::of($months); diff --git a/tests/Period/SecondTest.php b/tests/Period/SecondTest.php index 8de8ecf..a8d7608 100644 --- a/tests/Period/SecondTest.php +++ b/tests/Period/SecondTest.php @@ -7,7 +7,8 @@ Period, Period\Second, }; -use PHPUnit\Framework\TestCase; +use Innmind\BlackBox\PHPUnit\Framework\TestCase; +use PHPUnit\Framework\Attributes\DataProvider; class SecondTest extends TestCase { @@ -25,9 +26,7 @@ public function testInterface() $this->assertSame(0, $period->milliseconds()); } - /** - * @dataProvider cases - */ + #[DataProvider('cases')] public function testConvertToMinutes( int $second, int $days, diff --git a/tests/Period/YearTest.php b/tests/Period/YearTest.php index 9920e42..24d80b8 100644 --- a/tests/Period/YearTest.php +++ b/tests/Period/YearTest.php @@ -7,7 +7,7 @@ Period, Period\Year, }; -use PHPUnit\Framework\TestCase; +use Innmind\BlackBox\PHPUnit\Framework\TestCase; class YearTest extends TestCase { diff --git a/tests/PointInTime/DayTest.php b/tests/PointInTime/DayTest.php index 61aa441..1d659fe 100644 --- a/tests/PointInTime/DayTest.php +++ b/tests/PointInTime/DayTest.php @@ -9,7 +9,7 @@ PointInTime\Year, Calendar, }; -use PHPUnit\Framework\TestCase; +use Innmind\BlackBox\PHPUnit\Framework\TestCase; class DayTest extends TestCase { diff --git a/tests/PointInTime/HighResolutionTest.php b/tests/PointInTime/HighResolutionTest.php index 187dd78..87b8f0b 100644 --- a/tests/PointInTime/HighResolutionTest.php +++ b/tests/PointInTime/HighResolutionTest.php @@ -4,7 +4,7 @@ namespace Tests\Innmind\TimeContinuum\PointInTime; use Innmind\TimeContinuum\PointInTime\HighResolution; -use PHPUnit\Framework\TestCase; +use Innmind\BlackBox\PHPUnit\Framework\TestCase; class HighResolutionTest extends TestCase { diff --git a/tests/PointInTime/HourTest.php b/tests/PointInTime/HourTest.php index bae1300..3f2e558 100644 --- a/tests/PointInTime/HourTest.php +++ b/tests/PointInTime/HourTest.php @@ -4,7 +4,7 @@ namespace Tests\Innmind\TimeContinuum\PointInTime; use Innmind\TimeContinuum\PointInTime\Hour; -use PHPUnit\Framework\TestCase; +use Innmind\BlackBox\PHPUnit\Framework\TestCase; class HourTest extends TestCase { diff --git a/tests/PointInTime/MillisecondTest.php b/tests/PointInTime/MillisecondTest.php index 5d839b4..c230e25 100644 --- a/tests/PointInTime/MillisecondTest.php +++ b/tests/PointInTime/MillisecondTest.php @@ -4,7 +4,7 @@ namespace Tests\Innmind\TimeContinuum\PointInTime; use Innmind\TimeContinuum\PointInTime\Millisecond; -use PHPUnit\Framework\TestCase; +use Innmind\BlackBox\PHPUnit\Framework\TestCase; class MillisecondTest extends TestCase { diff --git a/tests/PointInTime/MinuteTest.php b/tests/PointInTime/MinuteTest.php index 65fa075..84f9945 100644 --- a/tests/PointInTime/MinuteTest.php +++ b/tests/PointInTime/MinuteTest.php @@ -4,7 +4,7 @@ namespace Tests\Innmind\TimeContinuum\PointInTime; use Innmind\TimeContinuum\PointInTime\Minute; -use PHPUnit\Framework\TestCase; +use Innmind\BlackBox\PHPUnit\Framework\TestCase; class MinuteTest extends TestCase { diff --git a/tests/PointInTime/MonthTest.php b/tests/PointInTime/MonthTest.php index ab01c89..d3ae396 100644 --- a/tests/PointInTime/MonthTest.php +++ b/tests/PointInTime/MonthTest.php @@ -8,7 +8,7 @@ PointInTime\Year, Calendar, }; -use PHPUnit\Framework\TestCase; +use Innmind\BlackBox\PHPUnit\Framework\TestCase; class MonthTest extends TestCase { diff --git a/tests/PointInTime/SecondTest.php b/tests/PointInTime/SecondTest.php index a39a52c..6893567 100644 --- a/tests/PointInTime/SecondTest.php +++ b/tests/PointInTime/SecondTest.php @@ -4,7 +4,7 @@ namespace Tests\Innmind\TimeContinuum\PointInTime; use Innmind\TimeContinuum\PointInTime\Second; -use PHPUnit\Framework\TestCase; +use Innmind\BlackBox\PHPUnit\Framework\TestCase; class SecondTest extends TestCase { diff --git a/tests/PointInTime/YearTest.php b/tests/PointInTime/YearTest.php index b182eda..80eaeae 100644 --- a/tests/PointInTime/YearTest.php +++ b/tests/PointInTime/YearTest.php @@ -4,7 +4,7 @@ namespace Tests\Innmind\TimeContinuum\PointInTime; use Innmind\TimeContinuum\PointInTime\Year; -use PHPUnit\Framework\TestCase; +use Innmind\BlackBox\PHPUnit\Framework\TestCase; class YearTest extends TestCase { diff --git a/tests/PointInTimeTest.php b/tests/PointInTimeTest.php index b292a22..ca4091e 100644 --- a/tests/PointInTimeTest.php +++ b/tests/PointInTimeTest.php @@ -18,7 +18,7 @@ Period, Period\Day, }; -use PHPUnit\Framework\TestCase; +use Innmind\BlackBox\PHPUnit\Framework\TestCase; class PointInTimeTest extends TestCase { From 3e60981f51ae5edb7f16ebce0edaa789e95517fa Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Sat, 23 Nov 2024 14:50:59 +0100 Subject: [PATCH 45/85] fix the number of days in a year --- src/PointInTime/Year.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/PointInTime/Year.php b/src/PointInTime/Year.php index 46996ca..3876277 100644 --- a/src/PointInTime/Year.php +++ b/src/PointInTime/Year.php @@ -9,13 +9,13 @@ final class Year { private int $year; - /** @var int<0, 365> */ + /** @var 365|366 */ private int $days; private function __construct(int $year) { $this->year = $year; - /** @var int<0, 365> */ + /** @var 365|366 */ $this->days = (int) \date('z', \mktime(0, 0, 0, 12, 31, $year)) + 1; } @@ -29,7 +29,7 @@ public static function of(int $year): self } /** - * @return int<0, 365> + * @return 365|366 */ public function numberOfDays(): int { From c5f5bbe21d9fb38f149a290ce33e5d4731ff1e80 Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Sat, 23 Nov 2024 14:51:23 +0100 Subject: [PATCH 46/85] add proof that any point in time is defined in the bounds declared statically --- blackbox.php | 8 +++++-- proofs/clock.php | 58 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+), 2 deletions(-) create mode 100644 proofs/clock.php diff --git a/blackbox.php b/blackbox.php index 30bc4c3..07580d3 100644 --- a/blackbox.php +++ b/blackbox.php @@ -5,8 +5,9 @@ use Innmind\BlackBox\{ Application, + Runner\Load, Runner\CodeCoverage, - PHPUnit\Load, + PHPUnit, }; Application::new($argv) @@ -23,5 +24,8 @@ ->enableWhen(true), ) ) - ->tryToProve(Load::directory(__DIR__.'/tests/')) + ->tryToProve(static function() { + yield from Load::everythingIn(__DIR__.'/proofs/')(); + yield from PHPUnit\Load::testsAt(__DIR__.'/tests/'); + }) ->exit(); diff --git a/proofs/clock.php b/proofs/clock.php new file mode 100644 index 0000000..935d3d6 --- /dev/null +++ b/proofs/clock.php @@ -0,0 +1,58 @@ + Clock::live()->now()), + )), + static function($assert, $point) { + $assert + ->number($point->day()->ofYear()) + ->int() + ->greaterThanOrEqual(0) + ->lessThanOrEqual(365); + $assert + ->number($point->day()->ofMonth()) + ->int() + ->greaterThanOrEqual(1) + ->lessThanOrEqual(31); + $assert + ->number($point->hour()->toInt()) + ->int() + ->greaterThanOrEqual(0) + ->lessThanOrEqual(23); + $assert + ->number($point->millisecond()->toInt()) + ->int() + ->greaterThanOrEqual(0) + ->lessThanOrEqual(999); + $assert + ->number($point->minute()->toInt()) + ->int() + ->greaterThanOrEqual(0) + ->lessThanOrEqual(59); + $assert + ->number($point->second()->toInt()) + ->int() + ->greaterThanOrEqual(0) + ->lessThanOrEqual(59); + $assert + ->number($point->month()->numberOfDays()) + ->int() + ->greaterThanOrEqual(28) + ->lessThanOrEqual(31); + $assert + ->number($point->year()->numberOfDays()) + ->int() + ->greaterThanOrEqual(365) + ->lessThanOrEqual(366); + }, + ); +}; From 08f83faed011a49b61c0d388d03dcb5d4eba2bec Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Sat, 23 Nov 2024 15:11:10 +0100 Subject: [PATCH 47/85] add move proofs --- proofs/move/endOfDay.php | 51 ++++++++++++++++++++++++++++++++++++ proofs/move/endOfMonth.php | 51 ++++++++++++++++++++++++++++++++++++ proofs/move/endOfYear.php | 51 ++++++++++++++++++++++++++++++++++++ proofs/move/startOfDay.php | 51 ++++++++++++++++++++++++++++++++++++ proofs/move/startOfMonth.php | 51 ++++++++++++++++++++++++++++++++++++ proofs/move/startOfYear.php | 51 ++++++++++++++++++++++++++++++++++++ 6 files changed, 306 insertions(+) create mode 100644 proofs/move/endOfDay.php create mode 100644 proofs/move/endOfMonth.php create mode 100644 proofs/move/endOfYear.php create mode 100644 proofs/move/startOfDay.php create mode 100644 proofs/move/startOfMonth.php create mode 100644 proofs/move/startOfYear.php diff --git a/proofs/move/endOfDay.php b/proofs/move/endOfDay.php new file mode 100644 index 0000000..88131ea --- /dev/null +++ b/proofs/move/endOfDay.php @@ -0,0 +1,51 @@ + Clock::live()->now()), + )), + static function($assert, $point) { + $endOfDay = (new EndOfDay)($point); + + $assert->same( + $point->year()->toInt(), + $endOfDay->year()->toInt(), + ); + $assert->same( + $point->month()->ofYear(), + $endOfDay->month()->ofYear(), + ); + $assert->same( + $point->day()->ofMonth(), + $endOfDay->day()->ofMonth(), + ); + $assert->same( + 23, + $endOfDay->hour()->toInt(), + ); + $assert->same( + 59, + $endOfDay->minute()->toInt(), + ); + $assert->same( + 59, + $endOfDay->second()->toInt(), + ); + $assert->same( + 999, + $endOfDay->millisecond()->toInt(), + ); + }, + ); +}; diff --git a/proofs/move/endOfMonth.php b/proofs/move/endOfMonth.php new file mode 100644 index 0000000..cecb036 --- /dev/null +++ b/proofs/move/endOfMonth.php @@ -0,0 +1,51 @@ + Clock::live()->now()), + )), + static function($assert, $point) { + $endOfMonth = (new EndOfMonth)($point); + + $assert->same( + $point->year()->toInt(), + $endOfMonth->year()->toInt(), + ); + $assert->same( + $point->month()->ofYear(), + $endOfMonth->month()->ofYear(), + ); + $assert->same( + $point->month()->numberOfDays(), + $endOfMonth->day()->ofMonth(), + ); + $assert->same( + 23, + $endOfMonth->hour()->toInt(), + ); + $assert->same( + 59, + $endOfMonth->minute()->toInt(), + ); + $assert->same( + 59, + $endOfMonth->second()->toInt(), + ); + $assert->same( + 999, + $endOfMonth->millisecond()->toInt(), + ); + }, + ); +}; diff --git a/proofs/move/endOfYear.php b/proofs/move/endOfYear.php new file mode 100644 index 0000000..63f7e64 --- /dev/null +++ b/proofs/move/endOfYear.php @@ -0,0 +1,51 @@ + Clock::live()->now()), + )), + static function($assert, $point) { + $endOfYear = (new EndOfYear)($point); + + $assert->same( + $point->year()->toInt(), + $endOfYear->year()->toInt(), + ); + $assert->same( + 12, + $endOfYear->month()->ofYear()->toInt(), + ); + $assert->same( + 31, + $endOfYear->day()->ofMonth(), + ); + $assert->same( + 23, + $endOfYear->hour()->toInt(), + ); + $assert->same( + 59, + $endOfYear->minute()->toInt(), + ); + $assert->same( + 59, + $endOfYear->second()->toInt(), + ); + $assert->same( + 999, + $endOfYear->millisecond()->toInt(), + ); + }, + ); +}; diff --git a/proofs/move/startOfDay.php b/proofs/move/startOfDay.php new file mode 100644 index 0000000..8408ce5 --- /dev/null +++ b/proofs/move/startOfDay.php @@ -0,0 +1,51 @@ + Clock::live()->now()), + )), + static function($assert, $point) { + $startOfDay = (new StartOfDay)($point); + + $assert->same( + $point->year()->toInt(), + $startOfDay->year()->toInt(), + ); + $assert->same( + $point->month()->ofYear(), + $startOfDay->month()->ofYear(), + ); + $assert->same( + $point->day()->ofMonth(), + $startOfDay->day()->ofMonth(), + ); + $assert->same( + 0, + $startOfDay->hour()->toInt(), + ); + $assert->same( + 0, + $startOfDay->minute()->toInt(), + ); + $assert->same( + 0, + $startOfDay->second()->toInt(), + ); + $assert->same( + 0, + $startOfDay->millisecond()->toInt(), + ); + }, + ); +}; diff --git a/proofs/move/startOfMonth.php b/proofs/move/startOfMonth.php new file mode 100644 index 0000000..8ebff40 --- /dev/null +++ b/proofs/move/startOfMonth.php @@ -0,0 +1,51 @@ + Clock::live()->now()), + )), + static function($assert, $point) { + $startOfMonth = (new StartOfMonth)($point); + + $assert->same( + $point->year()->toInt(), + $startOfMonth->year()->toInt(), + ); + $assert->same( + $point->month()->ofYear(), + $startOfMonth->month()->ofYear(), + ); + $assert->same( + 1, + $startOfMonth->day()->ofMonth(), + ); + $assert->same( + 0, + $startOfMonth->hour()->toInt(), + ); + $assert->same( + 0, + $startOfMonth->minute()->toInt(), + ); + $assert->same( + 0, + $startOfMonth->second()->toInt(), + ); + $assert->same( + 0, + $startOfMonth->millisecond()->toInt(), + ); + }, + ); +}; diff --git a/proofs/move/startOfYear.php b/proofs/move/startOfYear.php new file mode 100644 index 0000000..4265284 --- /dev/null +++ b/proofs/move/startOfYear.php @@ -0,0 +1,51 @@ + Clock::live()->now()), + )), + static function($assert, $point) { + $startOfYear = (new StartOfYear)($point); + + $assert->same( + $point->year()->toInt(), + $startOfYear->year()->toInt(), + ); + $assert->same( + 1, + $startOfYear->month()->ofYear()->toInt(), + ); + $assert->same( + 1, + $startOfYear->day()->ofMonth(), + ); + $assert->same( + 0, + $startOfYear->hour()->toInt(), + ); + $assert->same( + 0, + $startOfYear->minute()->toInt(), + ); + $assert->same( + 0, + $startOfYear->second()->toInt(), + ); + $assert->same( + 0, + $startOfYear->millisecond()->toInt(), + ); + }, + ); +}; From 43efbaef7cf03cd5e728900bdcea1c8c509bbd6d Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Sat, 23 Nov 2024 15:44:19 +0100 Subject: [PATCH 48/85] make sure period bounds are always within accepted bounds --- proofs/period.php | 66 ++++++++++++++++++++++ src/Period.php | 141 ++++++++++++++++++++++++++++++---------------- 2 files changed, 159 insertions(+), 48 deletions(-) create mode 100644 proofs/period.php diff --git a/proofs/period.php b/proofs/period.php new file mode 100644 index 0000000..0683590 --- /dev/null +++ b/proofs/period.php @@ -0,0 +1,66 @@ + $p1->add($p2), + $period, + $period, + ), + )), + static function($assert, $period) { + $assert + ->number($period->years()) + ->int() + ->greaterThanOrEqual(0); + $assert + ->number($period->months()) + ->int() + ->greaterThanOrEqual(0) + ->lessThanOrEqual(11); + $assert + ->number($period->days()) + ->int() + ->greaterThanOrEqual(0); + $assert + ->number($period->hours()) + ->int() + ->greaterThanOrEqual(0) + ->lessThanOrEqual(23); + $assert + ->number($period->minutes()) + ->int() + ->greaterThanOrEqual(0) + ->lessThanOrEqual(59); + $assert + ->number($period->seconds()) + ->int() + ->greaterThanOrEqual(0) + ->lessThanOrEqual(59); + $assert + ->number($period->milliseconds()) + ->int() + ->greaterThanOrEqual(0) + ->lessThanOrEqual(999); + }, + ); +}; diff --git a/src/Period.php b/src/Period.php index 5b56981..186281b 100644 --- a/src/Period.php +++ b/src/Period.php @@ -20,12 +20,12 @@ final class Period { /** * @param int<0, max> $year - * @param int<0, max> $month + * @param int<0, 11> $month * @param int<0, max> $day - * @param int<0, max> $hour - * @param int<0, max> $minute - * @param int<0, max> $second - * @param int<0, max> $millisecond + * @param int<0, 23> $hour + * @param int<0, 59> $minute + * @param int<0, 59> $second + * @param int<0, 999> $millisecond */ private function __construct( private int $year, @@ -42,12 +42,12 @@ private function __construct( * @psalm-pure * * @param int<0, max> $year - * @param int<0, max> $month + * @param int<0, 11> $month * @param int<0, max> $day - * @param int<0, max> $hour - * @param int<0, max> $minute - * @param int<0, max> $second - * @param int<0, max> $millisecond + * @param int<0, 23> $hour + * @param int<0, 59> $minute + * @param int<0, 59> $second + * @param int<0, 999> $millisecond */ public static function of( int $year, @@ -69,6 +69,35 @@ public static function of( ); } + /** + * @psalm-pure + * + * @param int<0, max> $year + * @param int<0, max> $month + * @param int<0, max> $day + * @param int<0, max> $hour + * @param int<0, max> $minute + * @param int<0, max> $second + * @param int<0, max> $millisecond + */ + public static function composite( + int $year, + int $month, + int $day, + int $hour, + int $minute, + int $second, + int $millisecond, + ): self { + return Millisecond::of($millisecond) + ->add(Second::of($second)) + ->add(Minute::of($minute)) + ->add(Hour::of($hour)) + ->add(Day::of($day)) + ->add(Month::of($month)) + ->add(Year::of($year)); + } + /** * @return int<0, max> */ @@ -78,7 +107,7 @@ public function years(): int } /** - * @return int<0, max> + * @return int<0, 11> */ public function months(): int { @@ -94,7 +123,7 @@ public function days(): int } /** - * @return int<0, max> + * @return int<0, 23> */ public function hours(): int { @@ -102,7 +131,7 @@ public function hours(): int } /** - * @return int<0, max> + * @return int<0, 59> */ public function minutes(): int { @@ -110,7 +139,7 @@ public function minutes(): int } /** - * @return int<0, max> + * @return int<0, 59> */ public function seconds(): int { @@ -118,7 +147,7 @@ public function seconds(): int } /** - * @return int<0, max> + * @return int<0, 999> */ public function milliseconds(): int { @@ -139,41 +168,57 @@ public function equals(self $period): bool public function add(self $period): self { $millisecond = Millisecond::of($this->millisecond + $period->milliseconds()); - $second = Second::of($this->second + $period->seconds()); - $minute = Minute::of($this->minute + $period->minutes()); - $hour = Hour::of($this->hour + $period->hours()); - $day = Day::of($this->day + $period->days()); - $month = Month::of($this->month + $period->months()); - $year = Year::of($this->year + $period->years()); + $second = Second::of( + $this->second + $period->seconds() + $millisecond->seconds(), + ); + $minute = Minute::of( + $this->minute + + $period->minutes() + + $second->minutes() + + $millisecond->minutes(), + ); + $hour = Hour::of( + $this->hour + + $period->hours() + + $minute->hours() + + $second->hours() + + $millisecond->hours(), + ); + $day = Day::of( + $this->day + + $period->days() + + $hour->days() + + $minute->days() + + $second->days() + + $millisecond->days(), + ); + $month = Month::of( + $this->month + + $period->months() + + $day->months() + + $hour->months() + + $minute->months() + + $second->months() + + $millisecond->months(), + ); + $year = Year::of( + $this->year + + $period->years() + + $month->years() + + $day->years() + + $hour->years() + + $minute->years() + + $second->years() + + $millisecond->years(), + ); return new self( - $year->years() + - $month->years() + - $day->years() + - $hour->years() + - $minute->years() + - $second->years() + - $millisecond->years(), - $month->months() + - $day->months() + - $hour->months() + - $minute->months() + - $second->months() + - $millisecond->months(), - $day->days() + - $hour->days() + - $minute->days() + - $second->days() + - $millisecond->days(), - $hour->hours() + - $minute->hours() + - $second->hours() + - $millisecond->hours(), - $minute->minutes() + - $second->minutes() + - $millisecond->minutes(), - $second->seconds() + - $millisecond->seconds(), + $year->years(), + $month->months(), + $day->days(), + $hour->hours(), + $minute->minutes(), + $second->seconds(), $millisecond->milliseconds(), ); } From 8c2755bfbda8f645760441e1bcadba0ffa13f8b3 Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Sat, 23 Nov 2024 15:54:09 +0100 Subject: [PATCH 49/85] bump minimum version of blackbox --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index bfa2dff..4561788 100644 --- a/composer.json +++ b/composer.json @@ -32,7 +32,7 @@ }, "require-dev": { "vimeo/psalm": "~5.13", - "innmind/black-box": "~5.0", + "innmind/black-box": "~5.8", "innmind/coding-standard": "^2.0.1" }, "conflict": { From 6677efdbc991e6fdddb2b2b3e88160085bf0c490 Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Sat, 23 Nov 2024 15:55:28 +0100 Subject: [PATCH 50/85] run cs fixer on proofs --- .php-cs-fixer.dist.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index b3af45b..4ba0edb 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -1,3 +1,3 @@ Date: Sat, 23 Nov 2024 15:55:42 +0100 Subject: [PATCH 51/85] CS --- proofs/period.php | 1 - 1 file changed, 1 deletion(-) diff --git a/proofs/period.php b/proofs/period.php index 0683590..b14b803 100644 --- a/proofs/period.php +++ b/proofs/period.php @@ -2,7 +2,6 @@ declare(strict_types = 1); use Innmind\TimeContinuum\Period; -use Fixtures\Innmind\TimeContinuum\PointInTime; use Innmind\BlackBox\Set; return static function() { From 005777ce50167de063ebe40b0260e06b8a3745e2 Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Sat, 23 Nov 2024 16:18:22 +0100 Subject: [PATCH 52/85] replace dedicated period classes by named constructors on Period --- CHANGELOG.md | 7 ++ fixtures/Period.php | 9 +- src/Move/EndOfDay.php | 13 +-- src/Move/EndOfMonth.php | 4 +- src/Move/EndOfYear.php | 4 +- src/Move/Month.php | 21 ++-- src/Move/StartOfDay.php | 13 +-- src/Move/StartOfMonth.php | 4 +- src/Move/StartOfYear.php | 4 +- src/Period.php | 187 +++++++++++++++++++++++++++---- src/Period/Day.php | 27 ----- src/Period/Hour.php | 31 ----- src/Period/Millisecond.php | 32 ------ src/Period/Minute.php | 32 ------ src/Period/Month.php | 31 ----- src/Period/Second.php | 32 ------ src/Period/Year.php | 27 ----- tests/ElapsedPeriodTest.php | 7 +- tests/NowTest.php | 11 +- tests/Period/DayTest.php | 19 ++-- tests/Period/HourTest.php | 21 ++-- tests/Period/MillisecondTest.php | 21 ++-- tests/Period/MinuteTest.php | 21 ++-- tests/Period/MonthTest.php | 15 +-- tests/Period/SecondTest.php | 21 ++-- tests/Period/YearTest.php | 13 +-- tests/PointInTimeTest.php | 11 +- 27 files changed, 267 insertions(+), 371 deletions(-) delete mode 100644 src/Period/Day.php delete mode 100644 src/Period/Hour.php delete mode 100644 src/Period/Millisecond.php delete mode 100644 src/Period/Minute.php delete mode 100644 src/Period/Month.php delete mode 100644 src/Period/Second.php delete mode 100644 src/Period/Year.php diff --git a/CHANGELOG.md b/CHANGELOG.md index 03df0c4..4a9f800 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,13 @@ - `Innmind\TimeContinuum\PointInTime\Month::ofYear()` - `Innmind\TimeContinuum\Calendar\Day` - `Innmind\TimeContinuum\PointInTime\Day::ofWeek()` +- `Innmind\TimeContinuum\Period::year()` named constructor +- `Innmind\TimeContinuum\Period::month()` named constructor +- `Innmind\TimeContinuum\Period::day()` named constructor +- `Innmind\TimeContinuum\Period::hour()` named constructor +- `Innmind\TimeContinuum\Period::minute()` named constructor +- `Innmind\TimeContinuum\Period::second()` named constructor +- `Innmind\TimeContinuum\Period::millisecond()` named constructor ### Changed diff --git a/fixtures/Period.php b/fixtures/Period.php index cd28de8..06e7256 100644 --- a/fixtures/Period.php +++ b/fixtures/Period.php @@ -3,10 +3,7 @@ namespace Fixtures\Innmind\TimeContinuum; -use Innmind\TimeContinuum\{ - Period as Model, - Period\Year, -}; +use Innmind\TimeContinuum\Period as Model; use Innmind\BlackBox\Set; final class Period @@ -29,12 +26,12 @@ public static function any(): Set } /** - * @return Set + * @return Set */ public static function anyNumberOfYear(): Set { return Set\Decorate::immutable( - Year::of(...), + Model::year(...), Set\Integers::between(0, 9999), )->take(100); } diff --git a/src/Move/EndOfDay.php b/src/Move/EndOfDay.php index 7a0e43a..d3613b9 100644 --- a/src/Move/EndOfDay.php +++ b/src/Move/EndOfDay.php @@ -5,10 +5,7 @@ use Innmind\TimeContinuum\{ PointInTime, - Period\Hour, - Period\Minute, - Period\Second, - Period\Millisecond, + Period, }; final class EndOfDay @@ -16,10 +13,10 @@ final class EndOfDay public function __invoke(PointInTime $point): PointInTime { return $point->goForward( - Hour::of(23 - $point->hour()->toInt()) - ->add(Minute::of(59 - $point->minute()->toInt())) - ->add(Second::of(59 - $point->second()->toInt())) - ->add(Millisecond::of(999 - $point->millisecond()->toInt())), + Period::hour(23 - $point->hour()->toInt()) + ->add(Period::minute(59 - $point->minute()->toInt())) + ->add(Period::second(59 - $point->second()->toInt())) + ->add(Period::millisecond(999 - $point->millisecond()->toInt())), ); } } diff --git a/src/Move/EndOfMonth.php b/src/Move/EndOfMonth.php index 6d54c64..74d1f55 100644 --- a/src/Move/EndOfMonth.php +++ b/src/Move/EndOfMonth.php @@ -5,7 +5,7 @@ use Innmind\TimeContinuum\{ PointInTime, - Period\Day, + Period, }; final class EndOfMonth @@ -14,7 +14,7 @@ public function __invoke(PointInTime $point): PointInTime { /** @psalm-suppress InvalidArgument The negative values can only happen when working with 2 different points in time */ return (new EndOfDay)($point)->goForward( - Day::of($point->month()->numberOfDays() - $point->day()->ofMonth()), + Period::day($point->month()->numberOfDays() - $point->day()->ofMonth()), ); } } diff --git a/src/Move/EndOfYear.php b/src/Move/EndOfYear.php index a2b5281..834fead 100644 --- a/src/Move/EndOfYear.php +++ b/src/Move/EndOfYear.php @@ -5,7 +5,7 @@ use Innmind\TimeContinuum\{ PointInTime, - Period\Month, + Period, }; final class EndOfYear @@ -13,7 +13,7 @@ final class EndOfYear public function __invoke(PointInTime $point): PointInTime { $point = (new StartOfMonth)($point)->goForward( - Month::of(12 - $point->month()->ofYear()->toInt()), + Period::month(12 - $point->month()->ofYear()->toInt()), ); return (new EndOfMonth)($point); diff --git a/src/Move/Month.php b/src/Move/Month.php index dd61750..e0ddcbc 100644 --- a/src/Move/Month.php +++ b/src/Move/Month.php @@ -6,11 +6,6 @@ use Innmind\TimeContinuum\{ PointInTime, Period, - Period\Day, - Period\Hour, - Period\Minute, - Period\Second, - Period\Millisecond, }; final class Month @@ -29,20 +24,20 @@ public function __invoke(PointInTime $point): PointInTime /** @var PointInTime $newPoint */ $newPoint = (new StartOfMonth)($point)->{$this->direction}($this->months); $newPoint = $newPoint->goForward( - Hour::of($point->hour()->toInt()) - ->add(Minute::of($point->minute()->toInt())) - ->add(Second::of($point->second()->toInt())) - ->add(Millisecond::of($point->millisecond()->toInt())), + Period::hour($point->hour()->toInt()) + ->add(Period::minute($point->minute()->toInt())) + ->add(Period::second($point->second()->toInt())) + ->add(Period::millisecond($point->millisecond()->toInt())), ); if ($newPoint->month()->numberOfDays() < $point->day()->ofMonth()) { return $newPoint->goForward( - Day::of($newPoint->month()->numberOfDays() - 1), + Period::day($newPoint->month()->numberOfDays() - 1), ); } return $newPoint->goForward( - Day::of($point->day()->ofMonth() - 1), + Period::day($point->day()->ofMonth() - 1), ); } @@ -51,7 +46,7 @@ public function __invoke(PointInTime $point): PointInTime */ public static function forward(int $months): self { - return new self('goForward', Period\Month::of($months)); + return new self('goForward', Period::month($months)); } /** @@ -59,6 +54,6 @@ public static function forward(int $months): self */ public static function backward(int $months): self { - return new self('goBack', Period\Month::of($months)); + return new self('goBack', Period::month($months)); } } diff --git a/src/Move/StartOfDay.php b/src/Move/StartOfDay.php index 920ef56..a615560 100644 --- a/src/Move/StartOfDay.php +++ b/src/Move/StartOfDay.php @@ -5,10 +5,7 @@ use Innmind\TimeContinuum\{ PointInTime, - Period\Hour, - Period\Minute, - Period\Second, - Period\Millisecond, + Period, }; final class StartOfDay @@ -16,10 +13,10 @@ final class StartOfDay public function __invoke(PointInTime $point): PointInTime { return $point->goBack( - Hour::of($point->hour()->toInt()) - ->add(Minute::of($point->minute()->toInt())) - ->add(Second::of($point->second()->toInt())) - ->add(Millisecond::of($point->millisecond()->toInt())), + Period::hour($point->hour()->toInt()) + ->add(Period::minute($point->minute()->toInt())) + ->add(Period::second($point->second()->toInt())) + ->add(Period::millisecond($point->millisecond()->toInt())), ); } } diff --git a/src/Move/StartOfMonth.php b/src/Move/StartOfMonth.php index 86f99da..43d2ead 100644 --- a/src/Move/StartOfMonth.php +++ b/src/Move/StartOfMonth.php @@ -5,7 +5,7 @@ use Innmind\TimeContinuum\{ PointInTime, - Period\Day, + Period, }; final class StartOfMonth @@ -13,7 +13,7 @@ final class StartOfMonth public function __invoke(PointInTime $point): PointInTime { return (new StartOfDay)($point)->goBack( - Day::of($point->day()->ofMonth() - 1), + Period::day($point->day()->ofMonth() - 1), ); } } diff --git a/src/Move/StartOfYear.php b/src/Move/StartOfYear.php index 99bc572..9adca9b 100644 --- a/src/Move/StartOfYear.php +++ b/src/Move/StartOfYear.php @@ -5,7 +5,7 @@ use Innmind\TimeContinuum\{ PointInTime, - Period\Month, + Period, }; final class StartOfYear @@ -13,7 +13,7 @@ final class StartOfYear public function __invoke(PointInTime $point): PointInTime { return (new StartOfMonth)($point)->goBack( - Month::of($point->month()->ofYear()->toInt() - 1), + Period::month($point->month()->ofYear()->toInt() - 1), ); } } diff --git a/src/Period.php b/src/Period.php index 186281b..ce30a7c 100644 --- a/src/Period.php +++ b/src/Period.php @@ -3,16 +3,6 @@ namespace Innmind\TimeContinuum; -use Innmind\TimeContinuum\Period\{ - Year, - Month, - Day, - Hour, - Minute, - Second, - Millisecond, -}; - /** * @psalm-immutable */ @@ -89,13 +79,162 @@ public static function composite( int $second, int $millisecond, ): self { - return Millisecond::of($millisecond) - ->add(Second::of($second)) - ->add(Minute::of($minute)) - ->add(Hour::of($hour)) - ->add(Day::of($day)) - ->add(Month::of($month)) - ->add(Year::of($year)); + return self::millisecond($millisecond) + ->add(self::second($second)) + ->add(self::minute($minute)) + ->add(self::hour($hour)) + ->add(self::day($day)) + ->add(self::month($month)) + ->add(self::year($year)); + } + + /** + * @psalm-pure + * + * @param 0|positive-int $year + */ + public static function year(int $year): self + { + return new self( + $year, + 0, + 0, + 0, + 0, + 0, + 0, + ); + } + + /** + * @psalm-pure + * + * @param 0|positive-int $month + */ + public static function month(int $month): self + { + /** @var int<0, max> */ + $year = (int) ($month / 12); + $month = $month % 12; + + return new self( + $year, + $month, + 0, + 0, + 0, + 0, + 0, + ); + } + + /** + * @psalm-pure + * + * @param 0|positive-int $day + */ + public static function day(int $day): self + { + return new self( + 0, + 0, + $day, + 0, + 0, + 0, + 0, + ); + } + + /** + * @psalm-pure + * + * @param 0|positive-int $hour + */ + public static function hour(int $hour): self + { + /** @var int<0, max> */ + $day = (int) ($hour / 24); + $hour = $hour % 24; + + return new self( + 0, + 0, + $day, + $hour, + 0, + 0, + 0, + ); + } + + /** + * @psalm-pure + * + * @param 0|positive-int $minute + */ + public static function minute(int $minute): self + { + /** @var int<0, max> */ + $hour = (int) ($minute / 60); + $hour = self::hour($hour); + $minute = $minute % 60; + + return new self( + $hour->years(), + $hour->months(), + $hour->days(), + $hour->hours(), + $minute, + 0, + 0, + ); + } + + /** + * @psalm-pure + * + * @param 0|positive-int $second + */ + public static function second(int $second): self + { + /** @var int<0, max> */ + $minute = (int) ($second / 60); + $minute = self::minute($minute); + $second = $second % 60; + + return new self( + $minute->years(), + $minute->months(), + $minute->days(), + $minute->hours(), + $minute->minutes(), + $second, + 0, + ); + } + + /** + * @psalm-pure + * + * @param 0|positive-int $millisecond + */ + public static function millisecond(int $millisecond): self + { + /** @var int<0, max> */ + $second = (int) ($millisecond / 1000); + $second = self::second($second); + $millisecond = $millisecond % 1000; + + return new self( + $second->years(), + $second->months(), + $second->days(), + $second->hours(), + $second->minutes(), + $second->seconds(), + $millisecond, + ); } /** @@ -167,24 +306,24 @@ public function equals(self $period): bool public function add(self $period): self { - $millisecond = Millisecond::of($this->millisecond + $period->milliseconds()); - $second = Second::of( + $millisecond = self::millisecond($this->millisecond + $period->milliseconds()); + $second = self::second( $this->second + $period->seconds() + $millisecond->seconds(), ); - $minute = Minute::of( + $minute = self::minute( $this->minute + $period->minutes() + $second->minutes() + $millisecond->minutes(), ); - $hour = Hour::of( + $hour = self::hour( $this->hour + $period->hours() + $minute->hours() + $second->hours() + $millisecond->hours(), ); - $day = Day::of( + $day = self::day( $this->day + $period->days() + $hour->days() + @@ -192,7 +331,7 @@ public function add(self $period): self $second->days() + $millisecond->days(), ); - $month = Month::of( + $month = self::month( $this->month + $period->months() + $day->months() + @@ -201,7 +340,7 @@ public function add(self $period): self $second->months() + $millisecond->months(), ); - $year = Year::of( + $year = self::year( $this->year + $period->years() + $month->years() + diff --git a/src/Period/Day.php b/src/Period/Day.php deleted file mode 100644 index 6f62519..0000000 --- a/src/Period/Day.php +++ /dev/null @@ -1,27 +0,0 @@ - */ - $day = (int) ($hour / 24); - $hour = $hour % 24; - - return Period::of( - 0, - 0, - $day, - $hour, - 0, - 0, - 0, - ); - } -} diff --git a/src/Period/Millisecond.php b/src/Period/Millisecond.php deleted file mode 100644 index 8fb858a..0000000 --- a/src/Period/Millisecond.php +++ /dev/null @@ -1,32 +0,0 @@ - */ - $second = (int) ($millisecond / 1000); - $second = Second::of($second); - $millisecond = $millisecond % 1000; - - return Period::of( - $second->years(), - $second->months(), - $second->days(), - $second->hours(), - $second->minutes(), - $second->seconds(), - $millisecond, - ); - } -} diff --git a/src/Period/Minute.php b/src/Period/Minute.php deleted file mode 100644 index 319bc7c..0000000 --- a/src/Period/Minute.php +++ /dev/null @@ -1,32 +0,0 @@ - */ - $hour = (int) ($minute / 60); - $hour = Hour::of($hour); - $minute = $minute % 60; - - return Period::of( - $hour->years(), - $hour->months(), - $hour->days(), - $hour->hours(), - $minute, - 0, - 0, - ); - } -} diff --git a/src/Period/Month.php b/src/Period/Month.php deleted file mode 100644 index a040e27..0000000 --- a/src/Period/Month.php +++ /dev/null @@ -1,31 +0,0 @@ - */ - $year = (int) ($month / 12); - $month = $month % 12; - - return Period::of( - $year, - $month, - 0, - 0, - 0, - 0, - 0, - ); - } -} diff --git a/src/Period/Second.php b/src/Period/Second.php deleted file mode 100644 index c7b06fd..0000000 --- a/src/Period/Second.php +++ /dev/null @@ -1,32 +0,0 @@ - */ - $minute = (int) ($second / 60); - $minute = Minute::of($minute); - $second = $second % 60; - - return Period::of( - $minute->years(), - $minute->months(), - $minute->days(), - $minute->hours(), - $minute->minutes(), - $second, - 0, - ); - } -} diff --git a/src/Period/Year.php b/src/Period/Year.php deleted file mode 100644 index a537392..0000000 --- a/src/Period/Year.php +++ /dev/null @@ -1,27 +0,0 @@ -expectException(\LogicException::class); - ElapsedPeriod::ofPeriod(Year::of(1)); + ElapsedPeriod::ofPeriod(Period::year(1)); } public function testThrowWhenTryingToBuildFromMonthPeriod() { $this->expectException(\LogicException::class); - ElapsedPeriod::ofPeriod(Month::of(1)); + ElapsedPeriod::ofPeriod(Period::month(1)); } } diff --git a/tests/NowTest.php b/tests/NowTest.php index 004ad79..550b626 100644 --- a/tests/NowTest.php +++ b/tests/NowTest.php @@ -8,7 +8,7 @@ Offset, Format, ElapsedPeriod, - PointInTime\Year as YearInterface, + PointInTime\Year, PointInTime\Month, PointInTime\Day, PointInTime\Hour, @@ -16,7 +16,6 @@ PointInTime\Second, PointInTime\Millisecond, Period, - Period\Year, }; use Innmind\BlackBox\PHPUnit\Framework\TestCase; @@ -30,7 +29,7 @@ public function testInterface() $now = (int) ($time * 1000); $point = PointInTime::now(); - $this->assertInstanceOf(YearInterface::class, $point->year()); + $this->assertInstanceOf(Year::class, $point->year()); $this->assertInstanceOf(Month::class, $point->month()); $this->assertInstanceOf(Day::class, $point->day()); $this->assertInstanceOf(Hour::class, $point->hour()); @@ -127,7 +126,7 @@ public function testEquals() public function testGoForward() { $point = PointInTime::now(); - $point2 = $point->goForward(Year::of(1)); + $point2 = $point->goForward(Period::year(1)); $this->assertNotSame($point, $point2); $this->assertSame($point->year()->toInt() + 1, $point2->year()->toInt()); @@ -136,12 +135,12 @@ public function testGoForward() public function testGoBack() { $point = PointInTime::now(); - $point2 = $point->goBack(Year::of(1)); + $point2 = $point->goBack(Period::year(1)); $this->assertNotSame($point, $point2); $this->assertSame($point->year()->toInt() - 1, $point2->year()->toInt()); - $point3 = $point->goBack(Period\Millisecond::of(500)); + $point3 = $point->goBack(Period::millisecond(500)); if ($point->millisecond()->toInt() > 500) { $this->assertSame( diff --git a/tests/Period/DayTest.php b/tests/Period/DayTest.php index 8a29305..38552b2 100644 --- a/tests/Period/DayTest.php +++ b/tests/Period/DayTest.php @@ -3,17 +3,14 @@ namespace Tests\Innmind\TimeContinuum\Period; -use Innmind\TimeContinuum\{ - Period, - Period\Day, -}; +use Innmind\TimeContinuum\Period; use Innmind\BlackBox\PHPUnit\Framework\TestCase; class DayTest extends TestCase { public function testInterface() { - $period = Day::of(1000); + $period = Period::day(1000); $this->assertInstanceOf(Period::class, $period); $this->assertSame(0, $period->years()); @@ -27,13 +24,13 @@ public function testInterface() public function testEquals() { - $this->assertTrue(Day::of(2)->equals(Day::of(2))); - $this->assertFalse(Day::of(2)->equals(Day::of(3))); + $this->assertTrue(Period::day(2)->equals(Period::day(2))); + $this->assertFalse(Period::day(2)->equals(Period::day(3))); } public function testAdd() { - $period = Day::of(1000); + $period = Period::day(1000); $period2 = $period->add($period); $this->assertInstanceOf(Period::class, $period); @@ -58,15 +55,15 @@ public function testAsElapsedPeriod() { $this->assertSame( 86_400_000, - Day::of(1)->asElapsedPeriod()->milliseconds(), + Period::day(1)->asElapsedPeriod()->milliseconds(), ); $this->assertSame( 172_800_000, - Day::of(2)->asElapsedPeriod()->milliseconds(), + Period::day(2)->asElapsedPeriod()->milliseconds(), ); $this->assertSame( 259_200_000, - Day::of(3)->asElapsedPeriod()->milliseconds(), + Period::day(3)->asElapsedPeriod()->milliseconds(), ); } } diff --git a/tests/Period/HourTest.php b/tests/Period/HourTest.php index dc1f41f..d0dd38e 100644 --- a/tests/Period/HourTest.php +++ b/tests/Period/HourTest.php @@ -3,10 +3,7 @@ namespace Tests\Innmind\TimeContinuum\Period; -use Innmind\TimeContinuum\{ - Period, - Period\Hour, -}; +use Innmind\TimeContinuum\Period; use Innmind\BlackBox\PHPUnit\Framework\TestCase; use PHPUnit\Framework\Attributes\DataProvider; @@ -14,7 +11,7 @@ class HourTest extends TestCase { public function testInterface() { - $period = Hour::of(20); + $period = Period::hour(20); $this->assertInstanceOf(Period::class, $period); $this->assertSame(0, $period->years()); @@ -29,7 +26,7 @@ public function testInterface() #[DataProvider('cases')] public function testConvertToDays(int $hour, int $days, int $expectedHours) { - $period = Hour::of($hour); + $period = Period::hour($hour); $this->assertSame(0, $period->years()); $this->assertSame(0, $period->months()); @@ -42,13 +39,13 @@ public function testConvertToDays(int $hour, int $days, int $expectedHours) public function testEquals() { - $this->assertTrue(Hour::of(25)->equals(Hour::of(25))); - $this->assertFalse(Hour::of(2)->equals(Hour::of(3))); + $this->assertTrue(Period::hour(25)->equals(Period::hour(25))); + $this->assertFalse(Period::hour(2)->equals(Period::hour(3))); } public function testAdd() { - $period = Hour::of(20); + $period = Period::hour(20); $period2 = $period->add($period); $this->assertInstanceOf(Period::class, $period2); @@ -72,15 +69,15 @@ public function testAsElapsedPeriod() { $this->assertSame( 3_600_000, - Hour::of(1)->asElapsedPeriod()->milliseconds(), + Period::hour(1)->asElapsedPeriod()->milliseconds(), ); $this->assertSame( 7_200_000, - Hour::of(2)->asElapsedPeriod()->milliseconds(), + Period::hour(2)->asElapsedPeriod()->milliseconds(), ); $this->assertSame( 10_800_000, - Hour::of(3)->asElapsedPeriod()->milliseconds(), + Period::hour(3)->asElapsedPeriod()->milliseconds(), ); } diff --git a/tests/Period/MillisecondTest.php b/tests/Period/MillisecondTest.php index 2e3cc0e..a9e9363 100644 --- a/tests/Period/MillisecondTest.php +++ b/tests/Period/MillisecondTest.php @@ -3,10 +3,7 @@ namespace Tests\Innmind\TimeContinuum\Period; -use Innmind\TimeContinuum\{ - Period, - Period\Millisecond, -}; +use Innmind\TimeContinuum\Period; use Innmind\BlackBox\PHPUnit\Framework\TestCase; use PHPUnit\Framework\Attributes\DataProvider; @@ -14,7 +11,7 @@ class MillisecondTest extends TestCase { public function testInterface() { - $period = Millisecond::of(20); + $period = Period::millisecond(20); $this->assertInstanceOf(Period::class, $period); $this->assertSame(0, $period->years()); @@ -35,7 +32,7 @@ public function testConvertToSeconds( int $seconds, int $expectedMilliseconds, ) { - $period = Millisecond::of($millisecond); + $period = Period::millisecond($millisecond); $this->assertSame(0, $period->years()); $this->assertSame(0, $period->months()); @@ -48,13 +45,13 @@ public function testConvertToSeconds( public function testEquals() { - $this->assertTrue(Millisecond::of(66)->equals(Millisecond::of(66))); - $this->assertFalse(Millisecond::of(2)->equals(Millisecond::of(3))); + $this->assertTrue(Period::millisecond(66)->equals(Period::millisecond(66))); + $this->assertFalse(Period::millisecond(2)->equals(Period::millisecond(3))); } public function testAdd() { - $period = Millisecond::of(20); + $period = Period::millisecond(20); $period2 = $period->add($period); $this->assertInstanceOf(Period::class, $period2); @@ -78,15 +75,15 @@ public function testAsElapsedPeriod() { $this->assertSame( 1, - Millisecond::of(1)->asElapsedPeriod()->milliseconds(), + Period::millisecond(1)->asElapsedPeriod()->milliseconds(), ); $this->assertSame( 2, - Millisecond::of(2)->asElapsedPeriod()->milliseconds(), + Period::millisecond(2)->asElapsedPeriod()->milliseconds(), ); $this->assertSame( 3, - Millisecond::of(3)->asElapsedPeriod()->milliseconds(), + Period::millisecond(3)->asElapsedPeriod()->milliseconds(), ); } diff --git a/tests/Period/MinuteTest.php b/tests/Period/MinuteTest.php index 80e37d3..c6baa6c 100644 --- a/tests/Period/MinuteTest.php +++ b/tests/Period/MinuteTest.php @@ -3,10 +3,7 @@ namespace Tests\Innmind\TimeContinuum\Period; -use Innmind\TimeContinuum\{ - Period, - Period\Minute, -}; +use Innmind\TimeContinuum\Period; use Innmind\BlackBox\PHPUnit\Framework\TestCase; use PHPUnit\Framework\Attributes\DataProvider; @@ -14,7 +11,7 @@ class MinuteTest extends TestCase { public function testInterface() { - $period = Minute::of(20); + $period = Period::minute(20); $this->assertInstanceOf(Period::class, $period); $this->assertSame(0, $period->years()); @@ -33,7 +30,7 @@ public function testConvertToHours( int $hours, int $expectedMinutes, ) { - $period = Minute::of($minute); + $period = Period::minute($minute); $this->assertSame(0, $period->years()); $this->assertSame(0, $period->months()); @@ -46,13 +43,13 @@ public function testConvertToHours( public function testEquals() { - $this->assertTrue(Minute::of(66)->equals(Minute::of(66))); - $this->assertFalse(Minute::of(2)->equals(Minute::of(3))); + $this->assertTrue(Period::minute(66)->equals(Period::minute(66))); + $this->assertFalse(Period::minute(2)->equals(Period::minute(3))); } public function testAdd() { - $period = Minute::of(20); + $period = Period::minute(20); $period2 = $period->add($period); $this->assertInstanceOf(Period::class, $period2); @@ -76,15 +73,15 @@ public function testAsElapsedPeriod() { $this->assertSame( 60_000, - Minute::of(1)->asElapsedPeriod()->milliseconds(), + Period::minute(1)->asElapsedPeriod()->milliseconds(), ); $this->assertSame( 120_000, - Minute::of(2)->asElapsedPeriod()->milliseconds(), + Period::minute(2)->asElapsedPeriod()->milliseconds(), ); $this->assertSame( 180_000, - Minute::of(3)->asElapsedPeriod()->milliseconds(), + Period::minute(3)->asElapsedPeriod()->milliseconds(), ); } diff --git a/tests/Period/MonthTest.php b/tests/Period/MonthTest.php index face056..b96a03a 100644 --- a/tests/Period/MonthTest.php +++ b/tests/Period/MonthTest.php @@ -3,10 +3,7 @@ namespace Tests\Innmind\TimeContinuum\Period; -use Innmind\TimeContinuum\{ - Period, - Period\Month, -}; +use Innmind\TimeContinuum\Period; use Innmind\BlackBox\PHPUnit\Framework\TestCase; use PHPUnit\Framework\Attributes\DataProvider; @@ -14,7 +11,7 @@ class MonthTest extends TestCase { public function testInterface() { - $period = Month::of(10); + $period = Period::month(10); $this->assertInstanceOf(Period::class, $period); $this->assertSame(0, $period->years()); @@ -29,7 +26,7 @@ public function testInterface() #[DataProvider('cases')] public function testConvertMonthsIntoYears(int $months, int $year, int $expectedMonths) { - $period = Month::of($months); + $period = Period::month($months); $this->assertSame($year, $period->years()); $this->assertSame($expectedMonths, $period->months()); @@ -42,13 +39,13 @@ public function testConvertMonthsIntoYears(int $months, int $year, int $expected public function testEquals() { - $this->assertTrue(Month::of(20)->equals(Month::of(20))); - $this->assertFalse(Month::of(2)->equals(Month::of(3))); + $this->assertTrue(Period::month(20)->equals(Period::month(20))); + $this->assertFalse(Period::month(2)->equals(Period::month(3))); } public function testAdd() { - $period = Month::of(10); + $period = Period::month(10); $period2 = $period->add($period); $this->assertInstanceOf(Period::class, $period2); diff --git a/tests/Period/SecondTest.php b/tests/Period/SecondTest.php index a8d7608..ddcda7c 100644 --- a/tests/Period/SecondTest.php +++ b/tests/Period/SecondTest.php @@ -3,10 +3,7 @@ namespace Tests\Innmind\TimeContinuum\Period; -use Innmind\TimeContinuum\{ - Period, - Period\Second, -}; +use Innmind\TimeContinuum\Period; use Innmind\BlackBox\PHPUnit\Framework\TestCase; use PHPUnit\Framework\Attributes\DataProvider; @@ -14,7 +11,7 @@ class SecondTest extends TestCase { public function testInterface() { - $period = Second::of(20); + $period = Period::second(20); $this->assertInstanceOf(Period::class, $period); $this->assertSame(0, $period->years()); @@ -34,7 +31,7 @@ public function testConvertToMinutes( int $minutes, int $expectedSeconds, ) { - $period = Second::of($second); + $period = Period::second($second); $this->assertSame(0, $period->years()); $this->assertSame(0, $period->months()); @@ -47,13 +44,13 @@ public function testConvertToMinutes( public function testEquals() { - $this->assertTrue(Second::of(66)->equals(Second::of(66))); - $this->assertFalse(Second::of(2)->equals(Second::of(3))); + $this->assertTrue(Period::second(66)->equals(Period::second(66))); + $this->assertFalse(Period::second(2)->equals(Period::second(3))); } public function testAdd() { - $period = Second::of(20); + $period = Period::second(20); $period2 = $period->add($period); $this->assertInstanceOf(Period::class, $period2); @@ -77,15 +74,15 @@ public function testAsElapsedPeriod() { $this->assertSame( 1000, - Second::of(1)->asElapsedPeriod()->milliseconds(), + Period::second(1)->asElapsedPeriod()->milliseconds(), ); $this->assertSame( 2000, - Second::of(2)->asElapsedPeriod()->milliseconds(), + Period::second(2)->asElapsedPeriod()->milliseconds(), ); $this->assertSame( 3000, - Second::of(3)->asElapsedPeriod()->milliseconds(), + Period::second(3)->asElapsedPeriod()->milliseconds(), ); } diff --git a/tests/Period/YearTest.php b/tests/Period/YearTest.php index 24d80b8..d1c4f0c 100644 --- a/tests/Period/YearTest.php +++ b/tests/Period/YearTest.php @@ -3,17 +3,14 @@ namespace Tests\Innmind\TimeContinuum\Period; -use Innmind\TimeContinuum\{ - Period, - Period\Year, -}; +use Innmind\TimeContinuum\Period; use Innmind\BlackBox\PHPUnit\Framework\TestCase; class YearTest extends TestCase { public function testInterface() { - $period = Year::of(42); + $period = Period::year(42); $this->assertInstanceOf(Period::class, $period); $this->assertSame(42, $period->years()); @@ -27,13 +24,13 @@ public function testInterface() public function testEquals() { - $this->assertTrue(Year::of(2)->equals(Year::of(2))); - $this->assertFalse(Year::of(2)->equals(Year::of(3))); + $this->assertTrue(Period::year(2)->equals(Period::year(2))); + $this->assertFalse(Period::year(2)->equals(Period::year(3))); } public function testAdd() { - $period = Year::of(42); + $period = Period::year(42); $period2 = $period->add($period); $this->assertInstanceOf(Period::class, $period2); diff --git a/tests/PointInTimeTest.php b/tests/PointInTimeTest.php index ca4091e..8f96811 100644 --- a/tests/PointInTimeTest.php +++ b/tests/PointInTimeTest.php @@ -10,13 +10,12 @@ ElapsedPeriod, PointInTime\Year, PointInTime\Month, - PointInTime\Day as DayInterface, + PointInTime\Day, PointInTime\Hour, PointInTime\Minute, PointInTime\Second, PointInTime\Millisecond, Period, - Period\Day, }; use Innmind\BlackBox\PHPUnit\Framework\TestCase; @@ -28,7 +27,7 @@ public function testInterface() $this->assertInstanceOf(Year::class, $point->year()); $this->assertInstanceOf(Month::class, $point->month()); - $this->assertInstanceOf(DayInterface::class, $point->day()); + $this->assertInstanceOf(Day::class, $point->day()); $this->assertInstanceOf(Hour::class, $point->hour()); $this->assertInstanceOf(Minute::class, $point->minute()); $this->assertInstanceOf(Second::class, $point->second()); @@ -168,7 +167,7 @@ public function testGoBack() $this->assertSame( '2016-10-05T08:01:29.500000+02:00', $point - ->goBack(Period\Millisecond::of(623)) + ->goBack(Period::millisecond(623)) ->format(Format::of('Y-m-d\TH:i:s.uP')), ); } @@ -176,7 +175,7 @@ public function testGoBack() public function testGoBackOneDay() { $point = PointInTime::at('2018-03-04'); - $point2 = $point->goBack(Day::of(1)); + $point2 = $point->goBack(Period::day(1)); $format = Format::of('Y-m-d\TH:i:s.u'); $this->assertSame( @@ -192,7 +191,7 @@ public function testGoBackOneDay() public function testGoBackOneMillisecondWhenCurrentPointIsAtPreciselyZeroMillisecond() { $point = PointInTime::at('1402-07-21 02:42:53.000000'); - $point2 = $point->goBack(Period\Millisecond::of(1)); + $point2 = $point->goBack(Period::millisecond(1)); $format = Format::of('Y-m-d\TH:i:s.u'); $this->assertSame( From 8c7f920b41ce31e0eea0315b7bfb2e6f60e271bc Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Sat, 23 Nov 2024 16:22:06 +0100 Subject: [PATCH 53/85] avoid recursion when value within bound --- src/Period.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/Period.php b/src/Period.php index ce30a7c..9b6a607 100644 --- a/src/Period.php +++ b/src/Period.php @@ -113,6 +113,10 @@ public static function year(int $year): self */ public static function month(int $month): self { + if ($month < 12) { + return new self(0, $month, 0, 0, 0, 0, 0); + } + /** @var int<0, max> */ $year = (int) ($month / 12); $month = $month % 12; @@ -153,6 +157,10 @@ public static function day(int $day): self */ public static function hour(int $hour): self { + if ($hour < 24) { + return new self(0, 0, 0, $hour, 0, 0, 0); + } + /** @var int<0, max> */ $day = (int) ($hour / 24); $hour = $hour % 24; @@ -175,6 +183,10 @@ public static function hour(int $hour): self */ public static function minute(int $minute): self { + if ($minute < 60) { + return new self(0, 0, 0, 0, $minute, 0, 0); + } + /** @var int<0, max> */ $hour = (int) ($minute / 60); $hour = self::hour($hour); @@ -198,6 +210,10 @@ public static function minute(int $minute): self */ public static function second(int $second): self { + if ($second < 60) { + return new self(0, 0, 0, 0, 0, $second, 0); + } + /** @var int<0, max> */ $minute = (int) ($second / 60); $minute = self::minute($minute); @@ -221,6 +237,10 @@ public static function second(int $second): self */ public static function millisecond(int $millisecond): self { + if ($millisecond < 1_000) { + return new self(0, 0, 0, 0, 0, 0, $millisecond); + } + /** @var int<0, max> */ $second = (int) ($millisecond / 1000); $second = self::second($second); From 213c6547fd2061c93ac772afe1e865798801332d Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Sat, 23 Nov 2024 16:26:17 +0100 Subject: [PATCH 54/85] remove useless code --- src/PointInTime.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/PointInTime.php b/src/PointInTime.php index 0ad8112..b22f27f 100644 --- a/src/PointInTime.php +++ b/src/PointInTime.php @@ -35,8 +35,6 @@ public static function at(string $date): self { /** @psalm-suppress ImpureMethodCall */ $datetime = new \DateTimeImmutable($date); - /** @var int<0, max> */ - $milliseconds = $datetime->getTimestamp() * 1000; return new self( $datetime, From 4b4daaa599bed801e6efd8b33c36aec0d44bab5e Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Sat, 23 Nov 2024 16:26:48 +0100 Subject: [PATCH 55/85] remove useless annotation --- src/PointInTime.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/PointInTime.php b/src/PointInTime.php index b22f27f..52bc034 100644 --- a/src/PointInTime.php +++ b/src/PointInTime.php @@ -48,7 +48,6 @@ public static function at(string $date): self public static function now(): self { $now = new \DateTimeImmutable('now'); - /** @psalm-suppress ImpureMethodCallAcceptable since only a clock should instantiate this class */ $highResolution = HighResolution::now(); return new self( From cd407103dfa199a64515fa0c29649e3d528bbed7 Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Sat, 23 Nov 2024 16:30:11 +0100 Subject: [PATCH 56/85] expose point in time microsecond --- CHANGELOG.md | 1 + proofs/clock.php | 5 ++++ src/PointInTime.php | 9 +++++++ src/PointInTime/Microsecond.php | 45 +++++++++++++++++++++++++++++++++ 4 files changed, 60 insertions(+) create mode 100644 src/PointInTime/Microsecond.php diff --git a/CHANGELOG.md b/CHANGELOG.md index 4a9f800..c76620c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ - `Innmind\TimeContinuum\Period::minute()` named constructor - `Innmind\TimeContinuum\Period::second()` named constructor - `Innmind\TimeContinuum\Period::millisecond()` named constructor +- `Innmind\TimeContinuum\PointInTime::microsecond()` ### Changed diff --git a/proofs/clock.php b/proofs/clock.php index 935d3d6..78e0ba2 100644 --- a/proofs/clock.php +++ b/proofs/clock.php @@ -33,6 +33,11 @@ static function($assert, $point) { ->int() ->greaterThanOrEqual(0) ->lessThanOrEqual(999); + $assert + ->number($point->microsecond()->toInt()) + ->int() + ->greaterThanOrEqual(0) + ->lessThanOrEqual(999); $assert ->number($point->minute()->toInt()) ->int() diff --git a/src/PointInTime.php b/src/PointInTime.php index 52bc034..f231336 100644 --- a/src/PointInTime.php +++ b/src/PointInTime.php @@ -11,6 +11,7 @@ PointInTime\Minute, PointInTime\Second, PointInTime\Millisecond, + PointInTime\Microsecond, PointInTime\HighResolution, }; @@ -120,6 +121,14 @@ public function millisecond(): Millisecond return Millisecond::of($millisecond); } + public function microsecond(): Microsecond + { + /** @var int<0, 999> */ + $microsecond = ((int) $this->date->format('u')) % 1000; + + return Microsecond::of($microsecond); + } + public function format(Format $format): string { return $this->date->format($format->toString()); diff --git a/src/PointInTime/Microsecond.php b/src/PointInTime/Microsecond.php new file mode 100644 index 0000000..dd78e36 --- /dev/null +++ b/src/PointInTime/Microsecond.php @@ -0,0 +1,45 @@ + $microsecond + */ + private function __construct( + private int $microsecond, + ) { + } + + /** + * @psalm-pure + * @internal + * + * @param int<0, 999> $microsecond + */ + public static function of(int $microsecond): self + { + return new self($microsecond); + } + + /** + * @return int<0, 999> + */ + public function toInt(): int + { + return $this->microsecond; + } + + /** + * @return non-empty-string + */ + public function toString(): string + { + return (string) $this->microsecond; + } +} From 412e2d5ca041019ab1ad2d3bf8f70ca2b22f0ce7 Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Sat, 23 Nov 2024 16:45:53 +0100 Subject: [PATCH 57/85] generate point in times down to the microsecond --- fixtures/PointInTime.php | 21 +++++++++------------ src/Clock/Live.php | 10 +++++++++- src/PointInTime.php | 9 ++------- tests/Fixtures/PointInTimeTest.php | 4 ++-- tests/Move/EndOfDayTest.php | 2 +- tests/Move/EndOfMonthTest.php | 2 +- tests/Move/EndOfYearTest.php | 2 +- tests/Move/MonthTest.php | 4 ++-- tests/Move/StartOfDayTest.php | 2 +- tests/Move/StartOfMonthTest.php | 2 +- tests/Move/StartOfYearTest.php | 2 +- tests/PointInTimeTest.php | 30 +++++++++++++++--------------- 12 files changed, 45 insertions(+), 45 deletions(-) diff --git a/fixtures/PointInTime.php b/fixtures/PointInTime.php index 574fdd2..6220945 100644 --- a/fixtures/PointInTime.php +++ b/fixtures/PointInTime.php @@ -22,7 +22,7 @@ public static function any(): Set */ public static function after(string $point): Set { - $lower = Model::at($point); + $lower = Model::at(new \DateTimeImmutable($point)); return self::yearRange($lower->year()->toInt(), 9999)->filter(static function($point) use ($lower): bool { return $point->aheadOf($lower); @@ -35,7 +35,7 @@ public static function after(string $point): Set */ public static function before(string $point): Set { - $upper = Model::at($point); + $upper = Model::at(new \DateTimeImmutable($point)); return self::yearRange(0, $upper->year()->toInt())->filter(static function($point) use ($upper): bool { return $upper->aheadOf($point); @@ -49,17 +49,12 @@ private static function yearRange(int $lowerBound, int $upperBound): Set { return Set\Composite::immutable( static function( - int $year, - int $month, - int $day, - int $hour, - int $minute, - int $second, - string $offsetDirection, - int $hourOffset, - string $minuteOffset, + int|string ...$components, ): Model { - return Model::at("$year-$month-{$day}T$hour:$minute:$second$offsetDirection$hourOffset:$minuteOffset"); + return Model::at(new \DateTimeImmutable(\sprintf( + '%02s-%02d-%02dT%02d:%02d:%02d.%03d%03d%s%02d:%s', + ...$components, + ))); }, Set\Integers::between($lowerBound, $upperBound), Set\Integers::between(1, 12), @@ -67,6 +62,8 @@ static function( Set\Integers::between(0, 23), Set\Integers::between(0, 59), Set\Integers::between(0, 59), + Set\Integers::between(0, 999), + Set\Integers::between(0, 999), Set\Elements::of('-', '+'), Set\Integers::between(0, 12), Set\Elements::of('00', '15', '30', '45'), diff --git a/src/Clock/Live.php b/src/Clock/Live.php index e0f7ffc..56ea62e 100644 --- a/src/Clock/Live.php +++ b/src/Clock/Live.php @@ -79,12 +79,20 @@ public function at(string $date, Format $format = null): Maybe } $date = $datetime->format(\DateTime::ATOM); + } else { + try { + /** @psalm-suppress ImpureMethodCall */ + $datetime = new \DateTimeImmutable($date); + } catch (\ValueError) { + /** @var Maybe */ + return Maybe::nothing(); + } } /** * @psalm-suppress ImpureVariable * @psalm-suppress ImpurePropertyFetch */ - return Maybe::just(PointInTime::at($date)->changeOffset($this->offset)); + return Maybe::just(PointInTime::at($datetime)->changeOffset($this->offset)); } } diff --git a/src/PointInTime.php b/src/PointInTime.php index f231336..a6e2369 100644 --- a/src/PointInTime.php +++ b/src/PointInTime.php @@ -29,16 +29,11 @@ private function __construct( /** * @psalm-pure * @internal - * - * @param non-empty-string $date */ - public static function at(string $date): self + public static function at(\DateTimeImmutable $date): self { - /** @psalm-suppress ImpureMethodCall */ - $datetime = new \DateTimeImmutable($date); - return new self( - $datetime, + $date, null, ); } diff --git a/tests/Fixtures/PointInTimeTest.php b/tests/Fixtures/PointInTimeTest.php index 52fc662..ff31a73 100644 --- a/tests/Fixtures/PointInTimeTest.php +++ b/tests/Fixtures/PointInTimeTest.php @@ -29,7 +29,7 @@ public function testAny() public function testAfter() { - $start = Model::at('1970-01-01T12:13:14+02:00'); + $start = Model::at(new \DateTimeImmutable('1970-01-01T12:13:14+02:00')); $points = PointInTime::after('1970-01-01T12:13:14+02:00'); $this->assertInstanceOf(Set::class, $points); @@ -45,7 +45,7 @@ public function testAfter() public function testBefore() { - $start = Model::at('1970-01-01T12:13:14+02:00'); + $start = Model::at(new \DateTimeImmutable('1970-01-01T12:13:14+02:00')); $points = PointInTime::before('1970-01-01T12:13:14+02:00'); $this->assertInstanceOf(Set::class, $points); diff --git a/tests/Move/EndOfDayTest.php b/tests/Move/EndOfDayTest.php index 6c9967f..27764bb 100644 --- a/tests/Move/EndOfDayTest.php +++ b/tests/Move/EndOfDayTest.php @@ -18,7 +18,7 @@ public function testInterface($time, $expected) { $endOfDay = new EndOfDay; - $point = $endOfDay(PointInTime::at($time)); + $point = $endOfDay(PointInTime::at(new \DateTimeImmutable($time))); $this->assertSame($expected, $point->format(Format::of('Y-m-d H:i:s.u'))); } diff --git a/tests/Move/EndOfMonthTest.php b/tests/Move/EndOfMonthTest.php index f097e6b..45ffbc8 100644 --- a/tests/Move/EndOfMonthTest.php +++ b/tests/Move/EndOfMonthTest.php @@ -18,7 +18,7 @@ public function testInterface($time, $expected) { $endOfMonth = new EndOfMonth; - $point = $endOfMonth(PointInTime::at($time)); + $point = $endOfMonth(PointInTime::at(new \DateTimeImmutable($time))); $this->assertSame($expected, $point->format(Format::of('Y-m-d H:i:s.u'))); } diff --git a/tests/Move/EndOfYearTest.php b/tests/Move/EndOfYearTest.php index d4731d4..c828cd0 100644 --- a/tests/Move/EndOfYearTest.php +++ b/tests/Move/EndOfYearTest.php @@ -18,7 +18,7 @@ public function testInterface($time, $expected) { $endOfYear = new EndOfYear; - $point = $endOfYear(PointInTime::at($time)); + $point = $endOfYear(PointInTime::at(new \DateTimeImmutable($time))); $this->assertSame($expected, $point->format(Format::of('Y-m-d H:i:s.u'))); } diff --git a/tests/Move/MonthTest.php b/tests/Move/MonthTest.php index bc68f6a..b65df8d 100644 --- a/tests/Move/MonthTest.php +++ b/tests/Move/MonthTest.php @@ -20,11 +20,11 @@ public function testInterface($time, $expectedForward, $expectedBackward) $forward = Month::forward(1); $backward = Month::backward(1); - $point = $forward(PointInTime::at($time)); + $point = $forward(PointInTime::at(new \DateTimeImmutable($time))); $this->assertSame($expectedForward, $point->format($format)); - $point = $backward(PointInTime::at($time)); + $point = $backward(PointInTime::at(new \DateTimeImmutable($time))); $this->assertSame($expectedBackward, $point->format($format)); } diff --git a/tests/Move/StartOfDayTest.php b/tests/Move/StartOfDayTest.php index 226cc01..a75feab 100644 --- a/tests/Move/StartOfDayTest.php +++ b/tests/Move/StartOfDayTest.php @@ -18,7 +18,7 @@ public function testInterface($time, $expected) { $startOfDay = new StartOfDay; - $point = $startOfDay(PointInTime::at($time)); + $point = $startOfDay(PointInTime::at(new \DateTimeImmutable($time))); $this->assertSame($expected, $point->format(Format::of('Y-m-d H:i:s.u'))); } diff --git a/tests/Move/StartOfMonthTest.php b/tests/Move/StartOfMonthTest.php index dbf168b..9cb5e49 100644 --- a/tests/Move/StartOfMonthTest.php +++ b/tests/Move/StartOfMonthTest.php @@ -18,7 +18,7 @@ public function testInterface($time, $expected) { $startOfMonth = new StartOfMonth; - $point = $startOfMonth(PointInTime::at($time)); + $point = $startOfMonth(PointInTime::at(new \DateTimeImmutable($time))); $this->assertSame($expected, $point->format(Format::of('Y-m-d H:i:s.u'))); } diff --git a/tests/Move/StartOfYearTest.php b/tests/Move/StartOfYearTest.php index ad4dba7..0059bc3 100644 --- a/tests/Move/StartOfYearTest.php +++ b/tests/Move/StartOfYearTest.php @@ -18,7 +18,7 @@ public function testInterface($time, $expected) { $startOfYear = new StartOfYear; - $point = $startOfYear(PointInTime::at($time)); + $point = $startOfYear(PointInTime::at(new \DateTimeImmutable($time))); $this->assertSame($expected, $point->format(Format::of('Y-m-d H:i:s.u'))); } diff --git a/tests/PointInTimeTest.php b/tests/PointInTimeTest.php index 8f96811..ad8e6a7 100644 --- a/tests/PointInTimeTest.php +++ b/tests/PointInTimeTest.php @@ -23,7 +23,7 @@ class PointInTimeTest extends TestCase { public function testInterface() { - $point = PointInTime::at('2016-10-05T08:01:30.123+02:00'); + $point = PointInTime::at(new \DateTimeImmutable('2016-10-05T08:01:30.123+02:00')); $this->assertInstanceOf(Year::class, $point->year()); $this->assertInstanceOf(Month::class, $point->month()); @@ -50,7 +50,7 @@ public function testInterface() public function testPreserveMillisecondsWhenNanosecondsInString() { - $point = PointInTime::at('2016-10-05T08:01:30.999678+02:00'); + $point = PointInTime::at(new \DateTimeImmutable('2016-10-05T08:01:30.999678+02:00')); $this->assertSame(999, $point->millisecond()->toInt()); $this->assertSame(30, $point->second()->toInt()); @@ -58,7 +58,7 @@ public function testPreserveMillisecondsWhenNanosecondsInString() public function testFormat() { - $point = PointInTime::at('2016-10-05T08:01:30.123+02:00'); + $point = PointInTime::at(new \DateTimeImmutable('2016-10-05T08:01:30.123+02:00')); $this->assertSame( '08:01:30 05/10/2016', @@ -68,7 +68,7 @@ public function testFormat() public function testChangeOffset() { - $point = PointInTime::at('2016-10-05T08:01:30.123+02:00'); + $point = PointInTime::at(new \DateTimeImmutable('2016-10-05T08:01:30.123+02:00')); $point2 = $point->changeOffset(Offset::of(-2, 30)); $this->assertNotSame($point, $point2); @@ -92,8 +92,8 @@ public function testChangeOffset() public function testElapsedSince() { - $point = PointInTime::at('2016-10-05T08:01:30.123+02:00'); - $point2 = PointInTime::at('2016-10-05T08:03:30.234+02:00'); + $point = PointInTime::at(new \DateTimeImmutable('2016-10-05T08:01:30.123+02:00')); + $point2 = PointInTime::at(new \DateTimeImmutable('2016-10-05T08:03:30.234+02:00')); $elapsed = $point2->elapsedSince($point); $this->assertInstanceOf(ElapsedPeriod::class, $elapsed); @@ -102,8 +102,8 @@ public function testElapsedSince() public function testAheadOf() { - $point = PointInTime::at('2016-10-05T08:01:30.123+02:00'); - $point2 = PointInTime::at('2016-10-05T08:03:30.234+02:00'); + $point = PointInTime::at(new \DateTimeImmutable('2016-10-05T08:01:30.123+02:00')); + $point2 = PointInTime::at(new \DateTimeImmutable('2016-10-05T08:03:30.234+02:00')); $this->assertTrue($point2->aheadOf($point)); $this->assertFalse($point->aheadOf($point2)); @@ -111,9 +111,9 @@ public function testAheadOf() public function testEquals() { - $point = PointInTime::at('2016-10-05T08:01:30.123+02:00'); - $point2 = PointInTime::at('2016-10-05T08:03:30.234+02:00'); - $point3 = PointInTime::at('2016-10-05T08:01:30.123+02:00'); + $point = PointInTime::at(new \DateTimeImmutable('2016-10-05T08:01:30.123+02:00')); + $point2 = PointInTime::at(new \DateTimeImmutable('2016-10-05T08:03:30.234+02:00')); + $point3 = PointInTime::at(new \DateTimeImmutable('2016-10-05T08:01:30.123+02:00')); $this->assertTrue($point->equals($point3)); $this->assertFalse($point->equals($point2)); @@ -121,7 +121,7 @@ public function testEquals() public function testGoForward() { - $point = PointInTime::at('2016-10-05T08:01:30.123+02:00'); + $point = PointInTime::at(new \DateTimeImmutable('2016-10-05T08:01:30.123+02:00')); $point2 = $point->goForward( Period::of(1, 1, 1, 1, 1, 30, 878), ); @@ -144,7 +144,7 @@ public function testGoForward() public function testGoBack() { - $point = PointInTime::at('2016-10-05T08:01:30.123+02:00'); + $point = PointInTime::at(new \DateTimeImmutable('2016-10-05T08:01:30.123+02:00')); $point2 = $point->goBack( Period::of(1, 1, 1, 1, 1, 30, 125), ); @@ -174,7 +174,7 @@ public function testGoBack() public function testGoBackOneDay() { - $point = PointInTime::at('2018-03-04'); + $point = PointInTime::at(new \DateTimeImmutable('2018-03-04')); $point2 = $point->goBack(Period::day(1)); $format = Format::of('Y-m-d\TH:i:s.u'); @@ -190,7 +190,7 @@ public function testGoBackOneDay() public function testGoBackOneMillisecondWhenCurrentPointIsAtPreciselyZeroMillisecond() { - $point = PointInTime::at('1402-07-21 02:42:53.000000'); + $point = PointInTime::at(new \DateTimeImmutable('1402-07-21 02:42:53.000000')); $point2 = $point->goBack(Period::millisecond(1)); $format = Format::of('Y-m-d\TH:i:s.u'); From b572df2795a0b58097aea60b71ff08981aa32ffa Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Sat, 23 Nov 2024 17:03:41 +0100 Subject: [PATCH 58/85] allow to specify periods down to the microsecond --- fixtures/Period.php | 5 +- proofs/move/endOfDay.php | 4 ++ proofs/move/endOfMonth.php | 4 ++ proofs/move/endOfYear.php | 4 ++ proofs/move/startOfDay.php | 4 ++ proofs/move/startOfMonth.php | 4 ++ proofs/move/startOfYear.php | 4 ++ proofs/period.php | 8 ++- src/Move/EndOfDay.php | 3 +- src/Move/Month.php | 3 +- src/Move/StartOfDay.php | 3 +- src/Period.php | 94 +++++++++++++++++++++++++++++------ src/PointInTime.php | 7 +++ tests/Fixtures/PeriodTest.php | 1 + tests/Move/EndOfDayTest.php | 8 +-- tests/Move/EndOfMonthTest.php | 12 ++--- tests/Move/EndOfYearTest.php | 10 ++-- tests/Move/MonthTest.php | 6 +-- tests/PointInTimeTest.php | 16 ++++++ 19 files changed, 163 insertions(+), 37 deletions(-) diff --git a/fixtures/Period.php b/fixtures/Period.php index 06e7256..41bb7ec 100644 --- a/fixtures/Period.php +++ b/fixtures/Period.php @@ -22,6 +22,7 @@ public static function any(): Set Set\Integers::between(0, 59), Set\Integers::between(0, 59), Set\Integers::between(0, 999), + Set\Integers::between(0, 999), )->take(100); } @@ -42,7 +43,7 @@ public static function anyNumberOfYear(): Set public static function lessThanAYear(): Set { return Set\Composite::immutable( - static function($day, $hour, $minute, $second, $millisecond): Model { + static function($day, $hour, $minute, $second, $millisecond, $microsecond): Model { return Model::of( 0, 0, @@ -51,6 +52,7 @@ static function($day, $hour, $minute, $second, $millisecond): Model { $minute, $second, $millisecond, + $microsecond, ); }, Set\Integers::between(0, 364), @@ -58,6 +60,7 @@ static function($day, $hour, $minute, $second, $millisecond): Model { Set\Integers::between(0, 59), Set\Integers::between(0, 59), Set\Integers::between(0, 999), + Set\Integers::between(0, 999), )->take(100); } } diff --git a/proofs/move/endOfDay.php b/proofs/move/endOfDay.php index 88131ea..6e092c6 100644 --- a/proofs/move/endOfDay.php +++ b/proofs/move/endOfDay.php @@ -46,6 +46,10 @@ static function($assert, $point) { 999, $endOfDay->millisecond()->toInt(), ); + $assert->same( + 999, + $endOfDay->microsecond()->toInt(), + ); }, ); }; diff --git a/proofs/move/endOfMonth.php b/proofs/move/endOfMonth.php index cecb036..f1e9e3d 100644 --- a/proofs/move/endOfMonth.php +++ b/proofs/move/endOfMonth.php @@ -46,6 +46,10 @@ static function($assert, $point) { 999, $endOfMonth->millisecond()->toInt(), ); + $assert->same( + 999, + $endOfMonth->microsecond()->toInt(), + ); }, ); }; diff --git a/proofs/move/endOfYear.php b/proofs/move/endOfYear.php index 63f7e64..77d56ed 100644 --- a/proofs/move/endOfYear.php +++ b/proofs/move/endOfYear.php @@ -46,6 +46,10 @@ static function($assert, $point) { 999, $endOfYear->millisecond()->toInt(), ); + $assert->same( + 999, + $endOfYear->microsecond()->toInt(), + ); }, ); }; diff --git a/proofs/move/startOfDay.php b/proofs/move/startOfDay.php index 8408ce5..5cd327e 100644 --- a/proofs/move/startOfDay.php +++ b/proofs/move/startOfDay.php @@ -46,6 +46,10 @@ static function($assert, $point) { 0, $startOfDay->millisecond()->toInt(), ); + $assert->same( + 0, + $startOfDay->microsecond()->toInt(), + ); }, ); }; diff --git a/proofs/move/startOfMonth.php b/proofs/move/startOfMonth.php index 8ebff40..7548ffd 100644 --- a/proofs/move/startOfMonth.php +++ b/proofs/move/startOfMonth.php @@ -46,6 +46,10 @@ static function($assert, $point) { 0, $startOfMonth->millisecond()->toInt(), ); + $assert->same( + 0, + $startOfMonth->microsecond()->toInt(), + ); }, ); }; diff --git a/proofs/move/startOfYear.php b/proofs/move/startOfYear.php index 4265284..b3ff07f 100644 --- a/proofs/move/startOfYear.php +++ b/proofs/move/startOfYear.php @@ -46,6 +46,10 @@ static function($assert, $point) { 0, $startOfYear->millisecond()->toInt(), ); + $assert->same( + 0, + $startOfYear->microsecond()->toInt(), + ); }, ); }; diff --git a/proofs/period.php b/proofs/period.php index b14b803..3d21a96 100644 --- a/proofs/period.php +++ b/proofs/period.php @@ -13,7 +13,8 @@ Set\Integers::between(0, 1_000_000), // hour Set\Integers::between(0, 1_000_000_000), // minute Set\Integers::above(0), // second - Set\Integers::above(0), // millsecond + Set\Integers::above(0), // millisecond + Set\Integers::above(0), // microsecond ); yield proof( @@ -60,6 +61,11 @@ static function($assert, $period) { ->int() ->greaterThanOrEqual(0) ->lessThanOrEqual(999); + $assert + ->number($period->microseconds()) + ->int() + ->greaterThanOrEqual(0) + ->lessThanOrEqual(999); }, ); }; diff --git a/src/Move/EndOfDay.php b/src/Move/EndOfDay.php index d3613b9..0c61acb 100644 --- a/src/Move/EndOfDay.php +++ b/src/Move/EndOfDay.php @@ -16,7 +16,8 @@ public function __invoke(PointInTime $point): PointInTime Period::hour(23 - $point->hour()->toInt()) ->add(Period::minute(59 - $point->minute()->toInt())) ->add(Period::second(59 - $point->second()->toInt())) - ->add(Period::millisecond(999 - $point->millisecond()->toInt())), + ->add(Period::millisecond(999 - $point->millisecond()->toInt())) + ->add(Period::microsecond(999 - $point->microsecond()->toInt())), ); } } diff --git a/src/Move/Month.php b/src/Move/Month.php index e0ddcbc..2b52b16 100644 --- a/src/Move/Month.php +++ b/src/Move/Month.php @@ -27,7 +27,8 @@ public function __invoke(PointInTime $point): PointInTime Period::hour($point->hour()->toInt()) ->add(Period::minute($point->minute()->toInt())) ->add(Period::second($point->second()->toInt())) - ->add(Period::millisecond($point->millisecond()->toInt())), + ->add(Period::millisecond($point->millisecond()->toInt())) + ->add(Period::microsecond($point->microsecond()->toInt())), ); if ($newPoint->month()->numberOfDays() < $point->day()->ofMonth()) { diff --git a/src/Move/StartOfDay.php b/src/Move/StartOfDay.php index a615560..cbfe3a9 100644 --- a/src/Move/StartOfDay.php +++ b/src/Move/StartOfDay.php @@ -16,7 +16,8 @@ public function __invoke(PointInTime $point): PointInTime Period::hour($point->hour()->toInt()) ->add(Period::minute($point->minute()->toInt())) ->add(Period::second($point->second()->toInt())) - ->add(Period::millisecond($point->millisecond()->toInt())), + ->add(Period::millisecond($point->millisecond()->toInt())) + ->add(Period::microsecond($point->microsecond()->toInt())), ); } } diff --git a/src/Period.php b/src/Period.php index 9b6a607..b4798f7 100644 --- a/src/Period.php +++ b/src/Period.php @@ -16,6 +16,7 @@ final class Period * @param int<0, 59> $minute * @param int<0, 59> $second * @param int<0, 999> $millisecond + * @param int<0, 999> $microsecond */ private function __construct( private int $year, @@ -25,6 +26,7 @@ private function __construct( private int $minute, private int $second, private int $millisecond, + private int $microsecond, ) { } @@ -38,6 +40,7 @@ private function __construct( * @param int<0, 59> $minute * @param int<0, 59> $second * @param int<0, 999> $millisecond + * @param int<0, 999> $microsecond */ public static function of( int $year, @@ -47,6 +50,7 @@ public static function of( int $minute, int $second, int $millisecond, + int $microsecond = 0, ): self { return new self( $year, @@ -56,6 +60,7 @@ public static function of( $minute, $second, $millisecond, + $microsecond, ); } @@ -69,6 +74,7 @@ public static function of( * @param int<0, max> $minute * @param int<0, max> $second * @param int<0, max> $millisecond + * @param int<0, max> $microsecond */ public static function composite( int $year, @@ -78,8 +84,10 @@ public static function composite( int $minute, int $second, int $millisecond, + int $microsecond = 0, ): self { - return self::millisecond($millisecond) + return self::microsecond($microsecond) + ->add(self::millisecond($millisecond)) ->add(self::second($second)) ->add(self::minute($minute)) ->add(self::hour($hour)) @@ -103,6 +111,7 @@ public static function year(int $year): self 0, 0, 0, + 0, ); } @@ -114,7 +123,7 @@ public static function year(int $year): self public static function month(int $month): self { if ($month < 12) { - return new self(0, $month, 0, 0, 0, 0, 0); + return new self(0, $month, 0, 0, 0, 0, 0, 0); } /** @var int<0, max> */ @@ -129,6 +138,7 @@ public static function month(int $month): self 0, 0, 0, + 0, ); } @@ -147,6 +157,7 @@ public static function day(int $day): self 0, 0, 0, + 0, ); } @@ -158,7 +169,7 @@ public static function day(int $day): self public static function hour(int $hour): self { if ($hour < 24) { - return new self(0, 0, 0, $hour, 0, 0, 0); + return new self(0, 0, 0, $hour, 0, 0, 0, 0); } /** @var int<0, max> */ @@ -173,6 +184,7 @@ public static function hour(int $hour): self 0, 0, 0, + 0, ); } @@ -184,7 +196,7 @@ public static function hour(int $hour): self public static function minute(int $minute): self { if ($minute < 60) { - return new self(0, 0, 0, 0, $minute, 0, 0); + return new self(0, 0, 0, 0, $minute, 0, 0, 0); } /** @var int<0, max> */ @@ -200,6 +212,7 @@ public static function minute(int $minute): self $minute, 0, 0, + 0, ); } @@ -211,7 +224,7 @@ public static function minute(int $minute): self public static function second(int $second): self { if ($second < 60) { - return new self(0, 0, 0, 0, 0, $second, 0); + return new self(0, 0, 0, 0, 0, $second, 0, 0); } /** @var int<0, max> */ @@ -227,6 +240,7 @@ public static function second(int $second): self $minute->minutes(), $second, 0, + 0, ); } @@ -238,7 +252,7 @@ public static function second(int $second): self public static function millisecond(int $millisecond): self { if ($millisecond < 1_000) { - return new self(0, 0, 0, 0, 0, 0, $millisecond); + return new self(0, 0, 0, 0, 0, 0, $millisecond, 0); } /** @var int<0, max> */ @@ -254,6 +268,35 @@ public static function millisecond(int $millisecond): self $second->minutes(), $second->seconds(), $millisecond, + 0, + ); + } + + /** + * @psalm-pure + * + * @param 0|positive-int $microsecond + */ + public static function microsecond(int $microsecond): self + { + if ($microsecond < 1_000) { + return new self(0, 0, 0, 0, 0, 0, 0, $microsecond); + } + + /** @var int<0, max> */ + $millisecond = (int) ($microsecond / 1000); + $millisecond = self::millisecond($millisecond); + $microsecond = $microsecond % 1000; + + return new self( + $millisecond->years(), + $millisecond->months(), + $millisecond->days(), + $millisecond->hours(), + $millisecond->minutes(), + $millisecond->seconds(), + $millisecond->milliseconds(), + $microsecond, ); } @@ -313,6 +356,14 @@ public function milliseconds(): int return $this->millisecond; } + /** + * @return int<0, 999> + */ + public function microseconds(): int + { + return $this->microsecond; + } + public function equals(self $period): bool { return $this->year === $period->years() && @@ -321,27 +372,38 @@ public function equals(self $period): bool $this->hour === $period->hours() && $this->minute === $period->minutes() && $this->second === $period->seconds() && - $this->millisecond === $period->milliseconds(); + $this->millisecond === $period->milliseconds() && + $this->microsecond === $period->microseconds(); } public function add(self $period): self { - $millisecond = self::millisecond($this->millisecond + $period->milliseconds()); + $microsecond = self::microsecond($this->microsecond + $period->microseconds()); + $millisecond = self::millisecond( + $this->millisecond + + $period->milliseconds() + + $microsecond->milliseconds(), + ); $second = self::second( - $this->second + $period->seconds() + $millisecond->seconds(), + $this->second + + $period->seconds() + + $millisecond->seconds() + + $microsecond->seconds(), ); $minute = self::minute( $this->minute + $period->minutes() + $second->minutes() + - $millisecond->minutes(), + $millisecond->minutes() + + $microsecond->minutes(), ); $hour = self::hour( $this->hour + $period->hours() + $minute->hours() + $second->hours() + - $millisecond->hours(), + $millisecond->hours() + + $microsecond->hours(), ); $day = self::day( $this->day + @@ -349,7 +411,8 @@ public function add(self $period): self $hour->days() + $minute->days() + $second->days() + - $millisecond->days(), + $millisecond->days() + + $microsecond->days(), ); $month = self::month( $this->month + @@ -358,7 +421,8 @@ public function add(self $period): self $hour->months() + $minute->months() + $second->months() + - $millisecond->months(), + $millisecond->months() + + $microsecond->months(), ); $year = self::year( $this->year + @@ -368,7 +432,8 @@ public function add(self $period): self $hour->years() + $minute->years() + $second->years() + - $millisecond->years(), + $millisecond->years() + + $microsecond->years(), ); return new self( @@ -379,6 +444,7 @@ public function add(self $period): self $minute->minutes(), $second->seconds(), $millisecond->milliseconds(), + $microsecond->microseconds(), ); } diff --git a/src/PointInTime.php b/src/PointInTime.php index a6e2369..63fa700 100644 --- a/src/PointInTime.php +++ b/src/PointInTime.php @@ -253,6 +253,13 @@ private static function dateInterval(Period $period): ?\DateInterval ); } + if ($period->microseconds() > 0) { + $parts[] = \sprintf( + '%s microseconds', + $period->microseconds(), + ); + } + if (\count($parts) === 0) { return null; } diff --git a/tests/Fixtures/PeriodTest.php b/tests/Fixtures/PeriodTest.php index b931962..ab36dae 100644 --- a/tests/Fixtures/PeriodTest.php +++ b/tests/Fixtures/PeriodTest.php @@ -79,6 +79,7 @@ public function testLessThanAYear() $value->minutes(), $value->seconds(), $value->milliseconds(), + $value->microseconds(), ]; if (!\in_array($generated, $unique, true)) { diff --git a/tests/Move/EndOfDayTest.php b/tests/Move/EndOfDayTest.php index 27764bb..58d7f9b 100644 --- a/tests/Move/EndOfDayTest.php +++ b/tests/Move/EndOfDayTest.php @@ -26,10 +26,10 @@ public function testInterface($time, $expected) public static function cases(): array { return [ - ['2016-02-29 13:12:11.675', '2016-02-29 23:59:59.999000'], - ['2018-04-28 01:12:11.675', '2018-04-28 23:59:59.999000'], - ['2018-04-01 00:00:00.000', '2018-04-01 23:59:59.999000'], - ['2018-04-01 23:59:59.999', '2018-04-01 23:59:59.999000'], + ['2016-02-29 13:12:11.675', '2016-02-29 23:59:59.999999'], + ['2018-04-28 01:12:11.675', '2018-04-28 23:59:59.999999'], + ['2018-04-01 00:00:00.000', '2018-04-01 23:59:59.999999'], + ['2018-04-01 23:59:59.999', '2018-04-01 23:59:59.999999'], ]; } } diff --git a/tests/Move/EndOfMonthTest.php b/tests/Move/EndOfMonthTest.php index 45ffbc8..40df9e1 100644 --- a/tests/Move/EndOfMonthTest.php +++ b/tests/Move/EndOfMonthTest.php @@ -26,12 +26,12 @@ public function testInterface($time, $expected) public static function cases(): array { return [ - ['2016-02-01 00:00:00.000', '2016-02-29 23:59:59.999000'], - ['2016-02-05 00:00:00.000', '2016-02-29 23:59:59.999000'], - ['2018-02-01 00:00:00.000', '2018-02-28 23:59:59.999000'], - ['2018-04-01 00:00:00.000', '2018-04-30 23:59:59.999000'], - ['2018-01-01 00:00:00.000', '2018-01-31 23:59:59.999000'], - ['2018-04-30 23:59:59.999', '2018-04-30 23:59:59.999000'], + ['2016-02-01 00:00:00.000', '2016-02-29 23:59:59.999999'], + ['2016-02-05 00:00:00.000', '2016-02-29 23:59:59.999999'], + ['2018-02-01 00:00:00.000', '2018-02-28 23:59:59.999999'], + ['2018-04-01 00:00:00.000', '2018-04-30 23:59:59.999999'], + ['2018-01-01 00:00:00.000', '2018-01-31 23:59:59.999999'], + ['2018-04-30 23:59:59.999', '2018-04-30 23:59:59.999999'], ]; } } diff --git a/tests/Move/EndOfYearTest.php b/tests/Move/EndOfYearTest.php index c828cd0..3763001 100644 --- a/tests/Move/EndOfYearTest.php +++ b/tests/Move/EndOfYearTest.php @@ -26,11 +26,11 @@ public function testInterface($time, $expected) public static function cases(): array { return [ - ['2016-02-29 13:12:11.675', '2016-12-31 23:59:59.999000'], - ['2018-04-28 01:12:11.675', '2018-12-31 23:59:59.999000'], - ['2018-04-01 00:00:00.000', '2018-12-31 23:59:59.999000'], - ['2018-01-01 00:00:00.000', '2018-12-31 23:59:59.999000'], - ['2018-12-31 23:59:59.999', '2018-12-31 23:59:59.999000'], + ['2016-02-29 13:12:11.675', '2016-12-31 23:59:59.999999'], + ['2018-04-28 01:12:11.675', '2018-12-31 23:59:59.999999'], + ['2018-04-01 00:00:00.000', '2018-12-31 23:59:59.999999'], + ['2018-01-01 00:00:00.000', '2018-12-31 23:59:59.999999'], + ['2018-12-31 23:59:59.999', '2018-12-31 23:59:59.999999'], ]; } } diff --git a/tests/Move/MonthTest.php b/tests/Move/MonthTest.php index b65df8d..7f227d0 100644 --- a/tests/Move/MonthTest.php +++ b/tests/Move/MonthTest.php @@ -32,9 +32,9 @@ public function testInterface($time, $expectedForward, $expectedBackward) public static function cases(): array { return [ - ['2016-02-29 13:12:11.675', '2016-03-29 13:12:11.675000', '2016-01-29 13:12:11.675000'], - ['2016-01-30 13:12:11.675', '2016-02-29 13:12:11.675000', '2015-12-30 13:12:11.675000'], - ['2017-12-31 13:12:11.675', '2018-01-31 13:12:11.675000', '2017-11-30 13:12:11.675000'], + ['2016-02-29 13:12:11.675342', '2016-03-29 13:12:11.675342', '2016-01-29 13:12:11.675342'], + ['2016-01-30 13:12:11.675342', '2016-02-29 13:12:11.675342', '2015-12-30 13:12:11.675342'], + ['2017-12-31 13:12:11.675342', '2018-01-31 13:12:11.675342', '2017-11-30 13:12:11.675342'], ]; } } diff --git a/tests/PointInTimeTest.php b/tests/PointInTimeTest.php index ad8e6a7..35f2f45 100644 --- a/tests/PointInTimeTest.php +++ b/tests/PointInTimeTest.php @@ -203,4 +203,20 @@ public function testGoBackOneMillisecondWhenCurrentPointIsAtPreciselyZeroMillise $point2->format($format), ); } + + public function testGoBackOneMicrosecondWhenCurrentPointIsAtPreciselyZeroMillisecond() + { + $point = PointInTime::at(new \DateTimeImmutable('1402-07-21 02:42:53.000000')); + $point2 = $point->goBack(Period::microsecond(1)); + $format = Format::of('Y-m-d\TH:i:s.u'); + + $this->assertSame( + '1402-07-21T02:42:53.000000', + $point->format($format), + ); + $this->assertSame( + '1402-07-21T02:42:52.999999', + $point2->format($format), + ); + } } From 1886c8bcb2902f29b38e11d9c3b8592a49c8dfdd Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Sat, 23 Nov 2024 17:08:02 +0100 Subject: [PATCH 59/85] remove ElapsedPeriod::maybe() --- CHANGELOG.md | 1 + src/ElapsedPeriod.php | 17 ----------------- tests/ElapsedPeriodTest.php | 12 ------------ 3 files changed, 1 insertion(+), 29 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c76620c..1962da6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -56,6 +56,7 @@ - `Innmind\TimeContinuum\PointInTime\Month::toString()` - `Innmind\TimeContinuum\PointInTime\Day::weekNumber()` - `Innmind\TimeContinuum\PointInTime\Day::toString()` +- `Innmind\TimeContinuum\ElapsedPeriod::maybe()` ## 3.4.1 - 2023-09-17 diff --git a/src/ElapsedPeriod.php b/src/ElapsedPeriod.php index 5e2e512..39d5213 100644 --- a/src/ElapsedPeriod.php +++ b/src/ElapsedPeriod.php @@ -3,8 +3,6 @@ namespace Innmind\TimeContinuum; -use Innmind\Immutable\Maybe; - /** * @psalm-immutable */ @@ -42,21 +40,6 @@ public static function literal(int $milliseconds): self return new self($milliseconds); } - /** - * @psalm-pure - * - * @return Maybe - */ - public static function maybe(int $milliseconds): Maybe - { - try { - return Maybe::just(new self($milliseconds)); - } catch (\RuntimeException $e) { - /** @var Maybe */ - return Maybe::nothing(); - } - } - /** * @psalm-pure * diff --git a/tests/ElapsedPeriodTest.php b/tests/ElapsedPeriodTest.php index fee9753..cbf3054 100644 --- a/tests/ElapsedPeriodTest.php +++ b/tests/ElapsedPeriodTest.php @@ -26,18 +26,6 @@ public function testThrowWhenTryingToBuildANegativePeriod() ElapsedPeriod::of(-42); } - public function testMaybe() - { - $this->assertInstanceOf(ElapsedPeriod::class, ElapsedPeriod::maybe(42)->match( - static fn($period) => $period, - static fn() => null, - )); - $this->assertNull(ElapsedPeriod::maybe(-42)->match( - static fn($period) => $period, - static fn() => null, - )); - } - public function testLongerThan() { $this->assertTrue( From 9a203eb40477cabc6ba01332ff0ff6f7570fcbcd Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Sat, 23 Nov 2024 17:17:20 +0100 Subject: [PATCH 60/85] remove ElapsedPeriod::literal() --- src/ElapsedPeriod.php | 12 +----------- tests/ElapsedPeriodTest.php | 2 +- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/src/ElapsedPeriod.php b/src/ElapsedPeriod.php index 39d5213..03817f7 100644 --- a/src/ElapsedPeriod.php +++ b/src/ElapsedPeriod.php @@ -25,17 +25,7 @@ private function __construct(int $milliseconds) * * @throws \RuntimeException */ - public static function of(int $milliseconds): self - { - return new self($milliseconds); - } - - /** - * @psalm-pure - * - * @param int<0, max> $milliseconds - */ - public static function literal(int $milliseconds): self + public static function of(int $microseconds): self { return new self($milliseconds); } diff --git a/tests/ElapsedPeriodTest.php b/tests/ElapsedPeriodTest.php index cbf3054..289b59c 100644 --- a/tests/ElapsedPeriodTest.php +++ b/tests/ElapsedPeriodTest.php @@ -13,7 +13,7 @@ class ElapsedPeriodTest extends TestCase { public function testInterface() { - $period = ElapsedPeriod::literal(42); + $period = ElapsedPeriod::of(42); $this->assertSame(42, $period->milliseconds()); } From eefc9d0bbfa5afe726a3db8a984b0ad7e543a5f6 Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Sat, 23 Nov 2024 17:18:18 +0100 Subject: [PATCH 61/85] flag ElapsedPeriod as internal --- CHANGELOG.md | 1 + src/ElapsedPeriod.php | 1 + 2 files changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1962da6..025740d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -38,6 +38,7 @@ - `Innmind\TimeContinuum\PointInTime::changeTimezone()` has been renamed `Innmind\TimeContinuum\PointInTime::changeOffset()` - `Innmind\TimeContinuum\PointInTime::timezone()` has been renamed `Innmind\TimeContinuum\PointInTime::offset()` - `Innmind\TimeContinuum\PointInTime\Day::toInt()` has been renamed `Innmind\TimeContinuum\PointInTime\Day::ofMonth()` +- `Innmind\TimeContinuum\ElapsedPeriod::of()` is now an `internal` method ### Removed diff --git a/src/ElapsedPeriod.php b/src/ElapsedPeriod.php index 03817f7..7b2c498 100644 --- a/src/ElapsedPeriod.php +++ b/src/ElapsedPeriod.php @@ -22,6 +22,7 @@ private function __construct(int $milliseconds) /** * @psalm-pure + * @internal * * @throws \RuntimeException */ From b90eb74a4af0cc9b03c54c7906132ccd913d17c2 Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Sat, 23 Nov 2024 17:54:06 +0100 Subject: [PATCH 62/85] fix comparing point in times down to the microsecond --- proofs/clock.php | 33 ++++++++++++++++++++++++++++++++- src/PointInTime.php | 22 ++++++++++++++++++++-- 2 files changed, 52 insertions(+), 3 deletions(-) diff --git a/proofs/clock.php b/proofs/clock.php index 78e0ba2..63f82b3 100644 --- a/proofs/clock.php +++ b/proofs/clock.php @@ -1,7 +1,10 @@ lessThanOrEqual(366); }, ); + + yield proof( + 'Point in times precision is down to the microsecond', + given(PointInTime::any()), + static function($assert, $point) { + $assert->false( + $point->equals( + $point->goBack(Period::microsecond(1)), + ), + ); + $assert->false( + $point->equals( + $point->goForward(Period::microsecond(1)), + ), + ); + + $assert->true( + $point->goForward(Period::microsecond(1))->aheadOf( + $point, + ), + ); + $assert->true( + $point->aheadOf( + $point->goBack(Period::microsecond(1)), + ), + ); + }, + ); }; diff --git a/src/PointInTime.php b/src/PointInTime.php index 63fa700..e38e231 100644 --- a/src/PointInTime.php +++ b/src/PointInTime.php @@ -183,12 +183,16 @@ public function goForward(Period $period): self public function equals(self $point): bool { - return $this->milliseconds() === $point->milliseconds(); + [$self, $other] = self::compare($this, $point); + + return $self === $other; } public function aheadOf(self $point): bool { - return $this->milliseconds() > $point->milliseconds(); + [$self, $other] = self::compare($this, $point); + + return $self > $other; } public function toString(): string @@ -196,6 +200,20 @@ public function toString(): string return $this->date->format(\DateTime::ATOM); } + /** + * @psalm-pure + * @return array{string, string} + */ + private static function compare(self $self, self $other): array + { + $format = Format::of('Y-m-dTH:i:s.u'); + + return [ + $self->changeOffset(Offset::utc())->format($format), + $other->changeOffset(Offset::utc())->format($format), + ]; + } + /** * @psalm-pure */ From a0b4603cc6686c499a461ab2cf79d9a9ae593384 Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Sat, 23 Nov 2024 17:59:48 +0100 Subject: [PATCH 63/85] keep track of microseconds in elapsed time --- src/ElapsedPeriod.php | 35 ++++++++++++++++-------- src/PointInTime.php | 7 ++++- src/PointInTime/HighResolution.php | 4 +-- tests/ElapsedPeriodTest.php | 6 ++++ tests/PointInTime/HighResolutionTest.php | 3 +- 5 files changed, 40 insertions(+), 15 deletions(-) diff --git a/src/ElapsedPeriod.php b/src/ElapsedPeriod.php index 7b2c498..9e3b7e6 100644 --- a/src/ElapsedPeriod.php +++ b/src/ElapsedPeriod.php @@ -9,15 +9,15 @@ final class ElapsedPeriod { /** @var int<0, max> */ - private int $milliseconds; + private int $microseconds; - private function __construct(int $milliseconds) + private function __construct(int $microseconds) { - if ($milliseconds < 0) { - throw new \RuntimeException((string) $milliseconds); + if ($microseconds < 0) { + throw new \RuntimeException((string) $microseconds); } - $this->milliseconds = $milliseconds; + $this->microseconds = $microseconds; } /** @@ -28,7 +28,7 @@ private function __construct(int $milliseconds) */ public static function of(int $microseconds): self { - return new self($milliseconds); + return new self($microseconds); } /** @@ -40,7 +40,7 @@ public static function ofPeriod(Period $period): self { if ($period->months() !== 0 || $period->years() !== 0) { // a month or a year is not constant - throw new \LogicException('Months and years can not be converted to milliseconds'); + throw new \LogicException('Months and years can not be converted to microseconds'); } $milliseconds = Period\Value::day->milliseconds($period->days()) + @@ -48,22 +48,35 @@ public static function ofPeriod(Period $period): self Period\Value::minute->milliseconds($period->minutes()) + Period\Value::second->milliseconds($period->seconds()) + $period->milliseconds(); + $milliseconds *= 1_000; - return new self($milliseconds); + return new self($milliseconds + $period->microseconds()); } + /** + * @return int<0, max> + */ public function milliseconds(): int { - return $this->milliseconds; + /** @var int<0, max> */ + return (int) ($this->microseconds / 1_000); + } + + /** + * @return int<0, max> + */ + public function microseconds(): int + { + return $this->microseconds; } public function longerThan(self $period): bool { - return $this->milliseconds > $period->milliseconds(); + return $this->microseconds > $period->microseconds; } public function equals(self $period): bool { - return $this->milliseconds === $period->milliseconds(); + return $this->microseconds === $period->microseconds; } } diff --git a/src/PointInTime.php b/src/PointInTime.php index e38e231..0ddee11 100644 --- a/src/PointInTime.php +++ b/src/PointInTime.php @@ -150,7 +150,12 @@ public function elapsedSince(self $point): ElapsedPeriod return $this->highResolution->elapsedSince($point->highResolution); } - return ElapsedPeriod::of($this->milliseconds() - $point->milliseconds()); + $milliseconds = $this->milliseconds() - $point->milliseconds(); + $microseconds = $milliseconds * 1_000; + $microseconds += $this->microsecond()->toInt(); + $microseconds -= $point->microsecond()->toInt(); + + return ElapsedPeriod::of($microseconds); } public function goBack(Period $period): self diff --git a/src/PointInTime/HighResolution.php b/src/PointInTime/HighResolution.php index 9bdd7e2..7b20455 100644 --- a/src/PointInTime/HighResolution.php +++ b/src/PointInTime/HighResolution.php @@ -51,8 +51,8 @@ public function elapsedSince(self $time): ElapsedPeriod $seconds = $this->seconds - $time->seconds; $nanoseconds = $this->nanoseconds - $time->nanoseconds; - $milliseconds = ($seconds * 1_000) + (int) ($nanoseconds / 1_000_000); + $microseconds = ($seconds * 1_000_000) + (int) ($nanoseconds / 1_000); - return ElapsedPeriod::of($milliseconds); + return ElapsedPeriod::of($microseconds); } } diff --git a/tests/ElapsedPeriodTest.php b/tests/ElapsedPeriodTest.php index 289b59c..2ecf8a0 100644 --- a/tests/ElapsedPeriodTest.php +++ b/tests/ElapsedPeriodTest.php @@ -15,7 +15,13 @@ public function testInterface() { $period = ElapsedPeriod::of(42); + $this->assertSame(0, $period->milliseconds()); + $this->assertSame(42, $period->microseconds()); + + $period = ElapsedPeriod::of(42_000); + $this->assertSame(42, $period->milliseconds()); + $this->assertSame(42_000, $period->microseconds()); } public function testThrowWhenTryingToBuildANegativePeriod() diff --git a/tests/PointInTime/HighResolutionTest.php b/tests/PointInTime/HighResolutionTest.php index 87b8f0b..3a29d0c 100644 --- a/tests/PointInTime/HighResolutionTest.php +++ b/tests/PointInTime/HighResolutionTest.php @@ -53,6 +53,7 @@ public function test1() $started = HighResolution::of(684461, 547614375); $end = HighResolution::of(684462, 602541); - $this->assertSame(453, $end->elapsedSince($started)->milliseconds()); + $this->assertSame(452, $end->elapsedSince($started)->milliseconds()); + $this->assertSame(452989, $end->elapsedSince($started)->microseconds()); } } From 13ff7981c2b2d653aa7d1fc438b25c968a683575 Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Sat, 23 Nov 2024 18:02:58 +0100 Subject: [PATCH 64/85] remove ElapsedPeriod::ofPeriod() --- CHANGELOG.md | 1 + src/ElapsedPeriod.php | 22 ---------------------- src/Period.php | 17 ++++++++++++++++- tests/ElapsedPeriodTest.php | 4 ++-- 4 files changed, 19 insertions(+), 25 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 025740d..79e4508 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -58,6 +58,7 @@ - `Innmind\TimeContinuum\PointInTime\Day::weekNumber()` - `Innmind\TimeContinuum\PointInTime\Day::toString()` - `Innmind\TimeContinuum\ElapsedPeriod::maybe()` +- `Innmind\TimeContinuum\ElapsedPeriod::ofPeriod()` ## 3.4.1 - 2023-09-17 diff --git a/src/ElapsedPeriod.php b/src/ElapsedPeriod.php index 9e3b7e6..cacb0af 100644 --- a/src/ElapsedPeriod.php +++ b/src/ElapsedPeriod.php @@ -31,28 +31,6 @@ public static function of(int $microseconds): self return new self($microseconds); } - /** - * @psalm-pure - * - * @throws \LogicException When using a period containing months or years - */ - public static function ofPeriod(Period $period): self - { - if ($period->months() !== 0 || $period->years() !== 0) { - // a month or a year is not constant - throw new \LogicException('Months and years can not be converted to microseconds'); - } - - $milliseconds = Period\Value::day->milliseconds($period->days()) + - Period\Value::hour->milliseconds($period->hours()) + - Period\Value::minute->milliseconds($period->minutes()) + - Period\Value::second->milliseconds($period->seconds()) + - $period->milliseconds(); - $milliseconds *= 1_000; - - return new self($milliseconds + $period->microseconds()); - } - /** * @return int<0, max> */ diff --git a/src/Period.php b/src/Period.php index b4798f7..4f6ce8b 100644 --- a/src/Period.php +++ b/src/Period.php @@ -448,8 +448,23 @@ public function add(self $period): self ); } + /** + * @throws \LogicException When using a period containing months or years + */ public function asElapsedPeriod(): ElapsedPeriod { - return ElapsedPeriod::ofPeriod($this); + if ($this->months() !== 0 || $this->years() !== 0) { + // a month or a year is not constant + throw new \LogicException('Months and years can not be converted to microseconds'); + } + + $milliseconds = Period\Value::day->milliseconds($this->days()) + + Period\Value::hour->milliseconds($this->hours()) + + Period\Value::minute->milliseconds($this->minutes()) + + Period\Value::second->milliseconds($this->seconds()) + + $this->milliseconds(); + $milliseconds *= 1_000; + + return ElapsedPeriod::of($milliseconds + $this->microseconds()); } } diff --git a/tests/ElapsedPeriodTest.php b/tests/ElapsedPeriodTest.php index 2ecf8a0..cef8933 100644 --- a/tests/ElapsedPeriodTest.php +++ b/tests/ElapsedPeriodTest.php @@ -64,13 +64,13 @@ public function testThrowWhenTryingToBuildFromYearPeriod() { $this->expectException(\LogicException::class); - ElapsedPeriod::ofPeriod(Period::year(1)); + Period::year(1)->asElapsedPeriod(); } public function testThrowWhenTryingToBuildFromMonthPeriod() { $this->expectException(\LogicException::class); - ElapsedPeriod::ofPeriod(Period::month(1)); + Period::month(1)->asElapsedPeriod(); } } From a24f8f6425f5046e0f159f5335b0589f3d87843f Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Sat, 23 Nov 2024 18:10:49 +0100 Subject: [PATCH 65/85] force specifying the microseconds --- src/Period.php | 4 ++-- tests/PointInTimeTest.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Period.php b/src/Period.php index 4f6ce8b..d757f1d 100644 --- a/src/Period.php +++ b/src/Period.php @@ -50,7 +50,7 @@ public static function of( int $minute, int $second, int $millisecond, - int $microsecond = 0, + int $microsecond, ): self { return new self( $year, @@ -84,7 +84,7 @@ public static function composite( int $minute, int $second, int $millisecond, - int $microsecond = 0, + int $microsecond, ): self { return self::microsecond($microsecond) ->add(self::millisecond($millisecond)) diff --git a/tests/PointInTimeTest.php b/tests/PointInTimeTest.php index 35f2f45..243612f 100644 --- a/tests/PointInTimeTest.php +++ b/tests/PointInTimeTest.php @@ -123,7 +123,7 @@ public function testGoForward() { $point = PointInTime::at(new \DateTimeImmutable('2016-10-05T08:01:30.123+02:00')); $point2 = $point->goForward( - Period::of(1, 1, 1, 1, 1, 30, 878), + Period::of(1, 1, 1, 1, 1, 30, 878, 0), ); $this->assertSame(2016, $point->year()->toInt()); @@ -146,7 +146,7 @@ public function testGoBack() { $point = PointInTime::at(new \DateTimeImmutable('2016-10-05T08:01:30.123+02:00')); $point2 = $point->goBack( - Period::of(1, 1, 1, 1, 1, 30, 125), + Period::of(1, 1, 1, 1, 1, 30, 125, 0), ); $this->assertSame(2016, $point->year()->toInt()); From 1c01aaea5831e0c5c83a8b91c578923c230a34a4 Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Sat, 23 Nov 2024 18:17:51 +0100 Subject: [PATCH 66/85] cover failing paths of Clock::at() --- proofs/clock.php | 26 ++++++++++++++++++++++++++ src/Clock/Live.php | 4 ++-- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/proofs/clock.php b/proofs/clock.php index 63f82b3..0c4ca00 100644 --- a/proofs/clock.php +++ b/proofs/clock.php @@ -4,6 +4,7 @@ use Innmind\TimeContinuum\{ Clock, Period, + Format, }; use Fixtures\Innmind\TimeContinuum\PointInTime; use Innmind\BlackBox\Set; @@ -91,4 +92,29 @@ static function($assert, $point) { ); }, ); + + yield proof( + 'Clock::at() returns nothing for invalid strings', + given( + Set\Unicode::strings(), + Set\Elements::of( + null, + Format::cookie(), + Format::iso8601(), + Format::rfc1036(), + Format::rfc1123(), + Format::rfc2822(), + Format::rfc822(), + Format::rfc850(), + Format::rss(), + Format::w3c(), + ), + ), + static fn($assert, $string, $format) => $assert->null( + Clock::live()->at($string, $format)->match( + static fn($point) => $point, + static fn() => null, + ), + ), + ); }; diff --git a/src/Clock/Live.php b/src/Clock/Live.php index 56ea62e..87a2685 100644 --- a/src/Clock/Live.php +++ b/src/Clock/Live.php @@ -63,7 +63,7 @@ public function at(string $date, Format $format = null): Maybe try { /** @psalm-suppress ImpureMethodCall */ $datetime = \DateTimeImmutable::createFromFormat($format->toString(), $date); - } catch (\ValueError) { + } catch (\Throwable) { /** @var Maybe */ return Maybe::nothing(); } @@ -83,7 +83,7 @@ public function at(string $date, Format $format = null): Maybe try { /** @psalm-suppress ImpureMethodCall */ $datetime = new \DateTimeImmutable($date); - } catch (\ValueError) { + } catch (\Throwable) { /** @var Maybe */ return Maybe::nothing(); } From c31d496607dce99a054777a847c082b314c55793 Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Sun, 24 Nov 2024 10:04:49 +0100 Subject: [PATCH 67/85] remove useless ::toString() methods --- CHANGELOG.md | 6 ++++++ src/PointInTime/Hour.php | 8 -------- src/PointInTime/Microsecond.php | 8 -------- src/PointInTime/Millisecond.php | 8 -------- src/PointInTime/Minute.php | 8 -------- src/PointInTime/Second.php | 8 -------- src/PointInTime/Year.php | 8 -------- tests/PointInTime/HourTest.php | 1 - tests/PointInTime/MillisecondTest.php | 1 - tests/PointInTime/MinuteTest.php | 1 - tests/PointInTime/SecondTest.php | 1 - tests/PointInTime/YearTest.php | 1 - 12 files changed, 6 insertions(+), 53 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 79e4508..e450212 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -57,6 +57,12 @@ - `Innmind\TimeContinuum\PointInTime\Month::toString()` - `Innmind\TimeContinuum\PointInTime\Day::weekNumber()` - `Innmind\TimeContinuum\PointInTime\Day::toString()` +- `Innmind\TimeContinuum\PointInTime\Hour::toString()` +- `Innmind\TimeContinuum\PointInTime\Microsecond::toString()` +- `Innmind\TimeContinuum\PointInTime\Millisecond::toString()` +- `Innmind\TimeContinuum\PointInTime\Minute::toString()` +- `Innmind\TimeContinuum\PointInTime\Second::toString()` +- `Innmind\TimeContinuum\PointInTime\Year::toString()` - `Innmind\TimeContinuum\ElapsedPeriod::maybe()` - `Innmind\TimeContinuum\ElapsedPeriod::ofPeriod()` diff --git a/src/PointInTime/Hour.php b/src/PointInTime/Hour.php index 3bc2c1c..834aafc 100644 --- a/src/PointInTime/Hour.php +++ b/src/PointInTime/Hour.php @@ -42,12 +42,4 @@ public function toInt(): int { return $this->hour; } - - /** - * @return non-empty-string - */ - public function toString(): string - { - return (string) $this->hour; - } } diff --git a/src/PointInTime/Microsecond.php b/src/PointInTime/Microsecond.php index dd78e36..ce86738 100644 --- a/src/PointInTime/Microsecond.php +++ b/src/PointInTime/Microsecond.php @@ -34,12 +34,4 @@ public function toInt(): int { return $this->microsecond; } - - /** - * @return non-empty-string - */ - public function toString(): string - { - return (string) $this->microsecond; - } } diff --git a/src/PointInTime/Millisecond.php b/src/PointInTime/Millisecond.php index c9b5821..c9ee2ec 100644 --- a/src/PointInTime/Millisecond.php +++ b/src/PointInTime/Millisecond.php @@ -34,12 +34,4 @@ public function toInt(): int { return $this->millisecond; } - - /** - * @return non-empty-string - */ - public function toString(): string - { - return (string) $this->millisecond; - } } diff --git a/src/PointInTime/Minute.php b/src/PointInTime/Minute.php index d6a3425..8c3efac 100644 --- a/src/PointInTime/Minute.php +++ b/src/PointInTime/Minute.php @@ -42,12 +42,4 @@ public function toInt(): int { return $this->minute; } - - /** - * @return non-empty-string - */ - public function toString(): string - { - return (string) $this->minute; - } } diff --git a/src/PointInTime/Second.php b/src/PointInTime/Second.php index fed5b03..1685448 100644 --- a/src/PointInTime/Second.php +++ b/src/PointInTime/Second.php @@ -34,12 +34,4 @@ public function toInt(): int { return $this->second; } - - /** - * @return non-empty-string - */ - public function toString(): string - { - return (string) $this->second; - } } diff --git a/src/PointInTime/Year.php b/src/PointInTime/Year.php index 3876277..5b9d361 100644 --- a/src/PointInTime/Year.php +++ b/src/PointInTime/Year.php @@ -48,12 +48,4 @@ public function toInt(): int { return $this->year; } - - /** - * @return non-empty-string - */ - public function toString(): string - { - return (string) $this->year; - } } diff --git a/tests/PointInTime/HourTest.php b/tests/PointInTime/HourTest.php index 3f2e558..1ab8175 100644 --- a/tests/PointInTime/HourTest.php +++ b/tests/PointInTime/HourTest.php @@ -14,6 +14,5 @@ public function testInterface() $this->assertSame(60, $hour->numberOfMinutes()); $this->assertSame(13, $hour->toInt()); - $this->assertSame('13', $hour->toString()); } } diff --git a/tests/PointInTime/MillisecondTest.php b/tests/PointInTime/MillisecondTest.php index c230e25..a56780f 100644 --- a/tests/PointInTime/MillisecondTest.php +++ b/tests/PointInTime/MillisecondTest.php @@ -13,6 +13,5 @@ public function testInterface() $millisecond = Millisecond::of(600); $this->assertSame(600, $millisecond->toInt()); - $this->assertSame('600', $millisecond->toString()); } } diff --git a/tests/PointInTime/MinuteTest.php b/tests/PointInTime/MinuteTest.php index 84f9945..4bafd28 100644 --- a/tests/PointInTime/MinuteTest.php +++ b/tests/PointInTime/MinuteTest.php @@ -14,6 +14,5 @@ public function testInterface() $this->assertSame(60, $minute->numberOfSeconds()); $this->assertSame(13, $minute->toInt()); - $this->assertSame('13', $minute->toString()); } } diff --git a/tests/PointInTime/SecondTest.php b/tests/PointInTime/SecondTest.php index 6893567..d12a121 100644 --- a/tests/PointInTime/SecondTest.php +++ b/tests/PointInTime/SecondTest.php @@ -13,6 +13,5 @@ public function testInterface() $second = Second::of(13); $this->assertSame(13, $second->toInt()); - $this->assertSame('13', $second->toString()); } } diff --git a/tests/PointInTime/YearTest.php b/tests/PointInTime/YearTest.php index 80eaeae..b63e701 100644 --- a/tests/PointInTime/YearTest.php +++ b/tests/PointInTime/YearTest.php @@ -15,7 +15,6 @@ public function testInterface() $this->assertSame(366, $year->numberOfDays()); $this->assertSame(12, $year->numberOfMonths()); $this->assertSame(2016, $year->toInt()); - $this->assertSame('2016', $year->toString()); $this->assertSame(365, Year::of(2017)->numberOfDays()); } From 4b4971652e9c36715891ba6ad04a415552e97c95 Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Sun, 24 Nov 2024 16:37:35 +0100 Subject: [PATCH 68/85] add documentation --- .github/workflows/documentation.yml | 27 + .gitignore | 1 + Makefile | 6 + docs/assets/favicon.png | Bin 0 -> 2319 bytes docs/assets/fonts/MonaspaceNeon-Regular.woff | Bin 0 -> 47308 bytes docs/assets/logo.svg | 24 + docs/assets/stylesheets/extra.css | 113 ++++ docs/getting-started/clocks.md | 88 +++ docs/getting-started/elapsed-period.md | 31 ++ docs/getting-started/formats.md | 72 +++ docs/getting-started/index.md | 7 + docs/getting-started/periods.md | 56 ++ docs/getting-started/points-in-time.md | 122 +++++ docs/getting-started/time-offsets.md | 28 + docs/getting-started/timezones.md | 533 +++++++++++++++++++ docs/index.md | 37 ++ docs/preface/philosophy.md | 13 + docs/preface/terminology.md | 72 +++ docs/upgrade/v3-to-v4.md | 136 +++++ mkdocs.yml | 104 ++++ 20 files changed, 1470 insertions(+) create mode 100644 .github/workflows/documentation.yml create mode 100644 Makefile create mode 100644 docs/assets/favicon.png create mode 100644 docs/assets/fonts/MonaspaceNeon-Regular.woff create mode 100644 docs/assets/logo.svg create mode 100644 docs/assets/stylesheets/extra.css create mode 100644 docs/getting-started/clocks.md create mode 100644 docs/getting-started/elapsed-period.md create mode 100644 docs/getting-started/formats.md create mode 100644 docs/getting-started/index.md create mode 100644 docs/getting-started/periods.md create mode 100644 docs/getting-started/points-in-time.md create mode 100644 docs/getting-started/time-offsets.md create mode 100644 docs/getting-started/timezones.md create mode 100644 docs/index.md create mode 100644 docs/preface/philosophy.md create mode 100644 docs/preface/terminology.md create mode 100644 docs/upgrade/v3-to-v4.md create mode 100644 mkdocs.yml diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml new file mode 100644 index 0000000..7dcae31 --- /dev/null +++ b/.github/workflows/documentation.yml @@ -0,0 +1,27 @@ +name: Documentation +on: + push: + branches: [master] +permissions: + contents: write +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Configure Git Credentials + run: | + git config user.name github-actions[bot] + git config user.email 41898282+github-actions[bot]@users.noreply.github.com + - uses: actions/setup-python@v5 + with: + python-version: 3.x + - run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV + - uses: actions/cache@v4 + with: + key: mkdocs-material-${{ env.cache_id }} + path: .cache + restore-keys: | + mkdocs-material- + - run: pip install mkdocs-material + - run: mkdocs gh-deploy --force diff --git a/.gitignore b/.gitignore index 987e2a2..a696500 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ composer.lock vendor +.cache diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..6b5c6f1 --- /dev/null +++ b/Makefile @@ -0,0 +1,6 @@ +# This command is intended to be run on your computer +serve-doc: + docker run --rm -it -p 8000:8000 -v ${PWD}:/docs squidfunk/mkdocs-material + +build-doc: + docker run --rm -it -v ${PWD}:/docs squidfunk/mkdocs-material build diff --git a/docs/assets/favicon.png b/docs/assets/favicon.png new file mode 100644 index 0000000000000000000000000000000000000000..08dee3a38bab0f4b6161a9ea6c575a347daaa737 GIT binary patch literal 2319 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

m)-Jo-MAPW+|=Jl-g@ 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 z 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 literal 0 HcmV?d00001 diff --git a/docs/assets/logo.svg b/docs/assets/logo.svg new file mode 100644 index 0000000..6a5d322 --- /dev/null +++ b/docs/assets/logo.svg @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/assets/stylesheets/extra.css b/docs/assets/stylesheets/extra.css new file mode 100644 index 0000000..e4aa2d4 --- /dev/null +++ b/docs/assets/stylesheets/extra.css @@ -0,0 +1,113 @@ +@font-face { + font-family: "Monaspace Neon"; + font-weight: normal; + font-style: normal; + src: url("../fonts/MonaspaceNeon-Regular.woff"); +} + +:root { + --md-code-font: "Monaspace Neon"; +} + +:root { + --light-md-code-hl-number-color: #f76d47; + --light-md-code-hl-function-color: #6384b9; + --light-md-code-hl-operator-color: #39adb5; + --light-md-code-hl-constant-color: #7c4dff; + --light-md-code-hl-string-color: #9fc06f; + --light-md-code-hl-punctuation-color: #39adb5; + --light-md-code-hl-keyword-color: #7c4dff; + --light-md-code-hl-variable-color: #80cbc4; + --light-md-code-hl-comment-color: #ccd7da; + --light-md-code-bg-color: #fafafa; + --light-md-code-fg-color: #ffb62c; + --light-md-code-hl-variable-color: #6384b9; + --dark-md-code-hl-number-color: #f78c6c; + --dark-md-code-hl-function-color: #82aaff; + --dark-md-code-hl-operator-color: #89ddff; + --dark-md-code-hl-constant-color: #c792ea; + --dark-md-code-hl-string-color: #c3e88d; + --dark-md-code-hl-punctuation-color: #89ddff; + --dark-md-code-hl-keyword-color: #c792ea; + --dark-md-code-hl-variable-color: #e8f9f9; + --dark-md-code-hl-comment-color: #546e7a; + --dark-md-code-bg-color: #263238; + --dark-md-code-fg-color: #ffcb6b; + --dark-md-code-hl-variable-color: #82aaff; +} + +@media (prefers-color-scheme: light) { + .language-php > * { + --md-code-hl-number-color: var(--light-md-code-hl-number-color); + --md-code-hl-function-color: var(--light-md-code-hl-function-color); + --md-code-hl-operator-color: var(--light-md-code-hl-operator-color); + --md-code-hl-constant-color: var(--light-md-code-hl-constant-color); + --md-code-hl-string-color: var(--light-md-code-hl-string-color); + --md-code-hl-punctuation-color: var(--light-md-code-hl-punctuation-color); + --md-code-hl-keyword-color: var(--light-md-code-hl-keyword-color); + --md-code-hl-variable-color: var(--light-md-code-hl-variable-color); + --md-code-hl-comment-color: var(--light-md-code-hl-comment-color); + --md-code-bg-color: var(--light-md-code-bg-color); + --md-code-fg-color: var(--light-md-code-fg-color); + } + + .language-php .na { + --md-code-hl-variable-color: var(--light-md-code-hl-variable-color); + } +} + +[data-md-color-media="(prefers-color-scheme: light)"] .language-php > * { + --md-code-hl-number-color: var(--light-md-code-hl-number-color); + --md-code-hl-function-color: var(--light-md-code-hl-function-color); + --md-code-hl-operator-color: var(--light-md-code-hl-operator-color); + --md-code-hl-constant-color: var(--light-md-code-hl-constant-color); + --md-code-hl-string-color: var(--light-md-code-hl-string-color); + --md-code-hl-punctuation-color: var(--light-md-code-hl-punctuation-color); + --md-code-hl-keyword-color: var(--light-md-code-hl-keyword-color); + --md-code-hl-variable-color: var(--light-md-code-hl-variable-color); + --md-code-hl-comment-color: var(--light-md-code-hl-comment-color); + --md-code-bg-color: var(--light-md-code-bg-color); + --md-code-fg-color: var(--light-md-code-fg-color); +} + +[data-md-color-media="(prefers-color-scheme: light)"] .language-php .na { + --md-code-hl-variable-color: var(--light-md-code-hl-variable-color); +} + +@media (prefers-color-scheme: dark) { + .language-php > * { + --md-code-hl-number-color: var(--dark-md-code-hl-number-color); + --md-code-hl-function-color: var(--dark-md-code-hl-function-color); + --md-code-hl-operator-color: var(--dark-md-code-hl-operator-color); + --md-code-hl-constant-color: var(--dark-md-code-hl-constant-color); + --md-code-hl-string-color: var(--dark-md-code-hl-string-color); + --md-code-hl-punctuation-color: var(--dark-md-code-hl-punctuation-color); + --md-code-hl-keyword-color: var(--dark-md-code-hl-keyword-color); + --md-code-hl-variable-color: var(--dark-md-code-hl-variable-color); + --md-code-hl-comment-color: var(--dark-md-code-hl-comment-color); + --md-code-bg-color: var(--dark-md-code-bg-color); + --md-code-fg-color: var(--dark-md-code-fg-color); + } + + .language-php .na { + --md-code-hl-variable-color: var(--dark-md-code-hl-variable-color); + } +} + +[data-md-color-media="(prefers-color-scheme: dark)"] .language-php > * { + --md-code-hl-number-color: var(--dark-md-code-hl-number-color); + --md-code-hl-function-color: var(--dark-md-code-hl-function-color); + --md-code-hl-operator-color: var(--dark-md-code-hl-operator-color); + --md-code-hl-constant-color: var(--dark-md-code-hl-constant-color); + --md-code-hl-string-color: var(--dark-md-code-hl-string-color); + --md-code-hl-punctuation-color: var(--dark-md-code-hl-punctuation-color); + --md-code-hl-keyword-color: var(--dark-md-code-hl-keyword-color); + --md-code-hl-variable-color: var(--dark-md-code-hl-variable-color); + --md-code-hl-comment-color: var(--dark-md-code-hl-comment-color); + --md-code-bg-color: var(--dark-md-code-bg-color); + --md-code-fg-color: var(--dark-md-code-fg-color); +} + +[data-md-color-media="(prefers-color-scheme: dark)"] .language-php .na { + --md-code-hl-variable-color: var(--dark-md-code-hl-variable-color); +} diff --git a/docs/getting-started/clocks.md b/docs/getting-started/clocks.md new file mode 100644 index 0000000..80a2c96 --- /dev/null +++ b/docs/getting-started/clocks.md @@ -0,0 +1,88 @@ +# Clocks + +!!! success "Dependency injection" + A `Clock` should be treated as a singleton and instanciated once in your program and then passed as argument everywhere you need it in your program. + +## Live + +This is the clock you should use in your programs. By default it's set to the [UTC](https://en.wikipedia.org/wiki/UTC%2B00:00) [timezone](timezones.md) (no matter the configuration of your machine). + +To access the current time you would do: + +```php +use Innmind\TimeContinuum\{ + Clock, + PointInTime, +}; + +$clock = Clock::live(); +$point = $clock->now(); // instance of PointInTime +echo $point->toString(); // prints something like 2024-11-24T12:34:25+00:00 +``` + +And to build a [`PointInTime`](points-in-time.md) back from a `string`: + +```php +use Innmind\TimeContinuum\{ + Clock, + Format, + PointInTime, +}; +use Innmind\Immutable\Maybe; + +$time = '2024-11-24T12:34:25+00:00'; + +$clock = Clock::live(); +$at = $clock->at($time, Format::iso8601()); // instance of Maybe +$point = $at->match( + static fn(PointInTime $point) => $point, + static fn() => null, +); +``` + +The `at` method returns a [`Maybe` monad](https://innmind.org/Immutable/structures/maybe/) that may contain a `PointInTime`. This is in case the `#!php $time` variable contains a value that doesn't correspond to the specified format (here `ISO8601`). + +This means that the `#!php $point` variable here is an instance of `PointInTime` because the `#!php $time` value is valid. If it's invalid then `#!php $point` is `#!php null`. + +## Logger + +This clock will create a log everytime you call `#!php ->now()` or `#!php ->at()`. + +To build this clock you need another clock (typically a live one) and a [PSR logger](https://packagist.org/packages/psr/log): + +```php +use Innmind\TimeContinuum\Clock; +use Psr\Log\LoggerInterface; + +$clock = Clock::logger( + Clock::live(), + /* any instance of LoggerInterface (1) */ +); +``` + +1. Like [monolog](https://packagist.org/packages/monolog/monolog) for example. + +You can then use `#!php $clock` like any other clock. + +## Frozen + +This clock is only useful when testing your program. It allows to specify the point in time at which your programs run. + +This way you can test your program for special scenarii like a leap year, daylight saving time and so on... + +```php +use Innmind\TimeContinuum\{ + Clock, + Format, +}; + +$clock = Clock::live() + ->at('2024-11-24T12:34:25+00:00', Format::iso8601()) + ->match( + Clock::frozen(...), + static fn() => throw new \LogicException('Specify a valid date'), + ); +``` + +??? warning + Bear in mind that `#!php $clock->now()` will always return the same object. This means that if your program rely on calculating an [elapsed period](elapsed-period.md) it will always return `#!php 0`. If run in a loop you may end up with an inifinite one. diff --git a/docs/getting-started/elapsed-period.md b/docs/getting-started/elapsed-period.md new file mode 100644 index 0000000..ddf8afa --- /dev/null +++ b/docs/getting-started/elapsed-period.md @@ -0,0 +1,31 @@ +# Elapsed period + +This is the number of microseconds between two [points in time](points-in-time.md). + +```php +use Innmind\TimeContinuum\Clock; + +$clock = Clock::live(); +$start = $clock->now(); +// do some stuff +$end = $clock->now(); + +$elapsed = $end->elapsedSince($start); +``` + +`$elapsed` is an instance of `#!php Innmind\TimeContinuum\ElapsedPeriod`. + +Depending on the precision you need you can call either `$elapsed->milliseconds()` or `$elapsed->microseconds()`. + +This is especially useful when working with network I/O to check for timeouts. + +!!! success "" + This example uses a monotonic clock internally to avoid the problem where the server clock re-synchronize and jump back in time. In this case `$end` is _technically_ before `$start` but the elapsed period is still a positive `int`. + +??? info + Bear in mind that the monotonic clock only works on `PointInTime`s returned by `$clock->now()`. If `->elapsedSince()` is called on points returned by `$clock->at()` it will compare the number od microseconds [since epoch](points-in-time.md#milliseconds-since-epoch). + +??? warning + `ElapsedPeriod` uses an `int` internally to represent the number of microseconds. If you compare two points far away between each other you may end up with an overflow. + + Since this feature is mainly intended for network I/O handling the points should be close from one another. So this bug won't be addresed at least for now. diff --git a/docs/getting-started/formats.md b/docs/getting-started/formats.md new file mode 100644 index 0000000..c71a463 --- /dev/null +++ b/docs/getting-started/formats.md @@ -0,0 +1,72 @@ +# Formats + +A `Format` is a representation on how to convert a [`PointInTime`](points-in-time.md) to a `string`, or vice versa. + +By default this library comes with these formats: + +```php +use Innmind\TimeContinuum\Format; + +Format::cookie(); +Format::iso8601(); +Format::rfc1036(); +Format::rfc1123(); +Format::rfc2822(); +Format::rfc822(); +Format::rfc850(); +Format::rss(); +``` + +Formats are wrapped in an object in order to give them a name. When used in your application you can reference these names instead of duplicating the strings everywhere. + +## Convert to a string + +```php +use Innmind\TimeContinuum\{ + Clock, + Format, +}; + +echo Clock::live() + ->now() + ->format(Format::iso8601()); +``` + +This would print something like `#!php '2024-11-24T14:50:00+00:00'`. + +## Convert from a string + +```php +use Innmind\TimeContinuum\{ + Clock, + Format, + PointInTime, +}; + +$point = Clock::live() + ->at('some string', Format::iso8601()) + ->match( + static fn(PointInTime $point) => $point, + static fn() => null, + ); +``` + +Here `#!php $point` is `#!php null` because `#!php 'some string'` is not a valid date. + +## Define your own format + +If you want to use your own format you can do this via `#!php Format::of('date format')`. The `string` can be anything accepted by [`#!php \DateTimeImmutable::format()`](https://www.php.net/manual/en/datetime.format.php). + +You're encouraged to statically define these formats somewhere in your program like this: + +```php +use Innmind\TimeContinuum\Format; + +final class MyFormats +{ + public static function iso8601WithMicroseconds(): Format + { + return Format::of('Y-m-dT:H:i:s.uP'); + } +} +``` diff --git a/docs/getting-started/index.md b/docs/getting-started/index.md new file mode 100644 index 0000000..4971c3d --- /dev/null +++ b/docs/getting-started/index.md @@ -0,0 +1,7 @@ +# Getting started + +## Installation + +```sh +composer require innmind/time-continuum +``` diff --git a/docs/getting-started/periods.md b/docs/getting-started/periods.md new file mode 100644 index 0000000..3f15f7a --- /dev/null +++ b/docs/getting-started/periods.md @@ -0,0 +1,56 @@ +# Periods + +## Go forward in time + +```php +use Innmind\TimeContinuum\{ + Clock, + Period, +}; + +$future = Clock::live() + ->now() + ->goForward( + Period::day(1) + ->and(Period::hour(12)), + ); +``` + +`#!php $future` is now a day and a half ahead of the current time. + +## Go back in time + +```php +use Innmind\TimeContinuum\{ + Clock, + Period, +}; + +$past = Clock::live() + ->now() + ->goBack( + Period::day(1) + ->and(Period::hour(12)), + ); +``` + +`#!php $past` is now a day and a half behind of the current time. + +## Compare to an elapsed period + +```php +use Innmind\TimeContinuum\{ + Clock, + Period, +}; + +$clock = Clock::live(); +$start = $clock->now(); +// do some stuff +$clock + ->now() + ->elapsedSince($start) + ->longerThan( + Period::second(10)->asElapsedPeriod(), + ); // returns a bool +``` diff --git a/docs/getting-started/points-in-time.md b/docs/getting-started/points-in-time.md new file mode 100644 index 0000000..69b3107 --- /dev/null +++ b/docs/getting-started/points-in-time.md @@ -0,0 +1,122 @@ +# Points in time + +See the [clocks](clocks.md) to learn to have access to these objects. + +All examples below use the `#!php $point` variable that reference an instance of `#!php Innmind\TimeContinuum\PointInTime`. + +## Year + +```php +$point->year()->toInt(); +``` + +This will return the year as an `int`. + +```php +$point->year()->numberOfDays(); +``` + +This returns `#!php 365` or `#!php 366` on leap years. + +## Month + +```php +$point->month()->ofYear(); +``` + +This returns a value from the enum `#!php Innmind\TimeContinuum\Calendar\Month`. + +```php +$point->month()->numberOfDays(); +``` + +This returns an `int` between `#!php 28` and `#!php 31`. + +## Day + +```php +$point->day()->ofYear(); +``` + +This returns an `int` between `#!php 0` and `#!php 365`. + +```php +$point->day()->ofMonth(); +``` + +This returns an `int` between `#!php 1` and `#!php 31`. + +```php +$point->day()->ofWeek(); +``` + +This returns a value from the enum `#!php Innmind\TimeContinuum\Calendar\Day`. + +## Hour + +```php +$point->hour()->toInt(); +``` + +This returns an `int` between `#!php 0` and `#!php 23`. + +## Minute + +```php +$point->minute()->toInt(); +``` + +This returns an `int` between `#!php 0` and `#!php 59`. + +## Second + +```php +$point->second()->toInt(); +``` + +This returns an `int` between `#!php 0` and `#!php 59`. + +## Millisecond + +```php +$point->millisecond()->toInt(); +``` + +This returns an `int` between `#!php 0` and `#!php 999`. + +## Microsecond + +```php +$point->microsecond()->toInt(); +``` + +This returns an `int` between `#!php 0` and `#!php 999`. + +## Milliseconds from epoch + +Since `#!php '1970-01-01T00:00:00.000+00:00'`. + +```php +$point->milliseconds(); +``` + +This returns an `int` that will be negative if the point is before epoch. + +## Offset + +```php +$offset = $point->offset(); +$hours = $offset->hours(); +$minutes = $offset->minutes(); +``` + +`$hours` is an `int` between `#!php -12` and `#!php 14`. `$minutes` is an `int` between `#!php 0` and `#!php 59` but usually is either `#!php 0`, `#!php 15`, `#!php 30` or `#!php 45`. + +## Comparing points + +```php +$point->aheadOf($anotherPoint); +$point->equals($anotherPoint); +``` + +Both methods return a `bool`. diff --git a/docs/getting-started/time-offsets.md b/docs/getting-started/time-offsets.md new file mode 100644 index 0000000..2819b54 --- /dev/null +++ b/docs/getting-started/time-offsets.md @@ -0,0 +1,28 @@ +# Time offsets + +This is a value retrieved from a [point in time](points-in-time.md) and is expressed in a number of hours and minutes. + +```php +use Innmind\TimeContinuum\Clock; + +$offset = Clock::live()->now()->offset(); +``` + +- `#!php $offset->hours()` returns an `int` between `#!php -12` and `#!php 14` +- `#!php $offset->minutes()` returns an `int` between `#!php 0` and `#!php 59` + +Via this object you cannot know in which [timezone](timezones.md) you're in. If you need to keep track of this you should model this in your program and not rely on this information. + +When you have access to a `PointInTime` you can change its offset like this: + +```php +use Innmind\TimeContinuum\{ + Clock, + Offset, +}; + +$utc = Clock::live()->now(); +$newYork = $utc->changeOffset(Offset::of(-5)); +``` + +If `#!php $utc` represents `#!php '2024-11-24T14:25:00+00:00'` then `#!php $newYork` represents `#!php '2024-11-24T09:25:00-05:00'`. diff --git a/docs/getting-started/timezones.md b/docs/getting-started/timezones.md new file mode 100644 index 0000000..fbfce16 --- /dev/null +++ b/docs/getting-started/timezones.md @@ -0,0 +1,533 @@ +# Timezones + +A timezone is a [time offset](time-offsets.md) referenced by a city name. + +As described in the [terminology](../preface/terminology.md#timezone) section the offset for a city may not always be the same depending when you are in time. + +Because it can change, a timezone is handled at the [clock](clocks.md) level. By default the clock offset is `+00:00` but you can change it like this: + +```php +use Innmind\TimeContinuum\{ + Clock, + Timezones, +}; + +$utc = Clock::live(); +$paris = $utc->switch( + static fn(Timezones $timezones) => $timezones + ->europe() + ->paris(), +); +``` + +We now have two clocks. `#!php $utc` is still at `+00:00` and `#!php $paris` will depend on when this code is called. If you run this the 24 november (of any year) it will use `+01:00` and if run the 1 july (of any year) it will use `+02:00`. Because France use daylight saving time and change its offset twice a year. + +!!! note + Once the timezone offset is applied to the returned clock it no longer changes. This is important if you have long running processes. + + For example if you started a process on the 26th of october 2024, switched to the Paris timezone, and let the process run for multiple days it will always be at `+02:00`. Even though Paris switch to `+01:00` on the 27th of october. + +## Available timezones + +`#!php $timezones` represents an intance of `Innmind\TimeContinuum\Timezones`. + +=== "Africa" + ```php + $timezones->africa()->lome(); + $timezones->africa()->ceuta(); + $timezones->africa()->elAaiun(); + $timezones->africa()->portoNovo(); + $timezones->africa()->djibouti(); + $timezones->africa()->windhoek(); + $timezones->africa()->algiers(); + $timezones->africa()->ouagadougou(); + $timezones->africa()->bamako(); + $timezones->africa()->harare(); + $timezones->africa()->bujumbura(); + $timezones->africa()->douala(); + $timezones->africa()->brazzaville(); + $timezones->africa()->tripoli(); + $timezones->africa()->casablanca(); + $timezones->africa()->niamey(); + $timezones->africa()->mbabane(); + $timezones->africa()->blantyre(); + $timezones->africa()->conakry(); + $timezones->africa()->khartoum(); + $timezones->africa()->luanda(); + $timezones->africa()->libreville(); + $timezones->africa()->maseru(); + $timezones->africa()->lusaka(); + $timezones->africa()->darEsSalaam(); + $timezones->africa()->nairobi(); + $timezones->africa()->banjul(); + $timezones->africa()->bissau(); + $timezones->africa()->nouakchott(); + $timezones->africa()->johannesburg(); + $timezones->africa()->timbuktu(); + $timezones->africa()->saoTome(); + $timezones->africa()->freetown(); + $timezones->africa()->kampala(); + $timezones->africa()->dakar(); + $timezones->africa()->lagos(); + $timezones->africa()->cairo(); + $timezones->africa()->mogadishu(); + $timezones->africa()->gaborone(); + $timezones->africa()->tunis(); + $timezones->africa()->kigali(); + $timezones->africa()->malabo(); + $timezones->africa()->abidjan(); + $timezones->africa()->accra(); + $timezones->africa()->asmera(); + $timezones->africa()->ndjamena(); + $timezones->africa()->lubumbashi(); + $timezones->africa()->juba(); + $timezones->africa()->monrovia(); + $timezones->africa()->maputo(); + $timezones->africa()->kinshasa(); + $timezones->africa()->asmara(); + $timezones->africa()->bangui(); + $timezones->africa()->addisAbaba(); + ``` + +=== "America" + ```php + $timezones->america()->argentina()->rioGallegos(); + $timezones->america()->argentina()->mendoza(); + $timezones->america()->argentina()->buenosAires(); + $timezones->america()->argentina()->ushuaia(); + $timezones->america()->argentina()->sanJuan(); + $timezones->america()->argentina()->laRioja(); + $timezones->america()->argentina()->salta(); + $timezones->america()->argentina()->sanLuis(); + $timezones->america()->argentina()->jujuy(); + $timezones->america()->argentina()->tucuman(); + $timezones->america()->argentina()->comodRivadavia(); + $timezones->america()->argentina()->catamarca(); + $timezones->america()->argentina()->cordoba(); + $timezones->america()->indiana()->vincennes(); + $timezones->america()->indiana()->marengo(); + $timezones->america()->indiana()->tellCity(); + $timezones->america()->indiana()->knox(); + $timezones->america()->indiana()->vevay(); + $timezones->america()->indiana()->indianapolis(); + $timezones->america()->indiana()->petersburg(); + $timezones->america()->indiana()->winamac(); + $timezones->america()->northDakota()->beulah(); + $timezones->america()->northDakota()->newSalem(); + $timezones->america()->northDakota()->center(); + $timezones->america()->montreal(); + $timezones->america()->guatemala(); + $timezones->america()->boaVista(); + $timezones->america()->portoAcre(); + $timezones->america()->winnipeg(); + $timezones->america()->santiago(); + $timezones->america()->virgin(); + $timezones->america()->moncton(); + $timezones->america()->noronha(); + $timezones->america()->recife(); + $timezones->america()->saintKitts(); + $timezones->america()->rankinInlet(); + $timezones->america()->jamaica(); + $timezones->america()->lima(); + $timezones->america()->rosario(); + $timezones->america()->cambridgeBay(); + $timezones->america()->coralHarbour(); + $timezones->america()->fortWayne(); + $timezones->america()->nassau(); + $timezones->america()->mazatlan(); + $timezones->america()->grandTurk(); + $timezones->america()->merida(); + $timezones->america()->ensenada(); + $timezones->america()->rainyRiver(); + $timezones->america()->bahiaBanderas(); + $timezones->america()->guadeloupe(); + $timezones->america()->cuiaba(); + $timezones->america()->scoresbysund(); + $timezones->america()->maceio(); + $timezones->america()->curacao(); + $timezones->america()->aruba(); + $timezones->america()->monterrey(); + $timezones->america()->hermosillo(); + $timezones->america()->guayaquil(); + $timezones->america()->managua(); + $timezones->america()->matamoros(); + $timezones->america()->losAngeles(); + $timezones->america()->tegucigalpa(); + $timezones->america()->monticello(); + $timezones->america()->nome(); + $timezones->america()->montevideo(); + $timezones->america()->gooseBay(); + $timezones->america()->boise(); + $timezones->america()->belem(); + $timezones->america()->atikokan(); + $timezones->america()->swiftCurrent(); + $timezones->america()->detroit(); + $timezones->america()->laPaz(); + $timezones->america()->chicago(); + $timezones->america()->creston(); + $timezones->america()->nipigon(); + $timezones->america()->costaRica(); + $timezones->america()->halifax(); + $timezones->america()->yellowknife(); + $timezones->america()->puertoRico(); + $timezones->america()->edmonton(); + $timezones->america()->mexicoCity(); + $timezones->america()->saoPaulo(); + $timezones->america()->yakutat(); + $timezones->america()->saintThomas(); + $timezones->america()->chihuahua(); + $timezones->america()->grenada(); + $timezones->america()->elSalvador(); + $timezones->america()->santoDomingo(); + $timezones->america()->montserrat(); + $timezones->america()->portoVelho(); + $timezones->america()->panama(); + $timezones->america()->antigua(); + $timezones->america()->santarem(); + $timezones->america()->dawson(); + $timezones->america()->saintBarthelemy(); + $timezones->america()->iqaluit(); + $timezones->america()->eirunepe(); + $timezones->america()->inuvik(); + $timezones->america()->anguilla(); + $timezones->america()->portOfSpain(); + $timezones->america()->araguaina(); + $timezones->america()->guyana(); + $timezones->america()->fortaleza(); + $timezones->america()->blancSablon(); + $timezones->america()->juneau(); + $timezones->america()->cayman(); + $timezones->america()->menominee(); + $timezones->america()->cayenne(); + $timezones->america()->pangnirtung(); + $timezones->america()->metlakatla(); + $timezones->america()->asuncion(); + $timezones->america()->saintLucia(); + $timezones->america()->saintVincent(); + $timezones->america()->martinique(); + $timezones->america()->kralendijk(); + $timezones->america()->newYork(); + $timezones->america()->vancouver(); + $timezones->america()->bogota(); + $timezones->america()->dominica(); + $timezones->america()->danmarkshavn(); + $timezones->america()->anchorage(); + $timezones->america()->marigot(); + $timezones->america()->rioBranco(); + $timezones->america()->paramaribo(); + $timezones->america()->caracas(); + $timezones->america()->resolute(); + $timezones->america()->godthab(); + $timezones->america()->catamarca(); + $timezones->america()->glaceBay(); + $timezones->america()->regina(); + $timezones->america()->toronto(); + $timezones->america()->barbados(); + $timezones->america()->santaIsabel(); + $timezones->america()->miquelon(); + $timezones->america()->havana(); + $timezones->america()->ojinaga(); + $timezones->america()->denver(); + $timezones->america()->cancun(); + $timezones->america()->thunderBay(); + $timezones->america()->adak(); + $timezones->america()->saintJohns(); + $timezones->america()->portAuPrince(); + $timezones->america()->whitehorse(); + $timezones->america()->louisville(); + $timezones->america()->manaus(); + $timezones->america()->lowerPrinces(); + $timezones->america()->sitka(); + $timezones->america()->thule(); + $timezones->america()->campoGrande(); + $timezones->america()->phoenix(); + $timezones->america()->shiprock(); + $timezones->america()->bahia(); + $timezones->america()->tortola(); + $timezones->america()->dawsonCreek(); + $timezones->america()->tijuana(); + $timezones->america()->belize(); + $timezones->america()->atka(); + ``` + +=== "Antartica" + ```php + $timezones->antartica()->davis(); + $timezones->antartica()->palmer(); + $timezones->antartica()->syowa(); + $timezones->antartica()->casey(); + $timezones->antartica()->troll(); + $timezones->antartica()->mcMurdo(); + $timezones->antartica()->vostok(); + $timezones->antartica()->rothera(); + $timezones->antartica()->mawson(); + $timezones->antartica()->macquarie(); + $timezones->antartica()->southPole(); + $timezones->antartica()->dumontDUrville(); + ``` + +=== "Arctic" + ```php + $timezones->arctic()->longyearbyen(); + ``` + +=== "Asia" + ```php + $timezones->asia()->manila(); + $timezones->asia()->baghdad(); + $timezones->asia()->ulaanbaatar(); + $timezones->asia()->almaty(); + $timezones->asia()->samarkand(); + $timezones->asia()->ustNera(); + $timezones->asia()->pontianak(); + $timezones->asia()->tehran(); + $timezones->asia()->saigon(); + $timezones->asia()->krasnoyarsk(); + $timezones->asia()->hebron(); + $timezones->asia()->kuching(); + $timezones->asia()->katmandu(); + $timezones->asia()->shanghai(); + $timezones->asia()->calcutta(); + $timezones->asia()->jayapura(); + $timezones->asia()->muscat(); + $timezones->asia()->omsk(); + $timezones->asia()->aqtau(); + $timezones->asia()->khandyga(); + $timezones->asia()->riyadh(); + $timezones->asia()->bangkok(); + $timezones->asia()->thimphu(); + $timezones->asia()->aden(); + $timezones->asia()->yekaterinburg(); + $timezones->asia()->oral(); + $timezones->asia()->novokuznetsk(); + $timezones->asia()->bishkek(); + $timezones->asia()->macau(); + $timezones->asia()->qyzylorda(); + $timezones->asia()->seoul(); + $timezones->asia()->irkutsk(); + $timezones->asia()->aqtobe(); + $timezones->asia()->chongqing(); + $timezones->asia()->kabul(); + $timezones->asia()->thimbu(); + $timezones->asia()->karachi(); + $timezones->asia()->jakarta(); + $timezones->asia()->harbin(); + $timezones->asia()->novosibirsk(); + $timezones->asia()->dili(); + $timezones->asia()->colombo(); + $timezones->asia()->ashkhabad(); + $timezones->asia()->dacca(); + $timezones->asia()->ashgabat(); + $timezones->asia()->ujungPandang(); + $timezones->asia()->qatar(); + $timezones->asia()->tokyo(); + $timezones->asia()->macao(); + $timezones->asia()->tashkent(); + $timezones->asia()->baku(); + $timezones->asia()->pyongyang(); + $timezones->asia()->tbilisi(); + $timezones->asia()->amman(); + $timezones->asia()->vladivostok(); + $timezones->asia()->damascus(); + $timezones->asia()->bahrain(); + $timezones->asia()->vientiane(); + $timezones->asia()->hovd(); + $timezones->asia()->kuwait(); + $timezones->asia()->magadan(); + $timezones->asia()->ulanBator(); + $timezones->asia()->nicosia(); + $timezones->asia()->telAviv(); + $timezones->asia()->choibalsan(); + $timezones->asia()->brunei(); + $timezones->asia()->kualaLumpur(); + $timezones->asia()->kathmandu(); + $timezones->asia()->srednekolymsk(); + $timezones->asia()->dubai(); + $timezones->asia()->yakutsk(); + $timezones->asia()->beirut(); + $timezones->asia()->gaza(); + $timezones->asia()->singapore(); + $timezones->asia()->rangoon(); + $timezones->asia()->sakhalin(); + $timezones->asia()->phnomPenh(); + $timezones->asia()->kamchatka(); + $timezones->asia()->yerevan(); + $timezones->asia()->chungking(); + $timezones->asia()->hoChiMinh(); + $timezones->asia()->chita(); + $timezones->asia()->istanbul(); + $timezones->asia()->hongKong(); + $timezones->asia()->dhaka(); + $timezones->asia()->jerusalem(); + $timezones->asia()->makassar(); + $timezones->asia()->kolkata(); + $timezones->asia()->taipei(); + $timezones->asia()->dushanbe(); + $timezones->asia()->anadyr(); + ``` + +=== "Atlantic" + ```php + $timezones->atlantic()->faroe(); + $timezones->atlantic()->southGeorgia(); + $timezones->atlantic()->capeVerde(); + $timezones->atlantic()->faeroe(); + $timezones->atlantic()->bermuda(); + $timezones->atlantic()->janMayen(); + $timezones->atlantic()->reykjavik(); + $timezones->atlantic()->saintHelena(); + $timezones->atlantic()->canary(); + $timezones->atlantic()->madeira(); + $timezones->atlantic()->azores(); + $timezones->atlantic()->stanley(); + ``` + +=== "Australia" + ```php + $timezones->australia()->lindeman(); + $timezones->australia()->currie(); + $timezones->australia()->victoria(); + $timezones->australia()->adelaide(); + $timezones->australia()->perth(); + $timezones->australia()->brisbane(); + $timezones->australia()->west(); + $timezones->australia()->australianCapitalTerritory(); + $timezones->australia()->north(); + $timezones->australia()->eucla(); + $timezones->australia()->lordeHoweIsland(); + $timezones->australia()->newSouthWales(); + $timezones->australia()->queensland(); + $timezones->australia()->south(); + $timezones->australia()->melbourne(); + $timezones->australia()->yancowinna(); + $timezones->australia()->canberra(); + $timezones->australia()->sydney(); + $timezones->australia()->darwin(); + $timezones->australia()->hobart(); + $timezones->australia()->brokenHill(); + $timezones->australia()->tasmania(); + ``` + +=== "Europe" + ```php + $timezones->europe()->uzhgorod(); + $timezones->europe()->riga(); + $timezones->europe()->paris(); + $timezones->europe()->guernsey(); + $timezones->europe()->samara(); + $timezones->europe()->athens(); + $timezones->europe()->tirane(); + $timezones->europe()->london(); + $timezones->europe()->helsinki(); + $timezones->europe()->oslo(); + $timezones->europe()->podgorica(); + $timezones->europe()->minsk(); + $timezones->europe()->monaco(); + $timezones->europe()->lisbon(); + $timezones->europe()->tallinn(); + $timezones->europe()->berlin(); + $timezones->europe()->gibraltar(); + $timezones->europe()->prague(); + $timezones->europe()->stockholm(); + $timezones->europe()->moscow(); + $timezones->europe()->bucharest(); + $timezones->europe()->andorra(); + $timezones->europe()->vilnius(); + $timezones->europe()->rome(); + $timezones->europe()->kiev(); + $timezones->europe()->copenhagen(); + $timezones->europe()->belgrade(); + $timezones->europe()->isleOfMan(); + $timezones->europe()->budapest(); + $timezones->europe()->tiraspol(); + $timezones->europe()->vaduz(); + $timezones->europe()->sarajevo(); + $timezones->europe()->amsterdam(); + $timezones->europe()->mariehamn(); + $timezones->europe()->skopje(); + $timezones->europe()->kaliningrad(); + $timezones->europe()->bratislava(); + $timezones->europe()->sanMarino(); + $timezones->europe()->busingen(); + $timezones->europe()->zaporozhye(); + $timezones->europe()->chisinau(); + $timezones->europe()->brussels(); + $timezones->europe()->luxembourg(); + $timezones->europe()->belfast(); + $timezones->europe()->vienna(); + $timezones->europe()->ljubljana(); + $timezones->europe()->simferopol(); + $timezones->europe()->dublin(); + $timezones->europe()->nicosia(); + $timezones->europe()->zagreb(); + $timezones->europe()->jersey(); + $timezones->europe()->madrid(); + $timezones->europe()->vatican(); + $timezones->europe()->istanbul(); + $timezones->europe()->zurich(); + $timezones->europe()->sofia(); + $timezones->europe()->volgograd(); + $timezones->europe()->malta(); + $timezones->europe()->warsaw(); + ``` + +=== "Indian" + ```php + $timezones->indian()->cocos(); + $timezones->indian()->antananarivo(); + $timezones->indian()->reunion(); + $timezones->indian()->chagos(); + $timezones->indian()->comoro(); + $timezones->indian()->mayotte(); + $timezones->indian()->maldives(); + $timezones->indian()->mauritius(); + $timezones->indian()->mahe(); + $timezones->indian()->kerguelen(); + $timezones->indian()->christmas(); + ``` + +=== "Pacific" + ```php + $timezones->pacific()->kosrae(); + $timezones->pacific()->enderbury(); + $timezones->pacific()->apia(); + $timezones->pacific()->noumea(); + $timezones->pacific()->chatham(); + $timezones->pacific()->wake(); + $timezones->pacific()->wallis(); + $timezones->pacific()->johnston(); + $timezones->pacific()->saipan(); + $timezones->pacific()->tarawa(); + $timezones->pacific()->pitcairn(); + $timezones->pacific()->niue(); + $timezones->pacific()->ponape(); + $timezones->pacific()->guam(); + $timezones->pacific()->auckland(); + $timezones->pacific()->pagoPago(); + $timezones->pacific()->chuuk(); + $timezones->pacific()->kwajalein(); + $timezones->pacific()->fakaofo(); + $timezones->pacific()->majuro(); + $timezones->pacific()->guadalcanal(); + $timezones->pacific()->efate(); + $timezones->pacific()->tongatapu(); + $timezones->pacific()->pohnpei(); + $timezones->pacific()->honolulu(); + $timezones->pacific()->bougainville(); + $timezones->pacific()->galapagos(); + $timezones->pacific()->gambier(); + $timezones->pacific()->palau(); + $timezones->pacific()->midway(); + $timezones->pacific()->marquesas(); + $timezones->pacific()->funafuti(); + $timezones->pacific()->norfolk(); + $timezones->pacific()->portMoresby(); + $timezones->pacific()->tahiti(); + $timezones->pacific()->fiji(); + $timezones->pacific()->kiritimati(); + $timezones->pacific()->truk(); + $timezones->pacific()->easter(); + $timezones->pacific()->rarotonga(); + $timezones->pacific()->yap(); + $timezones->pacific()->nauru(); + ``` diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 0000000..0b134cf --- /dev/null +++ b/docs/index.md @@ -0,0 +1,37 @@ +--- +hide: + - navigation + - toc +--- + +# Welcome to TimeContinnum + +TimeContinuum is a time abstraction library. + +The goal is to provide a safe way to manipulate time in your programs. + +It achieves this via: + +- an expressive object oriented API to avoid _magic strings_ +- a clear separation between what's mutable and immutable + +??? example "Sneak peek" + ```php + use Innmind\TimeContinuum\{ + Clock, + Format, + }; + + $clock = Clock::live(); + $start = $clock->now(); + // do some stuff + $end = $clock->now(); + + \printf( + 'The script ended at %s and it took %s microsecond(s).', + $end->format(Format::iso8601()), + $end + ->elapsedSince($start) + ->microseconds(), + ); + ``` diff --git a/docs/preface/philosophy.md b/docs/preface/philosophy.md new file mode 100644 index 0000000..820243a --- /dev/null +++ b/docs/preface/philosophy.md @@ -0,0 +1,13 @@ +# Philosophy + +TimeContinuum is designed around these objectives: + +- an expressive API through a clear naming +- to handle time with precision +- simplify common use cases + +Time is a tricky business full of gotchas. It's easy to make mistake that go undetected for a while. + +The first step to avoid mistakes is to provide a good naming. Here, each component of time is accessible via expressive methods to give the least possible room to error. + +One of the hardest aspect of time is to distinguish what can change from what can't. Once again naming helps but it's not enough. This package creates a _frontier_ between this two worlds. This is expressed via an `immutable` annotation (understood by [Psalm](https://psalm.dev)) on what cannot change, and the rest may change. diff --git a/docs/preface/terminology.md b/docs/preface/terminology.md new file mode 100644 index 0000000..b5ec66a --- /dev/null +++ b/docs/preface/terminology.md @@ -0,0 +1,72 @@ +# Terminology + +## Clock + +A `Clock` is the root object to access time. Like a real clock, each time you demand the time it will provide a new value. This is part of the world that can change. + +Unlike real clocks, in a program we often have the use case to convert a `string` back to a [time](#point-in-time) representation (1). Clocks provide a method for this. You can think of it as a factory. Even though this is done by a clock this method is determinist, meaning that you'll always have the same result for the same inputs. +{.annotate} + +1. Such as reading a value from a database. + +## Point in time + +As its name suggest it represents a fixed point in time on Earth. It represents time down to the microsecond. It also stores the time offset from [UTC](https://en.wikipedia.org/wiki/UTC%2B00:00). + +These objects are generated by clocks. + +Once an object is created it can no longer change. But you can still create objects relative to it by specifying a [period](#period) and the direction. + +## Timezone + +A timezone represents a time offset from [UTC](https://en.wikipedia.org/wiki/UTC%2B00:00) for a set of cities on Earth (1). +{.annotate} + +1. For example `Europe/Paris`. + +Due to politics a city may change its offset at any time (1). And for economic reasons some countries change their offset each year, a process called "daylight saving time" (2). +{.annotate} + +1. This means some points in time don't exist in certain countries or exist twice. +2. Usually they increase/decrease their offset by 1 or 2 hours. + +Because asking the offset for a timezone will yeild different results depending on when you ask for it, it's part of the world that changes. This means that timezones are handled at the [clock](#clock) level. + +## Period + +It represents the time between 2 points in time. It can be defined by a number of: + +- years +- months +- days +- hours +- minutes +- seconds +- milliseconds +- microseconds + +Each of this component has to be a positive integer. It's when you apply it to a point in time that you decide if you want to go forward or back in time. + +Since these objects are not tied to a particular point in time they're immutable. + +## Elapsed period + +It represents the number of microseconds between two points in time. + +Once an object is created it cannot change. + +This is useful to compute the time your program took to accomplish a task. Operation often used when dealing with network I/O to handle timeouts. + +## Format + +A format defines a way to represent a point in time as a `string` (1). +{.annotate} + +1. Usually to store the value to a database or print it in a user interface. + +It's declared as an object to give meaning to the string format it encapsulate. The intent is to declare the string format once in an object in your program and reuse this object everywhere. This allows to attach a _name_ to the format. + +This is an attempt to solve the problem (1) where the same format is duplicated everywhere in a program. +{.annotate} + +1. We can see this practive in a lot of programs. diff --git a/docs/upgrade/v3-to-v4.md b/docs/upgrade/v3-to-v4.md new file mode 100644 index 0000000..a3716a8 --- /dev/null +++ b/docs/upgrade/v3-to-v4.md @@ -0,0 +1,136 @@ +# From v3 to v4 + +All namespaces are relative to `\Innmind\TimeContinuum\`. + +These are the main changes, for an extensive list of changes go to the [changelog](https://github.com/Innmind/TimeContinuum/blob/develop/CHANGELOG.md). + +## Clocks + +### Live clock + +=== "Before" + ```php + $clock = new Earth\Clock; + ``` + +=== "After" + ```php + $clock = Clock::live(); + ``` + +### Logger + +=== "Before" + ```php + $clock = new Logger\Clock( + new Earth\Clock, + /* an instance of Psr\Log\LoggerInterface */ + ); + ``` + +=== "After" + ```php + $clock = Clock::logger( + Clock::live(), + /* an instance of Psr\Log\LoggerInterface */ + ); + ``` + +### Frozen + +=== "Before" + ```php + $clock = new Earth\FrozenClock( + new Earth\PointInTime\PointInTime('some date'), + ); + ``` + +=== "After" + ```php + $clock = Clock::live() + ->at('some date', Format::iso8601()) + ->match( + Clock::frozen(...), + static fn() => throw new \LogicException('Use a valid date'), + ); + ``` + +## Timezones + +=== "Before" + ```php + $clock = new Earth\Clock( + new Earth\Timezone\Europe\Paris, + ); + ``` + +=== "After" + ```php + $clock = Clock::live()->switch( + static fn(Timezones $timezones) => $timezones + ->europe() + ->paris(), + ); + ``` + +## Access point in time offset + +=== "Before" + ```php + $clock->now()->timezone()->hours(); + $clock->now()->timezone()->minutes(); + ``` + +=== "Before" + ```php + $clock->now()->offset()->hours(); + $clock->now()->offset()->minutes(); + ``` + +## Modify point in time offset + +=== "Before" + ```php + $clock->now()->changeTimezone(new Earth\Timezone\UTC(2, 0)); + ``` + +=== "Before" + ```php + $clock->now()->changeOffset(Offset::of(2, 0)); + ``` + +## Periods + +=== "Before" + ```php + new Earth\Period\Year(42); + new Earth\Period\Month(42); + new Earth\Period\Day(42); + new Earth\Period\Hour(42); + new Earth\Period\Minute(42); + new Earth\Period\Second(42); + new Earth\Period\Millisecond(42); + ``` + +=== "After" + ```php + Period::year(42); + Period::month(42); + Period::day(42); + Period::hour(42); + Period::minute(42); + Period::second(42); + Period::millisecond(42); + ``` + +## Formats + +=== "Before" + ```php + $clock->now()->format(new Earth\Format\ISO8601); + ``` + +=== "After" + ```php + $clock->now()->format(Format::iso8601()); + ``` diff --git a/mkdocs.yml b/mkdocs.yml new file mode 100644 index 0000000..05ec14f --- /dev/null +++ b/mkdocs.yml @@ -0,0 +1,104 @@ +site_name: Innmind/TimeContinuum +repo_name: Innmind/TimeContinuum + +nav: + - Home: index.md + - Preface: + - Philosophy: preface/philosophy.md + - Terminology: preface/terminology.md + - Getting started: + - getting-started/index.md + - Clocks: getting-started/clocks.md + - Points in time: getting-started/points-in-time.md + - Elapsed period: getting-started/elapsed-period.md + - Time offsets: getting-started/time-offsets.md + - Timezones: getting-started/timezones.md + - Formats: getting-started/formats.md + - Periods: getting-started/periods.md + - Upgrade: + - From v3 to v4: upgrade/v3-to-v4.md + +theme: + name: material + logo: assets/logo.svg + favicon: assets/favicon.png + font: false + features: + - content.code.copy + - content.code.annotate + - navigation.tracking + - navigation.tabs + - navigation.tabs.sticky + - navigation.sections + - navigation.expand + - navigation.indexes + - navigation.top + - navigation.footer + - search.suggest + - search.highlight + - content.action.edit + palette: + # Palette toggle for automatic mode + - media: "(prefers-color-scheme)" + toggle: + icon: material/brightness-auto + name: Switch to light mode + primary: blue + accent: deep orange + # Palette toggle for light mode + - media: "(prefers-color-scheme: light)" + scheme: default + toggle: + icon: material/brightness-7 + name: Switch to dark mode + primary: blue + accent: deep orange + # Palette toggle for dark mode + - media: "(prefers-color-scheme: dark)" + scheme: slate + toggle: + icon: material/brightness-4 + name: Switch to system preference + primary: blue + accent: deep orange + +markdown_extensions: + - pymdownx.highlight: + anchor_linenums: true + line_spans: __span + pygments_lang_class: true + extend_pygments_lang: + - name: php + lang: php + options: + startinline: true + - pymdownx.inlinehilite + - pymdownx.snippets + - attr_list + - md_in_html + - pymdownx.superfences + - abbr + - admonition + - pymdownx.details: + - pymdownx.tabbed: + alternate_style: true + - toc: + permalink: true + - footnotes + - pymdownx.emoji: + emoji_index: !!python/name:material.extensions.emoji.twemoji + emoji_generator: !!python/name:material.extensions.emoji.to_svg + +extra_css: + - assets/stylesheets/extra.css + +plugins: + - search + - privacy + +extra: + social: + - icon: fontawesome/brands/github + link: https://github.com/Innmind/TimeContinuum + - icon: fontawesome/brands/x-twitter + link: https://twitter.com/Baptouuuu From 48a08aed139a493969bed4c9e2bdd030b8d39aa8 Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Sun, 24 Nov 2024 16:48:57 +0100 Subject: [PATCH 69/85] force the use of a format to parse a string --- CHANGELOG.md | 1 + README.md | 6 +++++- proofs/clock.php | 1 - src/Clock.php | 2 +- src/Clock/Frozen.php | 2 +- src/Clock/Live.php | 42 ++++++++++++++------------------------ src/Clock/Logger.php | 18 +++------------- tests/Clock/FrozenTest.php | 2 +- tests/Clock/LiveTest.php | 2 +- tests/Clock/LoggerTest.php | 6 +++--- tests/ClockTest.php | 2 +- 11 files changed, 32 insertions(+), 52 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e450212..a35deeb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,6 +39,7 @@ - `Innmind\TimeContinuum\PointInTime::timezone()` has been renamed `Innmind\TimeContinuum\PointInTime::offset()` - `Innmind\TimeContinuum\PointInTime\Day::toInt()` has been renamed `Innmind\TimeContinuum\PointInTime\Day::ofMonth()` - `Innmind\TimeContinuum\ElapsedPeriod::of()` is now an `internal` method +- `Innmind\TimeContinuum\Clock::at()` now requires a `Format` ### Removed diff --git a/README.md b/README.md index 2847f95..b59cac8 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,7 @@ composer install innmind/time-continuum use Innmind\TimeContinuum\{ Clock, PointInTime, + Format, }; use Innmind\Immutable\Maybe; @@ -27,7 +28,10 @@ $clock = Clock::live(); $now = $clock->now(); // return an instance of PointInTime echo $now->toString(); // 2016-10-11T12:17:30+02:00 -$epoch = $clock->at('1970-01-01T00:00:00.000000Z'); // Maybe +$epoch = $clock->at( + '1970-01-01T00:00:00.000000+00:00', + Format::iso8601(), +); // Maybe ``` Here we reference 2 points in time, the first is the exact moment we call `now` down to the millisecond and the second one is the epoch time (you can verify it via `$epoch->milliseconds()` that returns `0`). diff --git a/proofs/clock.php b/proofs/clock.php index 0c4ca00..78e20db 100644 --- a/proofs/clock.php +++ b/proofs/clock.php @@ -98,7 +98,6 @@ static function($assert, $point) { given( Set\Unicode::strings(), Set\Elements::of( - null, Format::cookie(), Format::iso8601(), Format::rfc1036(), diff --git a/src/Clock.php b/src/Clock.php index 8a0773f..9e845c0 100644 --- a/src/Clock.php +++ b/src/Clock.php @@ -53,7 +53,7 @@ public function switch(callable $changeTimezone): self * * @return Maybe */ - public function at(string $date, Format $format = null): Maybe + public function at(string $date, Format $format): Maybe { /** * @psalm-suppress ImpureVariable diff --git a/src/Clock/Frozen.php b/src/Clock/Frozen.php index 2347944..29b1ae7 100644 --- a/src/Clock/Frozen.php +++ b/src/Clock/Frozen.php @@ -48,7 +48,7 @@ public function now(): PointInTime * * @return Maybe */ - public function at(string $date, Format $format = null): Maybe + public function at(string $date, Format $format): Maybe { /** * @psalm-suppress ImpureVariable diff --git a/src/Clock/Live.php b/src/Clock/Live.php index 87a2685..fb72e14 100644 --- a/src/Clock/Live.php +++ b/src/Clock/Live.php @@ -57,36 +57,24 @@ public function now(): PointInTime * * @return Maybe */ - public function at(string $date, Format $format = null): Maybe + public function at(string $date, Format $format): Maybe { - if ($format instanceof Format) { - try { - /** @psalm-suppress ImpureMethodCall */ - $datetime = \DateTimeImmutable::createFromFormat($format->toString(), $date); - } catch (\Throwable) { - /** @var Maybe */ - return Maybe::nothing(); - } - - if ($datetime === false) { - /** @var Maybe */ - return Maybe::nothing(); - } + try { + /** @psalm-suppress ImpureMethodCall */ + $datetime = \DateTimeImmutable::createFromFormat($format->toString(), $date); + } catch (\Throwable) { + /** @var Maybe */ + return Maybe::nothing(); + } - if ($datetime->format($format->toString()) !== $date) { - /** @var Maybe */ - return Maybe::nothing(); - } + if ($datetime === false) { + /** @var Maybe */ + return Maybe::nothing(); + } - $date = $datetime->format(\DateTime::ATOM); - } else { - try { - /** @psalm-suppress ImpureMethodCall */ - $datetime = new \DateTimeImmutable($date); - } catch (\Throwable) { - /** @var Maybe */ - return Maybe::nothing(); - } + if ($datetime->format($format->toString()) !== $date) { + /** @var Maybe */ + return Maybe::nothing(); } /** diff --git a/src/Clock/Logger.php b/src/Clock/Logger.php index bde7884..62fff73 100644 --- a/src/Clock/Logger.php +++ b/src/Clock/Logger.php @@ -55,7 +55,7 @@ public function now(): PointInTime * * @return Maybe */ - public function at(string $date, Format $format = null): Maybe + public function at(string $date, Format $format): Maybe { /** * @psalm-suppress ImpureVariable @@ -67,22 +67,10 @@ public function at(string $date, Format $format = null): Maybe ->map(fn($point) => $this->log($point, $date, $format)); } - /** - * @psalm-pure - */ - private function format(?Format $format): string - { - if (\is_null($format)) { - return 'unknown'; - } - - return $format->toString(); - } - private function log( PointInTime $point, string $date, - ?Format $format, + Format $format, ): PointInTime { /** * @psalm-suppress ImpureVariable @@ -91,7 +79,7 @@ private function log( */ $this->logger->debug('Asked time {date} ({format}) resolved to {point}', [ 'date' => $date, - 'format' => $this->format($format), + 'format' => $format->toString(), 'point' => $point->format(Format::iso8601()), ]); diff --git a/tests/Clock/FrozenTest.php b/tests/Clock/FrozenTest.php index f07c98f..3e2d7ee 100644 --- a/tests/Clock/FrozenTest.php +++ b/tests/Clock/FrozenTest.php @@ -37,7 +37,7 @@ public function testAtReturnWithTheSameTimezoneAsNow() ->then(function($now, $at) { $clock = Clock::frozen($now); - $point = $clock->at($at->format(Format::iso8601()))->match( + $point = $clock->at($at->format(Format::iso8601()), Format::iso8601())->match( static fn($point) => $point, static fn() => null, ); diff --git a/tests/Clock/LiveTest.php b/tests/Clock/LiveTest.php index e8d416a..f995daa 100644 --- a/tests/Clock/LiveTest.php +++ b/tests/Clock/LiveTest.php @@ -37,7 +37,7 @@ public function testAt() { $this->assertInstanceOf( PointInTime::class, - $point = Clock::live()->at('2016-10-08T16:08:30+02:00')->match( + $point = Clock::live()->at('2016-10-08T16:08:30+02:00', Format::iso8601())->match( static fn($point) => $point, static fn() => null, ), diff --git a/tests/Clock/LoggerTest.php b/tests/Clock/LoggerTest.php index aa72f4c..9a44984 100644 --- a/tests/Clock/LoggerTest.php +++ b/tests/Clock/LoggerTest.php @@ -77,7 +77,7 @@ public function log($level, string|\Stringable $message, array $context = []): v $this->assertSame( $point->toString(), - $clock->at($point->toString())->match( + $clock->at($point->format(Format::iso8601()), Format::iso8601())->match( static fn($found) => $found->toString(), static fn() => null, ), @@ -88,8 +88,8 @@ public function log($level, string|\Stringable $message, array $context = []): v 'debug', 'Asked time {date} ({format}) resolved to {point}', [ - 'date' => $point->toString(), - 'format' => 'unknown', + 'date' => $point->format(Format::iso8601()), + 'format' => Format::iso8601()->toString(), 'point' => $point->format(Format::iso8601()), ], ], diff --git a/tests/ClockTest.php b/tests/ClockTest.php index c854ee9..d02122c 100644 --- a/tests/ClockTest.php +++ b/tests/ClockTest.php @@ -107,7 +107,7 @@ public function testFrozenClockDoesntChangeItsTimezone() ); $this->assertSame( $frozen->now()->toString(), - $clock->at($point->toString())->match( + $clock->at($point->format(Format::iso8601()), Format::iso8601())->match( static fn($point) => $point->toString(), static fn() => null, ), From 583d97f0d15fef4ccee34b2b99afe4a74a0f575d Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Sun, 24 Nov 2024 17:07:37 +0100 Subject: [PATCH 70/85] remove PointInTime::milliseconds() --- CHANGELOG.md | 1 + src/PointInTime.php | 13 ++++--------- tests/Fixtures/PointInTimeTest.php | 13 ++++++++----- tests/NowTest.php | 3 --- tests/PointInTimeTest.php | 5 ----- 5 files changed, 13 insertions(+), 22 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a35deeb..e90884e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -66,6 +66,7 @@ - `Innmind\TimeContinuum\PointInTime\Year::toString()` - `Innmind\TimeContinuum\ElapsedPeriod::maybe()` - `Innmind\TimeContinuum\ElapsedPeriod::ofPeriod()` +- `Innmind\TimeContinuum\PointInTime::milliseconds()` ## 3.4.1 - 2023-09-17 diff --git a/src/PointInTime.php b/src/PointInTime.php index 0ddee11..d546616 100644 --- a/src/PointInTime.php +++ b/src/PointInTime.php @@ -52,14 +52,6 @@ public static function now(): self ); } - /** - * Since 1970-01-01T00:00:00+00:00 - */ - public function milliseconds(): int - { - return (int) $this->date->format('Uv'); - } - public function year(): Year { return Year::of((int) $this->date->format('Y')); @@ -150,7 +142,10 @@ public function elapsedSince(self $point): ElapsedPeriod return $this->highResolution->elapsedSince($point->highResolution); } - $milliseconds = $this->milliseconds() - $point->milliseconds(); + $seconds = ((int) $this->date->format('U')) - ((int) $point->date->format('U')); + $milliseconds = $seconds * 1_000; + $milliseconds += $this->millisecond()->toInt(); + $milliseconds -= $point->millisecond()->toInt(); $microseconds = $milliseconds * 1_000; $microseconds += $this->microsecond()->toInt(); $microseconds -= $point->microsecond()->toInt(); diff --git a/tests/Fixtures/PointInTimeTest.php b/tests/Fixtures/PointInTimeTest.php index ff31a73..1b6409c 100644 --- a/tests/Fixtures/PointInTimeTest.php +++ b/tests/Fixtures/PointInTimeTest.php @@ -8,7 +8,10 @@ Set, Random, }; -use Innmind\TimeContinuum\PointInTime as Model; +use Innmind\TimeContinuum\{ + PointInTime as Model, + Format, +}; use Innmind\BlackBox\PHPUnit\Framework\TestCase; class PointInTimeTest extends TestCase @@ -37,8 +40,8 @@ public function testAfter() foreach ($points->values(Random::default) as $point) { $this->assertGreaterThanOrEqual( - $start->milliseconds(), - $point->unwrap()->milliseconds(), + (int) $start->format(Format::of('U')), + (int) $point->unwrap()->format(Format::of('U')), ); } } @@ -53,8 +56,8 @@ public function testBefore() foreach ($points->values(Random::default) as $point) { $this->assertLessThanOrEqual( - $start->milliseconds(), - $point->unwrap()->milliseconds(), + (int) $start->format(Format::of('U')), + (int) $point->unwrap()->format(Format::of('U')), ); } } diff --git a/tests/NowTest.php b/tests/NowTest.php index 550b626..1b8fbf2 100644 --- a/tests/NowTest.php +++ b/tests/NowTest.php @@ -47,8 +47,6 @@ public function testInterface() //and the one in Now::__construct $this->assertTrue($point->millisecond()->toInt() >= $now - ($timestamp * 1000)); $this->assertTrue($point->millisecond()->toInt() <= $now - ($timestamp * 1000) + 50); - $this->assertTrue($point->milliseconds() >= $now); - $this->assertTrue($point->milliseconds() <= $now + 50); $timezone = \date('P', $timestamp); $timezone = $timezone === '+00:00' ? 'Z' : $timezone; $this->assertSame($timezone, $point->offset()->toString()); @@ -80,7 +78,6 @@ public function testChangeOffset() $this->assertNotSame($point->minute(), $point2->minute()); $this->assertNotSame($point->second(), $point2->second()); $this->assertNotSame($point->millisecond(), $point2->millisecond()); - $this->assertSame($point->milliseconds(), $point2->milliseconds()); $this->assertSame((int) $now->format('Y'), $point2->year()->toInt()); $this->assertSame((int) $now->format('m'), $point2->month()->ofYear()->toInt()); $this->assertSame((int) $now->format('d'), $point2->day()->ofMonth()); diff --git a/tests/PointInTimeTest.php b/tests/PointInTimeTest.php index 243612f..bcfd28b 100644 --- a/tests/PointInTimeTest.php +++ b/tests/PointInTimeTest.php @@ -40,10 +40,6 @@ public function testInterface() $this->assertSame(1, $point->minute()->toInt()); $this->assertSame(30, $point->second()->toInt()); $this->assertSame(123, $point->millisecond()->toInt()); - $this->assertSame( - (new \DateTimeImmutable('2016-10-05T08:01:30.123+02:00'))->getTimestamp() * 1000 + $point->millisecond()->toInt(), - $point->milliseconds(), - ); $this->assertSame('+02:00', $point->offset()->toString()); $this->assertSame('2016-10-05T08:01:30+02:00', $point->toString()); } @@ -79,7 +75,6 @@ public function testChangeOffset() $this->assertNotSame($point->minute(), $point2->minute()); $this->assertNotSame($point->second(), $point2->second()); $this->assertNotSame($point->millisecond(), $point2->millisecond()); - $this->assertSame($point->milliseconds(), $point2->milliseconds()); $this->assertSame(2016, $point2->year()->toInt()); $this->assertSame(10, $point2->month()->ofYear()->toInt()); $this->assertSame(5, $point2->day()->ofMonth()); From e24bc1489fcb20e763b6f4b3254c4b5f45564f6a Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Sun, 24 Nov 2024 17:18:05 +0100 Subject: [PATCH 71/85] remove outdated doc --- README.md | 2 +- docs/getting-started/points-in-time.md | 10 ---------- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/README.md b/README.md index b59cac8..8cfc272 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ $epoch = $clock->at( ); // Maybe ``` -Here we reference 2 points in time, the first is the exact moment we call `now` down to the millisecond and the second one is the epoch time (you can verify it via `$epoch->milliseconds()` that returns `0`). +Here we reference 2 points in time, the first is the exact moment we call `now` down to the millisecond and the second one is the epoch time. The method `at()` accepts any string that is allowed by `\DateTimeImmutable`. diff --git a/docs/getting-started/points-in-time.md b/docs/getting-started/points-in-time.md index 69b3107..63968ba 100644 --- a/docs/getting-started/points-in-time.md +++ b/docs/getting-started/points-in-time.md @@ -92,16 +92,6 @@ $point->microsecond()->toInt(); This returns an `int` between `#!php 0` and `#!php 999`. -## Milliseconds from epoch - -Since `#!php '1970-01-01T00:00:00.000+00:00'`. - -```php -$point->milliseconds(); -``` - -This returns an `int` that will be negative if the point is before epoch. - ## Offset ```php From 5a7e6dd286aeabaed0b755c9c89cc156ecaae85b Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Sun, 24 Nov 2024 17:29:20 +0100 Subject: [PATCH 72/85] add Clock::ofFormat() --- CHANGELOG.md | 1 + proofs/clock.php | 25 +++++++++++++++++++++++++ src/Clock.php | 15 ++++++++++----- src/Clock/Frozen.php | 6 +----- src/Clock/Live.php | 7 +------ src/Clock/Logger.php | 6 +----- src/Clock/OfFormat.php | 42 ++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 81 insertions(+), 21 deletions(-) create mode 100644 src/Clock/OfFormat.php diff --git a/CHANGELOG.md b/CHANGELOG.md index e90884e..ed4211f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ - `Innmind\TimeContinuum\Period::second()` named constructor - `Innmind\TimeContinuum\Period::millisecond()` named constructor - `Innmind\TimeContinuum\PointInTime::microsecond()` +- `Innmind\TimeContinuum\Clock::ofFormat()` ### Changed diff --git a/proofs/clock.php b/proofs/clock.php index 78e20db..38c8243 100644 --- a/proofs/clock.php +++ b/proofs/clock.php @@ -116,4 +116,29 @@ static function($assert, $point) { ), ), ); + + yield proof( + 'Clock::ofFormat()->at()', + given(PointInTime::any()), + static function($assert, $point) { + $parsed = Clock::live() + ->ofFormat(Format::iso8601()) + ->at($point->format(Format::iso8601())) + ->match( + static fn($point) => $point->format(Format::iso8601()), + static fn() => null, + ); + + $assert->not()->null($parsed); + $assert->same( + Clock::live() + ->at($point->format(Format::iso8601()), Format::iso8601()) + ->match( + static fn($point) => $point->format(Format::iso8601()), + static fn() => null, + ), + $parsed, + ); + }, + ); }; diff --git a/src/Clock.php b/src/Clock.php index 9e845c0..f6aa774 100644 --- a/src/Clock.php +++ b/src/Clock.php @@ -7,6 +7,7 @@ Live, Frozen, Logger, + OfFormat, }; use Innmind\Immutable\Maybe; use Psr\Log\LoggerInterface; @@ -47,7 +48,7 @@ public function switch(callable $changeTimezone): self } /** - * @psalm-pure + * @psalm-mutation-free * * @param non-empty-string $date * @@ -55,10 +56,14 @@ public function switch(callable $changeTimezone): self */ public function at(string $date, Format $format): Maybe { - /** - * @psalm-suppress ImpureVariable - * @psalm-suppress ImpurePropertyFetch - */ return $this->implementation->at($date, $format); } + + /** + * @psalm-mutation-free + */ + public function ofFormat(Format $format): OfFormat + { + return OfFormat::new($this, $format); + } } diff --git a/src/Clock/Frozen.php b/src/Clock/Frozen.php index 29b1ae7..d33a483 100644 --- a/src/Clock/Frozen.php +++ b/src/Clock/Frozen.php @@ -42,7 +42,7 @@ public function now(): PointInTime } /** - * @psalm-pure + * @psalm-mutation-free * * @param non-empty-string $date * @@ -50,10 +50,6 @@ public function now(): PointInTime */ public function at(string $date, Format $format): Maybe { - /** - * @psalm-suppress ImpureVariable - * @psalm-suppress ImpurePropertyFetch - */ return $this ->concrete ->at($date, $format) diff --git a/src/Clock/Live.php b/src/Clock/Live.php index fb72e14..917ce6a 100644 --- a/src/Clock/Live.php +++ b/src/Clock/Live.php @@ -51,7 +51,7 @@ public function now(): PointInTime } /** - * @psalm-pure + * @psalm-mutation-free * * @param non-empty-string $date * @@ -60,7 +60,6 @@ public function now(): PointInTime public function at(string $date, Format $format): Maybe { try { - /** @psalm-suppress ImpureMethodCall */ $datetime = \DateTimeImmutable::createFromFormat($format->toString(), $date); } catch (\Throwable) { /** @var Maybe */ @@ -77,10 +76,6 @@ public function at(string $date, Format $format): Maybe return Maybe::nothing(); } - /** - * @psalm-suppress ImpureVariable - * @psalm-suppress ImpurePropertyFetch - */ return Maybe::just(PointInTime::at($datetime)->changeOffset($this->offset)); } } diff --git a/src/Clock/Logger.php b/src/Clock/Logger.php index 62fff73..1f3c83f 100644 --- a/src/Clock/Logger.php +++ b/src/Clock/Logger.php @@ -49,7 +49,7 @@ public function now(): PointInTime } /** - * @psalm-pure + * @psalm-mutation-free * * @param non-empty-string $date * @@ -57,10 +57,6 @@ public function now(): PointInTime */ public function at(string $date, Format $format): Maybe { - /** - * @psalm-suppress ImpureVariable - * @psalm-suppress ImpurePropertyFetch - */ return $this ->clock ->at($date, $format) diff --git a/src/Clock/OfFormat.php b/src/Clock/OfFormat.php new file mode 100644 index 0000000..b5dd272 --- /dev/null +++ b/src/Clock/OfFormat.php @@ -0,0 +1,42 @@ + + */ + public function at(string $date): Maybe + { + return $this->clock->at($date, $this->format); + } +} From 492ae8bc57759b4dada9e35063e375132e1a942f Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Sun, 24 Nov 2024 17:33:36 +0100 Subject: [PATCH 73/85] add periodic CI --- .github/workflows/periodic.yml | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .github/workflows/periodic.yml diff --git a/.github/workflows/periodic.yml b/.github/workflows/periodic.yml new file mode 100644 index 0000000..dff5656 --- /dev/null +++ b/.github/workflows/periodic.yml @@ -0,0 +1,33 @@ +name: Periodic CI + +on: + schedule: + - cron: '0 1 * * 0' + push: + paths: + - '.github/workflows/periodic.yml' + +jobs: + blackbox: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest] + php-version: ['8.3'] + dependency-versions: ['highest'] + name: 'BlackBox' + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-version }} + extensions: mbstring, intl + coverage: none + - name: Composer + uses: "ramsey/composer-install@v3" + with: + dependency-versions: ${{ matrix.dependencies }} + - name: BlackBox + run: php blackbox.php ci From 3636f51c5ceaf9d14b9cb8429d64166a6da40031 Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Sun, 24 Nov 2024 17:43:30 +0100 Subject: [PATCH 74/85] include microseconds in PointInTime::toString() --- CHANGELOG.md | 1 + src/PointInTime.php | 2 +- tests/Clock/LiveTest.php | 4 ++-- tests/Clock/LoggerTest.php | 8 ++++---- tests/ClockTest.php | 8 ++++---- tests/NowTest.php | 1 - tests/PointInTimeTest.php | 2 +- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ed4211f..1c7799a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -41,6 +41,7 @@ - `Innmind\TimeContinuum\PointInTime\Day::toInt()` has been renamed `Innmind\TimeContinuum\PointInTime\Day::ofMonth()` - `Innmind\TimeContinuum\ElapsedPeriod::of()` is now an `internal` method - `Innmind\TimeContinuum\Clock::at()` now requires a `Format` +- `Innmind\TimeContinuum\PointInTime::toString()` now contains the microseconds ### Removed diff --git a/src/PointInTime.php b/src/PointInTime.php index d546616..64dccfc 100644 --- a/src/PointInTime.php +++ b/src/PointInTime.php @@ -197,7 +197,7 @@ public function aheadOf(self $point): bool public function toString(): string { - return $this->date->format(\DateTime::ATOM); + return $this->date->format('Y-m-d\TH:i:s.uP'); } /** diff --git a/tests/Clock/LiveTest.php b/tests/Clock/LiveTest.php index f995daa..16e5e71 100644 --- a/tests/Clock/LiveTest.php +++ b/tests/Clock/LiveTest.php @@ -45,7 +45,7 @@ public function testAt() $date = new \DateTimeImmutable('2016-10-08T16:08:30+02:00'); $date = $date->setTimezone(new \DateTimeZone(\date('P'))); //system timezone $this->assertSame( - $date->format(\DateTime::ATOM), + $date->format('Y-m-d\TH:i:s.uP'), $point->toString(), ); } @@ -62,7 +62,7 @@ public function testAtWithSpecificFormat() $date = new \DateTimeImmutable('2016-10-08T16:08:30+02:00'); $date = $date->setTimezone(new \DateTimeZone(\date('P'))); //system timezone $this->assertSame( - $date->format(\DateTime::ATOM), + $date->format('Y-m-d\TH:i:s.uP'), $point->toString(), ); } diff --git a/tests/Clock/LoggerTest.php b/tests/Clock/LoggerTest.php index 9a44984..110e3ea 100644 --- a/tests/Clock/LoggerTest.php +++ b/tests/Clock/LoggerTest.php @@ -76,9 +76,9 @@ public function log($level, string|\Stringable $message, array $context = []): v $clock = Clock::logger($concrete, $logger); $this->assertSame( - $point->toString(), + $point->format(Format::iso8601()), $clock->at($point->format(Format::iso8601()), Format::iso8601())->match( - static fn($found) => $found->toString(), + static fn($found) => $found->format(Format::iso8601()), static fn() => null, ), ); @@ -133,9 +133,9 @@ public function log($level, string|\Stringable $message, array $context = []): v $clock = Clock::logger($concrete, $logger); $this->assertSame( - $point->toString(), + $point->format($format), $clock->at($point->format($format), $format)->match( - static fn($point) => $point->toString(), + static fn($point) => $point->format($format), static fn() => null, ), ); diff --git a/tests/ClockTest.php b/tests/ClockTest.php index d02122c..2abe5b6 100644 --- a/tests/ClockTest.php +++ b/tests/ClockTest.php @@ -106,9 +106,9 @@ public function testFrozenClockDoesntChangeItsTimezone() $clock->now()->toString(), ); $this->assertSame( - $frozen->now()->toString(), + $frozen->now()->format(Format::iso8601()), $clock->at($point->format(Format::iso8601()), Format::iso8601())->match( - static fn($point) => $point->toString(), + static fn($point) => $point->format(Format::iso8601()), static fn() => null, ), ); @@ -151,11 +151,11 @@ public function log($level, string|\Stringable $message, array $context = []): v $now2 = $new->now(); $this->assertSame( - $now1->toString(), + $now1->format(Format::iso8601()), $gather->logs[0]['point'], ); $this->assertSame( - $now2->toString(), + $now2->format(Format::iso8601()), $gather->logs[1]['point'], ); $this->assertNotSame( diff --git a/tests/NowTest.php b/tests/NowTest.php index 1b8fbf2..5114071 100644 --- a/tests/NowTest.php +++ b/tests/NowTest.php @@ -50,7 +50,6 @@ public function testInterface() $timezone = \date('P', $timestamp); $timezone = $timezone === '+00:00' ? 'Z' : $timezone; $this->assertSame($timezone, $point->offset()->toString()); - $this->assertSame(\date('Y-m-d\TH:i:sP', $timestamp), $point->toString()); } public function testFormat() diff --git a/tests/PointInTimeTest.php b/tests/PointInTimeTest.php index bcfd28b..476bb50 100644 --- a/tests/PointInTimeTest.php +++ b/tests/PointInTimeTest.php @@ -41,7 +41,7 @@ public function testInterface() $this->assertSame(30, $point->second()->toInt()); $this->assertSame(123, $point->millisecond()->toInt()); $this->assertSame('+02:00', $point->offset()->toString()); - $this->assertSame('2016-10-05T08:01:30+02:00', $point->toString()); + $this->assertSame('2016-10-05T08:01:30.123000+02:00', $point->toString()); } public function testPreserveMillisecondsWhenNanosecondsInString() From 3cbf4a5ff90e46e6f920b21341b4bd2221c91f4e Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Sun, 24 Nov 2024 17:49:20 +0100 Subject: [PATCH 75/85] disable testing with cookie format --- tests/Clock/LoggerTest.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/Clock/LoggerTest.php b/tests/Clock/LoggerTest.php index 110e3ea..23bffa8 100644 --- a/tests/Clock/LoggerTest.php +++ b/tests/Clock/LoggerTest.php @@ -104,12 +104,14 @@ public function testAskedDateWithSpecificFormatIsLogged() ->forAll( PointInTime::any(), Set\Elements::of( - Format::cookie(), Format::iso8601(), Format::rfc1123(), Format::rfc2822(), Format::rss(), Format::w3c(), + // problems with utc timezone as it sometimes return Z or + // GMT+0000 + // Format::cookie(), // the year is not precise enough to allow to correctly // parse any date with these formats // Format::rfc1036(), From f260ba722f05dc781e27d43f42675f38d6ccf3e8 Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Sun, 24 Nov 2024 17:54:31 +0100 Subject: [PATCH 76/85] reduce accepted unicity down to 80% --- tests/Fixtures/PeriodTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/Fixtures/PeriodTest.php b/tests/Fixtures/PeriodTest.php index ab36dae..94bba86 100644 --- a/tests/Fixtures/PeriodTest.php +++ b/tests/Fixtures/PeriodTest.php @@ -52,7 +52,7 @@ public function testAnyNumberOfYear() $generated[] = $value->years(); } - $this->assertGreaterThan(90, \count(\array_unique($generated))); + $this->assertGreaterThan(80, \count(\array_unique($generated))); } public function testLessThanAYear() @@ -87,6 +87,6 @@ public function testLessThanAYear() } } - $this->assertGreaterThan(90, \count($unique)); + $this->assertGreaterThan(80, \count($unique)); } } From add6fd613019dfd7543148937439dd780dd7459e Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Sun, 24 Nov 2024 18:02:16 +0100 Subject: [PATCH 77/85] fix inability to express a positive offset of less than an hour --- CHANGELOG.md | 3 +++ README.md | 2 +- docs/getting-started/time-offsets.md | 2 +- docs/upgrade/v3-to-v4.md | 2 +- src/Offset.php | 19 +++++++++++++++---- tests/ClockTest.php | 1 - tests/NowTest.php | 2 +- tests/PointInTimeTest.php | 2 +- 8 files changed, 23 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1c7799a..2505e97 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,8 @@ - `Innmind\TimeContinuum\Period::millisecond()` named constructor - `Innmind\TimeContinuum\PointInTime::microsecond()` - `Innmind\TimeContinuum\Clock::ofFormat()` +- `Innmind\TimeContinuum\Offset::plus()` +- `Innmind\TimeContinuum\Offset::minus()` ### Changed @@ -69,6 +71,7 @@ - `Innmind\TimeContinuum\ElapsedPeriod::maybe()` - `Innmind\TimeContinuum\ElapsedPeriod::ofPeriod()` - `Innmind\TimeContinuum\PointInTime::milliseconds()` +- `Innmind\TimeContinuum\Offset::of()` ## 3.4.1 - 2023-09-17 diff --git a/README.md b/README.md index 8cfc272..d6517ef 100644 --- a/README.md +++ b/README.md @@ -62,7 +62,7 @@ use Innmind\TimeContinuum\{ function foo(PointInTime $point) { - $point = $point->changeOffset(Offset::of(1, 0)); + $point = $point->changeOffset(Offset::plus(1, 0)); } ``` diff --git a/docs/getting-started/time-offsets.md b/docs/getting-started/time-offsets.md index 2819b54..3672e0e 100644 --- a/docs/getting-started/time-offsets.md +++ b/docs/getting-started/time-offsets.md @@ -22,7 +22,7 @@ use Innmind\TimeContinuum\{ }; $utc = Clock::live()->now(); -$newYork = $utc->changeOffset(Offset::of(-5)); +$newYork = $utc->changeOffset(Offset::minus(5)); ``` If `#!php $utc` represents `#!php '2024-11-24T14:25:00+00:00'` then `#!php $newYork` represents `#!php '2024-11-24T09:25:00-05:00'`. diff --git a/docs/upgrade/v3-to-v4.md b/docs/upgrade/v3-to-v4.md index a3716a8..7cf5783 100644 --- a/docs/upgrade/v3-to-v4.md +++ b/docs/upgrade/v3-to-v4.md @@ -96,7 +96,7 @@ These are the main changes, for an extensive list of changes go to the [changelo === "Before" ```php - $clock->now()->changeOffset(Offset::of(2, 0)); + $clock->now()->changeOffset(Offset::plus(2, 0)); ``` ## Periods diff --git a/src/Offset.php b/src/Offset.php index 9a5f867..9b3469c 100644 --- a/src/Offset.php +++ b/src/Offset.php @@ -24,18 +24,29 @@ private function __construct( */ public static function utc(): self { - return self::of(0, 0); + return self::plus(0, 0); } /** * @psalm-pure * - * @param int<-12, 14> $hours + * @param int<0, 14> $hours + * @param int<0, 59> $minutes + */ + public static function plus(int $hours, int $minutes = 0): self + { + return new self($hours, $minutes, true); + } + + /** + * @psalm-pure + * + * @param int<0, 12> $hours * @param int<0, 59> $minutes */ - public static function of(int $hours, int $minutes = 0): self + public static function minus(int $hours, int $minutes = 0): self { - return new self($hours, $minutes, $hours > 0); + return new self(-$hours, $minutes, false); } /** diff --git a/tests/ClockTest.php b/tests/ClockTest.php index 2abe5b6..d3dab9a 100644 --- a/tests/ClockTest.php +++ b/tests/ClockTest.php @@ -41,7 +41,6 @@ public function testSwitchTimezone($switch) $live = Clock::live(); $clock = $live->switch($switch); - $this->assertNotEquals($live, $clock); $this->assertIsString($clock->now()->format(Format::iso8601())); } diff --git a/tests/NowTest.php b/tests/NowTest.php index 5114071..7cc7d22 100644 --- a/tests/NowTest.php +++ b/tests/NowTest.php @@ -67,7 +67,7 @@ public function testChangeOffset() $now = new \DateTimeImmutable; $now = $now->setTimezone(new \DateTimeZone('-02:30')); $point = PointInTime::now(); - $point2 = $point->changeOffset(Offset::of(-2, 30)); + $point2 = $point->changeOffset(Offset::minus(2, 30)); $this->assertNotSame($point, $point2); $this->assertNotSame($point->year(), $point2->year()); diff --git a/tests/PointInTimeTest.php b/tests/PointInTimeTest.php index 476bb50..de06caa 100644 --- a/tests/PointInTimeTest.php +++ b/tests/PointInTimeTest.php @@ -65,7 +65,7 @@ public function testFormat() public function testChangeOffset() { $point = PointInTime::at(new \DateTimeImmutable('2016-10-05T08:01:30.123+02:00')); - $point2 = $point->changeOffset(Offset::of(-2, 30)); + $point2 = $point->changeOffset(Offset::minus(2, 30)); $this->assertNotSame($point, $point2); $this->assertNotSame($point->year(), $point2->year()); From 12382d5d198720b92fa747242487f6204883c611 Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Sun, 24 Nov 2024 18:05:33 +0100 Subject: [PATCH 78/85] typos --- docs/preface/terminology.md | 2 +- docs/upgrade/v3-to-v4.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/preface/terminology.md b/docs/preface/terminology.md index b5ec66a..bcaca6e 100644 --- a/docs/preface/terminology.md +++ b/docs/preface/terminology.md @@ -30,7 +30,7 @@ Due to politics a city may change its offset at any time (1). And for economic r 1. This means some points in time don't exist in certain countries or exist twice. 2. Usually they increase/decrease their offset by 1 or 2 hours. -Because asking the offset for a timezone will yeild different results depending on when you ask for it, it's part of the world that changes. This means that timezones are handled at the [clock](#clock) level. +Because asking the offset for a timezone will yield different results depending on when you ask for it, it's part of the world that changes. This means that timezones are handled at the [clock](#clock) level. ## Period diff --git a/docs/upgrade/v3-to-v4.md b/docs/upgrade/v3-to-v4.md index 7cf5783..8e2053b 100644 --- a/docs/upgrade/v3-to-v4.md +++ b/docs/upgrade/v3-to-v4.md @@ -81,7 +81,7 @@ These are the main changes, for an extensive list of changes go to the [changelo $clock->now()->timezone()->minutes(); ``` -=== "Before" +=== "After" ```php $clock->now()->offset()->hours(); $clock->now()->offset()->minutes(); @@ -94,7 +94,7 @@ These are the main changes, for an extensive list of changes go to the [changelo $clock->now()->changeTimezone(new Earth\Timezone\UTC(2, 0)); ``` -=== "Before" +=== "After" ```php $clock->now()->changeOffset(Offset::plus(2, 0)); ``` From ec45ec78a1c8d1ae3dd871754075997b8bdf7750 Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Thu, 28 Nov 2024 19:05:52 +0100 Subject: [PATCH 79/85] fix precision of elapsed periods --- CHANGELOG.md | 5 ++ proofs/elapsedPeriod.php | 109 +++++++++++++++++++++++ src/ElapsedPeriod.php | 69 ++++++++------ src/Period.php | 18 ++-- src/Period/Value.php | 18 ++-- src/PointInTime.php | 35 ++++++-- src/PointInTime/HighResolution.php | 37 ++++++-- tests/ElapsedPeriodTest.php | 46 +++++----- tests/NowTest.php | 6 +- tests/Period/DayTest.php | 12 +-- tests/Period/HourTest.php | 12 +-- tests/Period/MillisecondTest.php | 6 +- tests/Period/MinuteTest.php | 12 +-- tests/Period/SecondTest.php | 12 +-- tests/PointInTime/HighResolutionTest.php | 30 +++++-- tests/PointInTimeTest.php | 9 +- 16 files changed, 318 insertions(+), 118 deletions(-) create mode 100644 proofs/elapsedPeriod.php diff --git a/CHANGELOG.md b/CHANGELOG.md index 2505e97..49496af 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,8 @@ - `Innmind\TimeContinuum\Clock::ofFormat()` - `Innmind\TimeContinuum\Offset::plus()` - `Innmind\TimeContinuum\Offset::minus()` +- `Innmind\TimeContinuum\ElapsedPeriod::asPeriod()` +- `Innmind\TimeContinuum\Period\Value::seconds()` ### Changed @@ -72,6 +74,9 @@ - `Innmind\TimeContinuum\ElapsedPeriod::ofPeriod()` - `Innmind\TimeContinuum\PointInTime::milliseconds()` - `Innmind\TimeContinuum\Offset::of()` +- `Innmind\TimeContinuum\ElapsedPeriod::milliseconds()` +- `Innmind\TimeContinuum\Period\Value::second` +- `Innmind\TimeContinuum\Period\Value::milliseconds()` ## 3.4.1 - 2023-09-17 diff --git a/proofs/elapsedPeriod.php b/proofs/elapsedPeriod.php new file mode 100644 index 0000000..9de73b0 --- /dev/null +++ b/proofs/elapsedPeriod.php @@ -0,0 +1,109 @@ +filter(static fn($start, $end) => $end > $start), + static function( + $assert, + $startSeconds, + $endSeconds, + $startNanoseconds, + $endNanoseconds, + ) { + $start = HighResolution::of($startSeconds, $startNanoseconds); + $end = HighResolution::of($endSeconds, $endNanoseconds); + + $assert->true( + $start + ->elapsedSince($start) + ->equals( + Period::microsecond(0)->asElapsedPeriod(), + ), + ); + $assert->true( + $end + ->elapsedSince($start) + ->longerThan( + Period::microsecond(1)->asElapsedPeriod(), + ), + ); + }, + ); + yield proof( + 'High resolution elapsed period within same second', + given( + Set\Integers::between(0, 999_999_999), + Set\Integers::between(0, 999_999_999), + )->filter(static fn($start, $end) => $end > $start), + static function( + $assert, + $startNanoseconds, + $endNanoseconds, + ) { + $start = HighResolution::of(0, $startNanoseconds); + $end = HighResolution::of(0, $endNanoseconds); + + $assert->true( + $start + ->elapsedSince($start) + ->equals( + Period::microsecond(0)->asElapsedPeriod(), + ), + ); + $assert->true( + $end + ->elapsedSince($start) + ->longerThan( + Period::microsecond(1)->asElapsedPeriod(), + ), + ); + }, + ); + + yield proof( + 'Elapsed period', + given( + Fixtures\PointInTime::any(), + Set\Integers::above(1), + ), + static function($assert, $start, $microsecond) { + $assert->true( + $start + ->elapsedSince($start) + ->equals( + Period::microsecond(0)->asElapsedPeriod(), + ), + ); + $assert->true( + $start + ->goForward(Period::microsecond($microsecond)) + ->elapsedSince($start) + ->equals( + Period::microsecond($microsecond)->asElapsedPeriod(), + ), + ); + $assert->true( + $start + ->goForward(Period::microsecond($microsecond)) + ->elapsedSince($start) + ->longerThan( + Period::microsecond(0)->asElapsedPeriod(), + ), + ); + }, + ); +}; diff --git a/src/ElapsedPeriod.php b/src/ElapsedPeriod.php index cacb0af..204408f 100644 --- a/src/ElapsedPeriod.php +++ b/src/ElapsedPeriod.php @@ -9,14 +9,24 @@ final class ElapsedPeriod { /** @var int<0, max> */ + private int $seconds; + /** @var int<0, 999> */ + private int $milliseconds; + /** @var int<0, 999> */ private int $microseconds; - private function __construct(int $microseconds) - { - if ($microseconds < 0) { - throw new \RuntimeException((string) $microseconds); - } - + /** + * @param int<0, max> $seconds + * @param int<0, 999> $milliseconds + * @param int<0, 999> $microseconds + */ + private function __construct( + int $seconds, + int $milliseconds, + int $microseconds, + ) { + $this->seconds = $seconds; + $this->milliseconds = $milliseconds; $this->microseconds = $microseconds; } @@ -24,37 +34,42 @@ private function __construct(int $microseconds) * @psalm-pure * @internal * - * @throws \RuntimeException + * @param int<0, max> $seconds + * @param int<0, 999> $milliseconds + * @param int<0, 999> $microseconds */ - public static function of(int $microseconds): self - { - return new self($microseconds); + public static function of( + int $seconds, + int $milliseconds, + int $microseconds, + ): self { + return new self($seconds, $milliseconds, $microseconds); } - /** - * @return int<0, max> - */ - public function milliseconds(): int + public function longerThan(self $period): bool { - /** @var int<0, max> */ - return (int) ($this->microseconds / 1_000); - } + if ($this->seconds > $period->seconds) { + return true; + } - /** - * @return int<0, max> - */ - public function microseconds(): int - { - return $this->microseconds; - } + if ($this->milliseconds > $period->milliseconds) { + return true; + } - public function longerThan(self $period): bool - { return $this->microseconds > $period->microseconds; } public function equals(self $period): bool { - return $this->microseconds === $period->microseconds; + return $this->seconds === $period->seconds && + $this->milliseconds === $period->milliseconds && + $this->microseconds === $period->microseconds; + } + + public function asPeriod(): Period + { + return Period::second($this->seconds) + ->add(Period::millisecond($this->milliseconds)) + ->add(Period::microsecond($this->microseconds)); } } diff --git a/src/Period.php b/src/Period.php index d757f1d..bdf9091 100644 --- a/src/Period.php +++ b/src/Period.php @@ -458,13 +458,15 @@ public function asElapsedPeriod(): ElapsedPeriod throw new \LogicException('Months and years can not be converted to microseconds'); } - $milliseconds = Period\Value::day->milliseconds($this->days()) + - Period\Value::hour->milliseconds($this->hours()) + - Period\Value::minute->milliseconds($this->minutes()) + - Period\Value::second->milliseconds($this->seconds()) + - $this->milliseconds(); - $milliseconds *= 1_000; - - return ElapsedPeriod::of($milliseconds + $this->microseconds()); + $seconds = Period\Value::day->seconds($this->days()) + + Period\Value::hour->seconds($this->hours()) + + Period\Value::minute->seconds($this->minutes()) + + $this->second; + + return ElapsedPeriod::of( + $seconds, + $this->millisecond, + $this->microsecond, + ); } } diff --git a/src/Period/Value.php b/src/Period/Value.php index 123c504..00b9530 100644 --- a/src/Period/Value.php +++ b/src/Period/Value.php @@ -8,22 +8,24 @@ */ enum Value { - case second; case minute; case hour; case day; /** - * Returns the number of milliseconds contained in the number of seconds, - * minutes, hours and days + * Returns the number of seconds contained in the number of minutes, hours + * and days + * + * @param int<0, max> $number + * + * @return int<0, max> */ - public function milliseconds(int $number): int + public function seconds(int $number): int { return match ($this) { - self::second => $number * 1000, - self::minute => $number * self::second->milliseconds(60), - self::hour => $number * self::minute->milliseconds(60), - self::day => $number * self::hour->milliseconds(24), + self::minute => $number * 60, + self::hour => $number * self::minute->seconds(60), + self::day => $number * self::hour->seconds(24), }; } } diff --git a/src/PointInTime.php b/src/PointInTime.php index 64dccfc..376000d 100644 --- a/src/PointInTime.php +++ b/src/PointInTime.php @@ -143,14 +143,33 @@ public function elapsedSince(self $point): ElapsedPeriod } $seconds = ((int) $this->date->format('U')) - ((int) $point->date->format('U')); - $milliseconds = $seconds * 1_000; - $milliseconds += $this->millisecond()->toInt(); - $milliseconds -= $point->millisecond()->toInt(); - $microseconds = $milliseconds * 1_000; - $microseconds += $this->microsecond()->toInt(); - $microseconds -= $point->microsecond()->toInt(); - - return ElapsedPeriod::of($microseconds); + $milliseconds = $this->millisecond()->toInt() - $point->millisecond()->toInt(); + $microseconds = $this->microsecond()->toInt() - $point->microsecond()->toInt(); + + if ($milliseconds < 0) { + $seconds -= 1; + $milliseconds += 1_000; + } + + if ($microseconds < 0) { + $milliseconds -= 1; + $microseconds += 1_000; + } + + if ($seconds < 0 || $milliseconds < 0) { + throw new \RuntimeException(\sprintf( + 'Negative period : %ss, %smillis, %smicros', + $seconds, + $milliseconds, + $microseconds, + )); + } + + return ElapsedPeriod::of( + $seconds, + $milliseconds, + $microseconds, + ); } public function goBack(Period $period): self diff --git a/src/PointInTime/HighResolution.php b/src/PointInTime/HighResolution.php index 7b20455..6868c25 100644 --- a/src/PointInTime/HighResolution.php +++ b/src/PointInTime/HighResolution.php @@ -13,7 +13,7 @@ final class HighResolution { /** * @param int<0, max> $seconds - * @param int<0, max> $nanoseconds + * @param int<0, 999_999_999> $nanoseconds */ private function __construct( private int $seconds, @@ -28,7 +28,7 @@ public static function now(): self { /** * @var int<0, max> $seconds - * @var int<0, max> $nanoseconds + * @var int<0, 999_999_999> $nanoseconds */ [$seconds, $nanoseconds] = \hrtime(); @@ -39,20 +39,41 @@ public static function now(): self * @internal * * @param int<0, max> $seconds - * @param int<0, max> $nanoseconds + * @param int<0, 999_999_999> $nanoseconds */ public static function of(int $seconds, int $nanoseconds): self { return new self($seconds, $nanoseconds); } - public function elapsedSince(self $time): ElapsedPeriod + public function elapsedSince(self $other): ElapsedPeriod { - $seconds = $this->seconds - $time->seconds; - $nanoseconds = $this->nanoseconds - $time->nanoseconds; + $seconds = $this->seconds - $other->seconds; + $nanoseconds = $this->nanoseconds - $other->nanoseconds; - $microseconds = ($seconds * 1_000_000) + (int) ($nanoseconds / 1_000); + if ($nanoseconds < 0) { + $seconds -= 1; + $nanoseconds += 1_000_000_000; + } - return ElapsedPeriod::of($microseconds); + /** @var int<0, 999> */ + $microseconds = ((int) ($nanoseconds / 1_000)) % 1_000; + /** @var int<0, 999> */ + $milliseconds = ((int) ($nanoseconds / 1_000_000)) % 1_000; + + if ($seconds < 0) { + throw new \RuntimeException(\sprintf( + 'Negative period : %ss, %smillis, %smicros', + $seconds, + $milliseconds, + $microseconds, + )); + } + + return ElapsedPeriod::of( + $seconds, + $milliseconds, + $microseconds, + ); } } diff --git a/tests/ElapsedPeriodTest.php b/tests/ElapsedPeriodTest.php index cef8933..8506c45 100644 --- a/tests/ElapsedPeriodTest.php +++ b/tests/ElapsedPeriodTest.php @@ -13,35 +13,41 @@ class ElapsedPeriodTest extends TestCase { public function testInterface() { - $period = ElapsedPeriod::of(42); + $period = ElapsedPeriod::of(0, 0, 42); - $this->assertSame(0, $period->milliseconds()); - $this->assertSame(42, $period->microseconds()); + $this->assertTrue( + $period->equals( + Period::microsecond(42)->asElapsedPeriod(), + ), + ); - $period = ElapsedPeriod::of(42_000); + $period = ElapsedPeriod::of(0, 42, 0); - $this->assertSame(42, $period->milliseconds()); - $this->assertSame(42_000, $period->microseconds()); - } + $this->assertTrue( + $period->equals( + Period::millisecond(42)->asElapsedPeriod(), + ), + ); - public function testThrowWhenTryingToBuildANegativePeriod() - { - $this->expectException(\RuntimeException::class); - $this->expectExceptionMessage('-42'); + $period = ElapsedPeriod::of(42, 0, 0); - ElapsedPeriod::of(-42); + $this->assertTrue( + $period->equals( + Period::second(42)->asElapsedPeriod(), + ), + ); } public function testLongerThan() { $this->assertTrue( - ElapsedPeriod::of(42)->longerThan( - ElapsedPeriod::of(0), + ElapsedPeriod::of(0, 0, 42)->longerThan( + ElapsedPeriod::of(0, 0, 0), ), ); $this->assertFalse( - ElapsedPeriod::of(42)->longerThan( - ElapsedPeriod::of(66), + ElapsedPeriod::of(0, 0, 42)->longerThan( + ElapsedPeriod::of(0, 0, 66), ), ); } @@ -49,13 +55,13 @@ public function testLongerThan() public function testEquals() { $this->assertTrue( - ElapsedPeriod::of(42)->equals( - ElapsedPeriod::of(42), + ElapsedPeriod::of(0, 0, 42)->equals( + ElapsedPeriod::of(0, 0, 42), ), ); $this->assertFalse( - ElapsedPeriod::of(42)->equals( - ElapsedPeriod::of(66), + ElapsedPeriod::of(0, 0, 42)->equals( + ElapsedPeriod::of(0, 0, 66), ), ); } diff --git a/tests/NowTest.php b/tests/NowTest.php index 7cc7d22..cde7529 100644 --- a/tests/NowTest.php +++ b/tests/NowTest.php @@ -95,7 +95,11 @@ public function testElapsedSince() $this->assertInstanceOf(ElapsedPeriod::class, $elapsed); //make sure there's at least 1 second elapsed due to the sleep() - $this->assertTrue(1000 <= $elapsed->milliseconds()); + $this->assertTrue( + $elapsed->longerThan( + Period::second(1)->asElapsedPeriod(), + ), + ); } public function testAheadOf() diff --git a/tests/Period/DayTest.php b/tests/Period/DayTest.php index 38552b2..c862ae4 100644 --- a/tests/Period/DayTest.php +++ b/tests/Period/DayTest.php @@ -54,16 +54,16 @@ public function testAdd() public function testAsElapsedPeriod() { $this->assertSame( - 86_400_000, - Period::day(1)->asElapsedPeriod()->milliseconds(), + 1, + Period::day(1)->asElapsedPeriod()->asPeriod()->days(), ); $this->assertSame( - 172_800_000, - Period::day(2)->asElapsedPeriod()->milliseconds(), + 2, + Period::day(2)->asElapsedPeriod()->asPeriod()->days(), ); $this->assertSame( - 259_200_000, - Period::day(3)->asElapsedPeriod()->milliseconds(), + 3, + Period::day(3)->asElapsedPeriod()->asPeriod()->days(), ); } } diff --git a/tests/Period/HourTest.php b/tests/Period/HourTest.php index d0dd38e..a0b6efa 100644 --- a/tests/Period/HourTest.php +++ b/tests/Period/HourTest.php @@ -68,16 +68,16 @@ public function testAdd() public function testAsElapsedPeriod() { $this->assertSame( - 3_600_000, - Period::hour(1)->asElapsedPeriod()->milliseconds(), + 1, + Period::hour(1)->asElapsedPeriod()->asPeriod()->hours(), ); $this->assertSame( - 7_200_000, - Period::hour(2)->asElapsedPeriod()->milliseconds(), + 2, + Period::hour(2)->asElapsedPeriod()->asPeriod()->hours(), ); $this->assertSame( - 10_800_000, - Period::hour(3)->asElapsedPeriod()->milliseconds(), + 3, + Period::hour(3)->asElapsedPeriod()->asPeriod()->hours(), ); } diff --git a/tests/Period/MillisecondTest.php b/tests/Period/MillisecondTest.php index a9e9363..2875fad 100644 --- a/tests/Period/MillisecondTest.php +++ b/tests/Period/MillisecondTest.php @@ -75,15 +75,15 @@ public function testAsElapsedPeriod() { $this->assertSame( 1, - Period::millisecond(1)->asElapsedPeriod()->milliseconds(), + Period::millisecond(1)->asElapsedPeriod()->asPeriod()->milliseconds(), ); $this->assertSame( 2, - Period::millisecond(2)->asElapsedPeriod()->milliseconds(), + Period::millisecond(2)->asElapsedPeriod()->asPeriod()->milliseconds(), ); $this->assertSame( 3, - Period::millisecond(3)->asElapsedPeriod()->milliseconds(), + Period::millisecond(3)->asElapsedPeriod()->asPeriod()->milliseconds(), ); } diff --git a/tests/Period/MinuteTest.php b/tests/Period/MinuteTest.php index c6baa6c..debdcbd 100644 --- a/tests/Period/MinuteTest.php +++ b/tests/Period/MinuteTest.php @@ -72,16 +72,16 @@ public function testAdd() public function testAsElapsedPeriod() { $this->assertSame( - 60_000, - Period::minute(1)->asElapsedPeriod()->milliseconds(), + 1, + Period::minute(1)->asElapsedPeriod()->asPeriod()->minutes(), ); $this->assertSame( - 120_000, - Period::minute(2)->asElapsedPeriod()->milliseconds(), + 2, + Period::minute(2)->asElapsedPeriod()->asPeriod()->minutes(), ); $this->assertSame( - 180_000, - Period::minute(3)->asElapsedPeriod()->milliseconds(), + 3, + Period::minute(3)->asElapsedPeriod()->asPeriod()->minutes(), ); } diff --git a/tests/Period/SecondTest.php b/tests/Period/SecondTest.php index ddcda7c..510610e 100644 --- a/tests/Period/SecondTest.php +++ b/tests/Period/SecondTest.php @@ -73,16 +73,16 @@ public function testAdd() public function testAsElapsedPeriod() { $this->assertSame( - 1000, - Period::second(1)->asElapsedPeriod()->milliseconds(), + 1, + Period::second(1)->asElapsedPeriod()->asPeriod()->seconds(), ); $this->assertSame( - 2000, - Period::second(2)->asElapsedPeriod()->milliseconds(), + 2, + Period::second(2)->asElapsedPeriod()->asPeriod()->seconds(), ); $this->assertSame( - 3000, - Period::second(3)->asElapsedPeriod()->milliseconds(), + 3, + Period::second(3)->asElapsedPeriod()->asPeriod()->seconds(), ); } diff --git a/tests/PointInTime/HighResolutionTest.php b/tests/PointInTime/HighResolutionTest.php index 3a29d0c..23cc0cc 100644 --- a/tests/PointInTime/HighResolutionTest.php +++ b/tests/PointInTime/HighResolutionTest.php @@ -13,7 +13,10 @@ public function testDiffWithinSameSecond() $started = HighResolution::of(1, 1_000_000); $end = HighResolution::of(1, 2_000_000); - $this->assertSame(1, $end->elapsedSince($started)->milliseconds()); + $period = $end->elapsedSince($started)->asPeriod(); + $this->assertSame(0, $period->seconds()); + $this->assertSame(1, $period->milliseconds()); + $this->assertSame(0, $period->microseconds()); } public function testDiffLessThanOneSecondButNotInSameSecond() @@ -21,7 +24,10 @@ public function testDiffLessThanOneSecondButNotInSameSecond() $started = HighResolution::of(1, 2_000_000); $end = HighResolution::of(2, 1_000_000); - $this->assertSame(999, $end->elapsedSince($started)->milliseconds()); + $period = $end->elapsedSince($started)->asPeriod(); + $this->assertSame(0, $period->seconds()); + $this->assertSame(999, $period->milliseconds()); + $this->assertSame(0, $period->microseconds()); } public function testDiffMoreThanOneSecond() @@ -29,7 +35,10 @@ public function testDiffMoreThanOneSecond() $started = HighResolution::of(1, 2_000_000); $end = HighResolution::of(2, 3_000_000); - $this->assertSame(1001, $end->elapsedSince($started)->milliseconds()); + $period = $end->elapsedSince($started)->asPeriod(); + $this->assertSame(1, $period->seconds()); + $this->assertSame(1, $period->milliseconds()); + $this->assertSame(0, $period->microseconds()); } public function testDiffMoreThanMultipleSeconds() @@ -37,7 +46,10 @@ public function testDiffMoreThanMultipleSeconds() $started = HighResolution::of(1, 2_000_000); $end = HighResolution::of(3, 3_000_000); - $this->assertSame(2001, $end->elapsedSince($started)->milliseconds()); + $period = $end->elapsedSince($started)->asPeriod(); + $this->assertSame(2, $period->seconds()); + $this->assertSame(1, $period->milliseconds()); + $this->assertSame(0, $period->microseconds()); } public function testDiffMoreThanMultipleSeconds2() @@ -45,7 +57,10 @@ public function testDiffMoreThanMultipleSeconds2() $started = HighResolution::of(1, 2_000_000); $end = HighResolution::of(3, 1_000_000); - $this->assertSame(1999, $end->elapsedSince($started)->milliseconds()); + $period = $end->elapsedSince($started)->asPeriod(); + $this->assertSame(1, $period->seconds()); + $this->assertSame(999, $period->milliseconds()); + $this->assertSame(0, $period->microseconds()); } public function test1() @@ -53,7 +68,8 @@ public function test1() $started = HighResolution::of(684461, 547614375); $end = HighResolution::of(684462, 602541); - $this->assertSame(452, $end->elapsedSince($started)->milliseconds()); - $this->assertSame(452989, $end->elapsedSince($started)->microseconds()); + $period = $end->elapsedSince($started)->asPeriod(); + $this->assertSame(452, $period->milliseconds()); + $this->assertSame(988, $period->microseconds()); } } diff --git a/tests/PointInTimeTest.php b/tests/PointInTimeTest.php index de06caa..ad53c6a 100644 --- a/tests/PointInTimeTest.php +++ b/tests/PointInTimeTest.php @@ -7,7 +7,6 @@ PointInTime, Offset, Format, - ElapsedPeriod, PointInTime\Year, PointInTime\Month, PointInTime\Day, @@ -89,10 +88,12 @@ public function testElapsedSince() { $point = PointInTime::at(new \DateTimeImmutable('2016-10-05T08:01:30.123+02:00')); $point2 = PointInTime::at(new \DateTimeImmutable('2016-10-05T08:03:30.234+02:00')); - $elapsed = $point2->elapsedSince($point); + $elapsed = $point2->elapsedSince($point)->asPeriod(); - $this->assertInstanceOf(ElapsedPeriod::class, $elapsed); - $this->assertSame(120111, $elapsed->milliseconds()); + $this->assertSame(2, $elapsed->minutes()); + $this->assertSame(0, $elapsed->seconds()); + $this->assertSame(111, $elapsed->milliseconds()); + $this->assertSame(0, $elapsed->microseconds()); } public function testAheadOf() From cdd374268e2dcdac9cb4636eccb8ce150c6c3bc7 Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Thu, 28 Nov 2024 19:24:59 +0100 Subject: [PATCH 80/85] fix negative milliseconds case --- src/PointInTime.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/PointInTime.php b/src/PointInTime.php index 376000d..acfecf2 100644 --- a/src/PointInTime.php +++ b/src/PointInTime.php @@ -156,7 +156,18 @@ public function elapsedSince(self $point): ElapsedPeriod $microseconds += 1_000; } - if ($seconds < 0 || $milliseconds < 0) { + if ($milliseconds < 0) { + // This handles the case where any second diff is positive, but zero + // milliseconds and any microsecond diff. + // Duplication could be avoided by switching the 2 previous if but + // it would require to compute the number of seconds to subtract. + // The duplication seems more obvious to understand (at least for + // now). + $seconds -= 1; + $milliseconds += 1_000; + } + + if ($seconds < 0) { throw new \RuntimeException(\sprintf( 'Negative period : %ss, %smillis, %smicros', $seconds, From eda5ef85ad4208e8e2e430f98ba489d85f45d95e Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Thu, 28 Nov 2024 19:38:16 +0100 Subject: [PATCH 81/85] test negative cases --- proofs/elapsedPeriod.php | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/proofs/elapsedPeriod.php b/proofs/elapsedPeriod.php index 9de73b0..8801273 100644 --- a/proofs/elapsedPeriod.php +++ b/proofs/elapsedPeriod.php @@ -43,6 +43,7 @@ static function( ); }, ); + yield proof( 'High resolution elapsed period within same second', given( @@ -106,4 +107,43 @@ static function($assert, $start, $microsecond) { ); }, ); + + yield proof( + 'Negative elapsed periods throws', + given( + Fixtures\PointInTime::any(), + Set\Integers::above(1), + ), + static function($assert, $start, $microsecond) { + $assert->throws( + static fn() => $start + ->goBack(Period::microsecond($microsecond)) + ->elapsedSince($start), + ); + }, + ); + + yield proof( + 'Negative high resolution elapsed periods throws', + given( + Set\Integers::above(0), + Set\Integers::above(0), + Set\Integers::between(0, 999_999_999), + Set\Integers::between(0, 999_999_999), + )->filter(static fn($start, $end) => $end > $start), + static function( + $assert, + $startSeconds, + $endSeconds, + $startNanoseconds, + $endNanoseconds, + ) { + $start = HighResolution::of($startSeconds, $startNanoseconds); + $end = HighResolution::of($endSeconds, $endNanoseconds); + + $assert->throws( + static fn() => $start->elapsedSince($end), + ); + }, + ); }; From e9de15f90dd74bd68a59415273b1c9b1172cc348 Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Thu, 28 Nov 2024 19:40:18 +0100 Subject: [PATCH 82/85] increase the number of scenarii per proof in the CI --- blackbox.php | 1 + 1 file changed, 1 insertion(+) diff --git a/blackbox.php b/blackbox.php index 07580d3..86b7986 100644 --- a/blackbox.php +++ b/blackbox.php @@ -23,6 +23,7 @@ ->dumpTo('coverage.clover') ->enableWhen(true), ) + ->scenariiPerProof(1_000), ) ->tryToProve(static function() { yield from Load::everythingIn(__DIR__.'/proofs/')(); From 45ba4a63086ab937a9a8ddbe341a0c60cb332a26 Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Thu, 28 Nov 2024 20:10:59 +0100 Subject: [PATCH 83/85] fix PointInTime::equals() and ::aheadOf() --- proofs/clock.php | 29 +++++++++++++ proofs/pointInTime.php | 65 ++++++++++++++++++++++++++++++ src/PointInTime.php | 24 ++++------- src/PointInTime/HighResolution.php | 9 +++++ 4 files changed, 110 insertions(+), 17 deletions(-) create mode 100644 proofs/pointInTime.php diff --git a/proofs/clock.php b/proofs/clock.php index 38c8243..37252d0 100644 --- a/proofs/clock.php +++ b/proofs/clock.php @@ -141,4 +141,33 @@ static function($assert, $point) { ); }, ); + + yield proof( + 'Each call to Clock::now() is ahead of the previous', + given(Set\Nullable::of(Set\Integers::between(1, 2_000_000))), // up to 2 seconds + static function($assert, $microsecond) { + $clock = Clock::live(); + $start = $clock->now(); + + if (\is_int($microsecond)) { + \usleep($microsecond); + } + + $assert->true( + $clock->now()->aheadOf( + $start, + ), + ); + }, + ); + + yield test( + 'Clock::now() is equal to iteself', + static function($assert) { + $clock = Clock::live(); + $now = $clock->now(); + + $assert->true($now->equals($now)); + }, + ); }; diff --git a/proofs/pointInTime.php b/proofs/pointInTime.php new file mode 100644 index 0000000..88860e4 --- /dev/null +++ b/proofs/pointInTime.php @@ -0,0 +1,65 @@ +map(Period::microsecond(...)), + Set\Integers::above(0)->map(Period::millisecond(...)), + ), + ), + static function($assert, $point, $period) { + $assert->true( + $point + ->goForward($period) + ->goBack($period) + ->equals($point), + ); + $assert->true( + $point + ->goBack($period) + ->goForward($period) + ->equals($point), + ); + $assert->false( + $point + ->goBack($period) + ->equals($point), + ); + $assert->false( + $point + ->goForward($period) + ->equals($point), + ); + }, + ); + + yield proof( + 'PointInTime::aheadOf()', + given( + Fixtures\PointInTime::any(), + Fixtures\Period::any()->filter( + static fn($period) => !$period->equals(Period::microsecond(0)), + ), + ), + static function($assert, $point, $period) { + $assert->true( + $point + ->goForward($period) + ->aheadOf($point), + ); + $assert->false( + $point + ->goBack($period) + ->aheadOf($point), + ); + }, + ); +}; diff --git a/src/PointInTime.php b/src/PointInTime.php index acfecf2..8ce2c41 100644 --- a/src/PointInTime.php +++ b/src/PointInTime.php @@ -213,16 +213,20 @@ public function goForward(Period $period): self public function equals(self $point): bool { - [$self, $other] = self::compare($this, $point); + $format = Format::of('Y-m-dTH:i:s.u'); + $self = $this->changeOffset(Offset::utc())->format($format); + $other = $point->changeOffset(Offset::utc())->format($format); return $self === $other; } public function aheadOf(self $point): bool { - [$self, $other] = self::compare($this, $point); + if (!\is_null($this->highResolution) && !\is_null($point->highResolution)) { + return $this->highResolution->aheadOf($point->highResolution); + } - return $self > $other; + return $this->date > $point->date; } public function toString(): string @@ -230,20 +234,6 @@ public function toString(): string return $this->date->format('Y-m-d\TH:i:s.uP'); } - /** - * @psalm-pure - * @return array{string, string} - */ - private static function compare(self $self, self $other): array - { - $format = Format::of('Y-m-dTH:i:s.u'); - - return [ - $self->changeOffset(Offset::utc())->format($format), - $other->changeOffset(Offset::utc())->format($format), - ]; - } - /** * @psalm-pure */ diff --git a/src/PointInTime/HighResolution.php b/src/PointInTime/HighResolution.php index 6868c25..57ed89c 100644 --- a/src/PointInTime/HighResolution.php +++ b/src/PointInTime/HighResolution.php @@ -46,6 +46,15 @@ public static function of(int $seconds, int $nanoseconds): self return new self($seconds, $nanoseconds); } + public function aheadOf(self $other): bool + { + if ($this->seconds > $other->seconds) { + return true; + } + + return $this->nanoseconds > $other->nanoseconds; + } + public function elapsedSince(self $other): ElapsedPeriod { $seconds = $this->seconds - $other->seconds; From 079c7d1e65f15e7d665046d7c6d25afe5ef0f8b7 Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Thu, 28 Nov 2024 20:27:18 +0100 Subject: [PATCH 84/85] fix documentation --- docs/getting-started/elapsed-period.md | 4 +--- docs/index.md | 11 +++++++---- docs/upgrade/v3-to-v4.md | 19 +++++++++++++++++++ 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/docs/getting-started/elapsed-period.md b/docs/getting-started/elapsed-period.md index ddf8afa..bef41b7 100644 --- a/docs/getting-started/elapsed-period.md +++ b/docs/getting-started/elapsed-period.md @@ -15,15 +15,13 @@ $elapsed = $end->elapsedSince($start); `$elapsed` is an instance of `#!php Innmind\TimeContinuum\ElapsedPeriod`. -Depending on the precision you need you can call either `$elapsed->milliseconds()` or `$elapsed->microseconds()`. - This is especially useful when working with network I/O to check for timeouts. !!! success "" This example uses a monotonic clock internally to avoid the problem where the server clock re-synchronize and jump back in time. In this case `$end` is _technically_ before `$start` but the elapsed period is still a positive `int`. ??? info - Bear in mind that the monotonic clock only works on `PointInTime`s returned by `$clock->now()`. If `->elapsedSince()` is called on points returned by `$clock->at()` it will compare the number od microseconds [since epoch](points-in-time.md#milliseconds-since-epoch). + Bear in mind that the monotonic clock only works on `PointInTime`s returned by `$clock->now()`. If `->elapsedSince()` is called on points returned by `$clock->at()` it will compare the number of microseconds since epoch. ??? warning `ElapsedPeriod` uses an `int` internally to represent the number of microseconds. If you compare two points far away between each other you may end up with an overflow. diff --git a/docs/index.md b/docs/index.md index 0b134cf..c802b1c 100644 --- a/docs/index.md +++ b/docs/index.md @@ -26,12 +26,15 @@ It achieves this via: $start = $clock->now(); // do some stuff $end = $clock->now(); + $took = $end + ->elapsedSince($start) + ->asPeriod(); \printf( - 'The script ended at %s and it took %s microsecond(s).', + 'The script ended at %s and it took %s second(s), %s millisecond(s) %s microsecond(s).', $end->format(Format::iso8601()), - $end - ->elapsedSince($start) - ->microseconds(), + $took->seconds(), + $took->milliseconds(), + $took->microseconds(), ); ``` diff --git a/docs/upgrade/v3-to-v4.md b/docs/upgrade/v3-to-v4.md index 8e2053b..b01ce78 100644 --- a/docs/upgrade/v3-to-v4.md +++ b/docs/upgrade/v3-to-v4.md @@ -134,3 +134,22 @@ These are the main changes, for an extensive list of changes go to the [changelo ```php $clock->now()->format(Format::iso8601()); ``` + +## Elapsed periods + +=== "Before" + ```php + $elapsed = /* any instance of ElapsedPeriod */ + $milliseconds = $elapsed->milliseconds(); + ``` + +=== "After" + ```php + $elapsed = /* any instance of ElapsedPeriod */ + $period = $elapsed->asPeriod(); + $milliseconds = Period\Value::day->seconds($period->days()); + $milliseconds += Period\Value::hour->seconds($period->hours()); + $milliseconds += Period\Value::minute->seconds($period->minutes()); + $milliseconds *= 1_000; + $milliseconds += $period->milliseconds(); + ``` From de89fa7f3d67720f1fb9087074e6c92e285f47cb Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Thu, 28 Nov 2024 20:28:05 +0100 Subject: [PATCH 85/85] specify next release --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 49496af..c5358fe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -## [Unreleased] +## 4.0.0 - 2024-11-28 ## Added