4 Commits
Author SHA1 Message Date
Jérôme Gamez 7004b55fcd Release 3.0.0 2022-11-26 19:03:05 +01:00
Jérôme Gamez ebd491dc6e Replace stella-maris/clock with psr/clock 2022-11-26 19:01:32 +01:00
Jérôme Gamez cf2cc16e66 Release 2.3.1 2022-11-25 19:24:28 +01:00
Jérôme Gamez 6ee3f318f8 Switch back to stella-maris/clock
This reverts commit a5e62affe0.
2022-11-25 19:22:56 +01:00
3 changed files with 11 additions and 5 deletions
+1
View File
@@ -6,6 +6,7 @@ on:
branches:
- '1.x'
- '2.x'
- '3.x'
jobs:
tests:
+6
View File
@@ -1,5 +1,11 @@
# CHANGELOG
## 3.0.0 - 2022-11-26
This release replaces `stella-maris/clock` with `psr/clock`.
## 2.3.1 - 2022-11-25
This release reverts the change to implement `psr/clock` directly, to not break dependents who rely on `stella-maris/clock`
## 2.3.0 - 2022-11-25
This release re-introduces support for PHP ^8.0 and implements the freshly released `psr/clock` (PSR-20) directly.
+4 -5
View File
@@ -6,7 +6,6 @@ namespace Beste\Clock;
use Beste\Clock;
use DateTimeImmutable;
use InvalidArgumentException;
use Psr\Clock\ClockInterface;
final class WrappingClock implements Clock
@@ -25,11 +24,11 @@ final class WrappingClock implements Clock
}
if (!method_exists($clock, 'now')) {
throw new InvalidArgumentException('$clock must implement '.ClockInterface::class.' or have a now() method');
throw new \InvalidArgumentException('$clock must implement StellaMaris\Clock\ClockInterface or have a now() method');
}
if (!($clock->now() instanceof DateTimeImmutable)) {
throw new InvalidArgumentException('$clock->now() must return a DateTimeImmutable');
throw new \InvalidArgumentException('$clock->now() must return a DateTimeImmutable');
}
$wrappedClock = new class($clock) implements ClockInterface {
@@ -40,13 +39,13 @@ final class WrappingClock implements Clock
$this->clock = $clock;
}
public function now(): DateTimeImmutable
public function now(): \DateTimeImmutable
{
assert(method_exists($this->clock, 'now'));
$now = $this->clock->now();
assert($now instanceof DateTimeImmutable);
assert($now instanceof \DateTimeImmutable);
return $now;
}