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.
/** * @returnSplQueue|null * * This function returns the task queue. */publicstaticfunctiongetTaskQueue():?SplQueue;/** * @parammixed ...$coroutines * @returnvoid * * This is a blocking function that runs all the coroutines passed to it. */publicstaticfunctionrunNonBlocking(mixed...$coroutines):void;/** * @parammixed ...$coroutines * @returnvoid * * This is a blocking function that runs all the coroutines passed to it. */publicstaticfunctionrunBlocking(mixed...$coroutines):void;/** * @paramcallable $callback * @paramint $times * @returnClosure * * This is a generator that runs a callback function a specified amount of times. */publicstaticfunctionrepeat(callable $callback,int $times):Closure;/** * @paramint $milliseconds * @returnGenerator * * This is a generator that yields for a specified amount of milliseconds. */publicstaticfunctiondelay(int $milliseconds):Generator;/** * @returnvoid * * This function runs the task queue. */publicstaticfunctionrun():void;