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v4#9'3,r&#LX>lY۟ݎľ :=7$߮3j}AblmӀg5̺U5ݖ!yx_ThÓq8j*D "Ad•<ꂄE6p'!|p%#G~ѝOQ{ͪb zB${uO$Dd6C}ʡʸ.lCJaV)H~#}4~HL\ :^,(#C,bSվ4 VfVe.yՀ'kn%eF2|hŏE&ۆd) H-DhߦYC#,,*ந7{`RW÷ZU};Fx!>~)i~+i{rr*A\_~?A5 8L:knj1ť|vlÓ!4 4s {Lw[$5^F4 dA.>#1B7^LjC;}g[X-Ҝa|+eM4z}6TЂ5@f%Ȧ+oПp+_XTATݵr=K  @x>jn?F]vaۤbSw03CZ.7h٩LT2T :QV;K4R=ARջ|QϸnFK`&M?h69||iYvؽ |dL-K7c?0}\&_Tq'4&8hqex1+~=M55E*k\kz?Ĥb~kwr8;wJ * STjl+Eu6\Wr!w%tytk}v!A.>IcGʪA@sW.07٨p೴ v I&m)T,R[#ՅBj 42 = 9Lfɡ]wU;JAW \ x&!(W=OW{-e62_ݩĽ[KYtKgU3xQ썖¸Lrb-Jx (]Ő}ͣ'dkoXJZ;BpxBt = $this->waitFn = null; $this->cancelFn = null; if (!$handlers) { return; } // If the value was not a settled promise or a thenable, then resolve // it in the task queue using the correct ID. if (!is_object($value) || !method_exists($value, 'then')) { $id = $state === self::FULFILLED ? 1 : 2; // It's a success, so resolve the handlers in the queue. Utils::queue()->add(static function () use ($id, $value, $handlers): void { foreach ($handlers as $handler) { self::callHandler($id, $value, $handler); } }); } elseif ($value instanceof Promise && Is::pending($value)) { // We can just merge our handlers onto the next promise. $value->handlers = array_merge($value->handlers, $handlers); } else { // Resolve the handlers when the forwarded promise is resolved. $value->then( static function ($value) use ($handlers): void { foreach ($handlers as $handler) { self::callHandler(1, $value, $handler); } }, static function ($reason) use ($handlers): void { foreach ($handlers as $handler) { self::callHandler(2, $reason, $handler); } } ); } } /** * Call a stack of handlers using a specific callback index and value. * * @param int $index 1 (resolve) or 2 (reject). * @param mixed $value Value to pass to the callback. * @param array $handler Array of handler data (promise and callbacks). */ private static function callHandler(int $index, $value, array $handler): void { /** @var PromiseInterface $promise */ $promise = $handler[0]; // The promise may have been cancelled or resolved before placing // this thunk in the queue. if (Is::settled($promise)) { return; } try { if (isset($handler[$index])) { /* * If $f throws an exception, then $handler will be in the exception * stack trace. Since $handler contains a reference to the callable * itself we get a circular reference. We clear the $handler * here to avoid that memory leak. */ $f = $handler[$index]; unset($handler); $promise->resolve($f($value)); } elseif ($index === 1) { // Forward resolution values as-is. $promise->resolve($value); } else { // Forward rejections down the chain. $promise->reject($value); } } catch (\Throwable $reason) { $promise->reject($reason); } } private function waitIfPending(): void { if ($this->state !== self::PENDING) { return; } elseif ($this->waitFn) { $this->invokeWaitFn(); } elseif ($this->waitList) { $this->invokeWaitList(); } else { // If there's no wait function, then reject the promise. $this->reject('Cannot wait on a promise that has ' .'no internal wait function. You must provide a wait ' .'function when constructing the promise to be able to ' .'wait on a promise.'); } Utils::queue()->run(); /** @psalm-suppress RedundantCondition */ if ($this->state === self::PENDING) { $this->reject('Invoking the wait callback did not resolve the promise'); } } private function invokeWaitFn(): void { try { $wfn = $this->waitFn; $this->waitFn = null; $wfn(true); } catch (\Throwable $reason) { if ($this->state === self::PENDING) { // The promise has not been resolved yet, so reject the promise // with the exception. $this->reject($reason); } else { // The promise was already resolved, so there's a problem in // the application. throw $reason; } } } private function invokeWaitList(): void { $waitList = $this->waitList; $this->waitList = null; foreach ($waitList as $result) { do { $result->waitIfPending(); $result = $result->result; } while ($result instanceof Promise); if ($result instanceof PromiseInterface) { $result->wait(false); } } } }