class CoroutineTaskQueue implements ScopedTaskQueueInterface

Drain each coroutine's callbacks independently and cancel unfinished work at exit, preserving the original queue outside coroutines.

Methods

__construct(TaskQueueInterface $outside)

Retain the existing non-coroutine queue and its shutdown behavior.

static void
install()

Install the routing queue once without replacing an existing installation.

bool
isEmpty()

Determine whether the current coroutine has pending tasks.

void
add(callable $task)

Add a task to the current coroutine's queue.

void
run()

Run the current coroutine's pending tasks.

void
track(PromiseInterface $promise)

Retain pending transport work until its completion callbacks run.

void
resetOutside()

Discard outside-coroutine test tasks without retaining a shutdown callback.

TaskQueueInterface
current()

Resolve the queue owned by the current native coroutine.

Details

at line 25
__construct(TaskQueueInterface $outside)

Retain the existing non-coroutine queue and its shutdown behavior.

Parameters

TaskQueueInterface $outside

at line 34
static void install()

Install the routing queue once without replacing an existing installation.

Guzzle's queue is process-global; install before scheduling work.

Return Value

void

at line 47
bool isEmpty()

Determine whether the current coroutine has pending tasks.

Return Value

bool

at line 55
void add(callable $task)

Add a task to the current coroutine's queue.

Parameters

callable $task

Return Value

void

at line 63
void run()

Run the current coroutine's pending tasks.

Return Value

void

at line 71
void track(PromiseInterface $promise)

Retain pending transport work until its completion callbacks run.

Parameters

PromiseInterface $promise

Return Value

void

at line 81
void resetOutside()

Discard outside-coroutine test tasks without retaining a shutdown callback.

The PHPUnit extension seeds a shutdown-disabled delegate before installation.

Return Value

void

at line 90
protected TaskQueueInterface current()

Resolve the queue owned by the current native coroutine.

Return Value

TaskQueueInterface