$this->onFulfilled =
$this->onRejected = null;
$this->nextPendingIndex = 0;
};
$this->aggregate->
then($clearFn,
$clearFn);
} private function refillPending(): void
{ if (!
$this->concurrency
) { // Add all pending promises.
while ($this->
addPending() &&
$this->
advanceIterator()) { } return;
} // Add only up to N pending promises.
$concurrency =
is_callable($this->concurrency
) ?
call_user_func($this->concurrency,
count($this->pending
)) :
$this->concurrency;
$concurrency =
max($concurrency -
count($this->pending
), 0
);
// Concurrency may be set to 0 to disallow new promises.