From 37fc4fcbf64147a63270fa98fe397894f19e24b3 Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Sun, 18 Jan 2026 15:55:49 +0100 Subject: [PATCH] replace time-continuum by time --- CHANGELOG.md | 2 +- composer.json | 2 +- proofs/pointInTime.php | 44 +++++++------------------------ src/Constraint.php | 2 +- src/Constraint/PointInTime.php | 8 +++--- src/Constraint/Provider/Clock.php | 8 +++--- src/PointInTime.php | 6 ++--- 7 files changed, 23 insertions(+), 49 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bf6d114..30e1c71 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ - Require PHP `8.4` - Require `innmind/immutable:~6.0` -- Require `innmind/time-continuum:~5.0` +- Require `innmind/time:~1.0` ## 2.3.0 - 2025-09-15 diff --git a/composer.json b/composer.json index 6c0e207..6b286f7 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,7 @@ "require": { "php": "~8.4", "innmind/immutable": "~6.0", - "innmind/time-continuum": "~5.0" + "innmind/time": "~1.0" }, "autoload": { "psr-4": { diff --git a/proofs/pointInTime.php b/proofs/pointInTime.php index b491066..ad521a4 100644 --- a/proofs/pointInTime.php +++ b/proofs/pointInTime.php @@ -2,38 +2,24 @@ declare(strict_types = 1); use Innmind\Validation\PointInTime; -use Innmind\TimeContinuum\{ - Earth, - Earth\Format\ISO8601, +use Innmind\Time\{ Clock, Format, }; use Innmind\BlackBox\Set; -use Fixtures\Innmind\TimeContinuum\{ - PointInTime as FPointInTime, - Earth as FEarth, -}; +use Fixtures\Innmind\Time\Point as FPoint; return static function() { yield proof( 'PointInTime::ofFormat()', given( - match (true) { - \class_exists(FEarth\PointInTime::class) => FEarth\PointInTime::any(), - default => FPointInTime::any(), - }, + FPoint::any(), Set::strings(), ), static function($assert, $point, $random) { - $format = match (true) { - \class_exists(ISO8601::class) => new ISO8601, - default => Format::of('Y-m-d\TH:i:s.uP'), // to support microseconds - }; + $format = Format::of('Y-m-d\TH:i:s.uP'); // to support microseconds $string = $point->format($format); - $clock = match (true) { - \class_exists(Earth\Clock::class) => new Earth\Clock, - default => Clock::live(), - }; + $clock = Clock::live(); $assert->true( PointInTime::ofFormat($clock, $format)->asPredicate()($string), @@ -72,14 +58,8 @@ static function($assert, $point, $random) { Set::strings(), ), static function($assert, $expected, $random) { - $format = match (true) { - \class_exists(ISO8601::class) => new ISO8601, - default => Format::iso8601(), - }; - $clock = match (true) { - \class_exists(Earth\Clock::class) => new Earth\Clock, - default => Clock::live(), - }; + $format = Format::iso8601(); + $clock = Clock::live(); [[$path, $message]] = PointInTime::ofFormat($clock, $format)->withFailure($expected)($random)->match( static fn() => null, @@ -97,14 +77,8 @@ static function($assert, $expected, $random) { yield test( 'PointInTime::ofFormat() with empty string fails', static function($assert) { - $format = match (true) { - \class_exists(ISO8601::class) => new ISO8601, - default => Format::iso8601(), - }; - $clock = match (true) { - \class_exists(Earth\Clock::class) => new Earth\Clock, - default => Clock::live(), - }; + $format = Format::iso8601(); + $clock = Clock::live(); [[$path, $message]] = PointInTime::ofFormat($clock, $format)('')->match( static fn() => null, diff --git a/src/Constraint.php b/src/Constraint.php index 078afd3..a31c3e3 100644 --- a/src/Constraint.php +++ b/src/Constraint.php @@ -7,7 +7,7 @@ Constraint\Implementation, Constraint\Provider, }; -use Innmind\TimeContinuum\Clock; +use Innmind\Time\Clock; use Innmind\Immutable\{ Validation, Predicate, diff --git a/src/Constraint/PointInTime.php b/src/Constraint/PointInTime.php index dc30a37..95764c6 100644 --- a/src/Constraint/PointInTime.php +++ b/src/Constraint/PointInTime.php @@ -4,16 +4,16 @@ namespace Innmind\Validation\Constraint; use Innmind\Validation\Failure; -use Innmind\TimeContinuum\{ +use Innmind\Time\{ Clock, Format, - PointInTime as PointInTimeInterface, + Point, }; use Innmind\Immutable\Validation; /** * @internal - * @implements Implementation + * @implements Implementation * @psalm-immutable */ final class PointInTime implements Implementation @@ -27,7 +27,7 @@ private function __construct( /** * @param string $value * - * @return Validation + * @return Validation */ #[\Override] public function __invoke(mixed $value): Validation diff --git a/src/Constraint/Provider/Clock.php b/src/Constraint/Provider/Clock.php index 8fd03fc..58a1430 100644 --- a/src/Constraint/Provider/Clock.php +++ b/src/Constraint/Provider/Clock.php @@ -7,10 +7,10 @@ Constraint, Constraint\Implementation, }; -use Innmind\TimeContinuum\{ +use Innmind\Time\{ Clock as Concrete, Format, - PointInTime, + Point, }; /** @@ -42,12 +42,12 @@ public static function of(\Closure $build, Concrete $clock): self /** * @template E * - * @return Constraint + * @return Constraint */ #[\NoDiscard] public function format(Format $format): Constraint { - /** @var Constraint */ + /** @var Constraint */ return ($this->build)(Constraint\PointInTime::ofFormat( $this->clock, $format, diff --git a/src/PointInTime.php b/src/PointInTime.php index df1605e..2b5be4d 100644 --- a/src/PointInTime.php +++ b/src/PointInTime.php @@ -3,10 +3,10 @@ namespace Innmind\Validation; -use Innmind\TimeContinuum\{ +use Innmind\Time\{ Clock, Format, - PointInTime as PointInTimeInterface, + Point, }; /** @@ -21,7 +21,7 @@ private function __construct() /** * @psalm-pure * - * @return Constraint + * @return Constraint */ #[\NoDiscard] public static function ofFormat(Clock $clock, Format $format): Constraint