diff --git a/src/Config/Async.php b/src/Config/Async.php index 9040b46..400649d 100644 --- a/src/Config/Async.php +++ b/src/Config/Async.php @@ -5,7 +5,6 @@ use Innmind\OperatingSystem\Config; use Innmind\Signals\Async\Interceptor; -use Innmind\Time\Clock; /** * @internal @@ -16,7 +15,6 @@ final class Async * @psalm-mutation-free */ private function __construct( - private Clock $clock, private ?Interceptor $interceptor, ) { } @@ -24,11 +22,11 @@ private function __construct( public function __invoke(Config $config): Config { return $config - ->mapIO(fn($io) => $io->asAsync($this->clock)) - ->mapHalt(fn($halt) => $halt->asAsync($this->clock)) - ->mapHttpTransport(fn($transport, $config) => $transport->map( - fn($http) => $http->asAsync( - $this->clock, + ->mapIO(static fn($io, $config) => $io->asAsync($config->clock())) + ->mapHalt(static fn($halt, $config) => $halt->asAsync($config->clock())) + ->mapHttpTransport(static fn($transport, $config) => $transport->map( + static fn($http) => $http->asAsync( + $config->clock(), $config->halt(), $config->io(), ), @@ -39,8 +37,8 @@ public function __invoke(Config $config): Config /** * @psalm-pure */ - public static function of(Clock $clock, ?Interceptor $interceptor): self + public static function of(?Interceptor $interceptor): self { - return new self($clock, $interceptor); + return new self($interceptor); } } diff --git a/src/Config/Provider.php b/src/Config/Provider.php index 02171fe..b63dad1 100644 --- a/src/Config/Provider.php +++ b/src/Config/Provider.php @@ -4,7 +4,6 @@ namespace Innmind\Async\Config; use Innmind\Signals\Async\Interceptor; -use Innmind\Time\Clock; /** * @internal @@ -13,20 +12,19 @@ final class Provider { private function __construct( - private Clock $clock, ) { } public function __invoke(?Interceptor $interceptor = null): Async { - return Async::of($this->clock, $interceptor); + return Async::of($interceptor); } /** * @psalm-pure */ - public static function of(Clock $clock): self + public static function new(): self { - return new self($clock); + return new self; } } diff --git a/src/Scheduler/Sink.php b/src/Scheduler/Sink.php index 09cb56a..2150cb3 100644 --- a/src/Scheduler/Sink.php +++ b/src/Scheduler/Sink.php @@ -60,7 +60,7 @@ public function with(callable $scope): mixed $scope, $this->carry, ), - Config\Provider::of($this->sync->clock()), + Config\Provider::new(), $this->concurrencyLimit, );