Lines n/a 0 / 0
Functions and Methods n/a 0 / 0
Classes and Traits n/a 0 / 0
Name Lines Functions and Methods CRAP Classes and Traits
1<?php
2
3declare(strict_types=1);
4
5namespace Stewart\Support\Time;
6
7use Closure;
8use Stewart\Contracts\Time\Duration;
9use Stewart\Contracts\Time\PendingWait;
10
11/** @internal */
12interface Timers
13{
14    /** @param Closure(): void $callback */
15    public function startTimer(Duration $delay, Closure $callback): TimerHandle;
16
17    // Only the first resolve() or fail() counts; the closure $arm returns runs once the wait ends, however it ends.
18    /**
19     * @template T
20     * @param Closure(PendingWait<T>): (Closure(): void) $arm
21     * @return T|null
22     */
23    public function waitFor(Closure $arm, ?Duration $timeout = null): mixed;
24}