Slightly different from the asynchronous ideas on this feature is based on the Generator as a whole.
Let's take a look at its interface.
/**
* @return SplQueue|null
*
* This function returns the task queue.
*/
public static function getTaskQueue(): ?SplQueue;
/**
* @param mixed ...$coroutines
* @return void
*
* This is a blocking function that runs all the coroutines passed to it.
*/
public static function runNonBlocking(mixed ...$coroutines): void;
/**
* @param mixed ...$coroutines
* @return void
*
* This is a blocking function that runs all the coroutines passed to it.
*/
public static function runBlocking(mixed ...$coroutines): void;
/**
* @param callable $callback
* @param int $times
* @return Closure
*
* This is a generator that runs a callback function a specified amount of times.
*/
public static function repeat(callable $callback, int $times): Closure;
/**
* @param int $milliseconds
* @return Generator
*
* This is a generator that yields for a specified amount of milliseconds.
*/
public static function delay(int $milliseconds): Generator;
/**
* @return void
*
* This function runs the task queue.
*/
public static function run(): void;