Lines Matching defs:promise
38 // This promise has a canceller, so we create a new child promise which
40 // followers are also cancelled. We keep a reference to this promise
64 $this->handlers[] = static function (ExtendedPromiseInterface $promise) use ($onFulfilled, $onRejected) {
65 $promise
132 $this->handlers[] = static function (ExtendedPromiseInterface $promise) use ($onFulfilled, $onRejected, $resolve, $reject, $progressHandler) {
133 $promise
151 private function settle(ExtendedPromiseInterface $promise)
153 $promise = $this->unwrap($promise);
155 if ($promise === $this) {
156 $promise = new RejectedPromise(
157 new \LogicException('Cannot resolve a promise with itself.')
164 $this->result = $promise;
168 $handler($promise);
172 private function unwrap($promise)
174 $promise = $this->extract($promise);
176 while ($promise instanceof self && null !== $promise->result) {
177 $promise = $this->extract($promise->result);
180 return $promise;
183 private function extract($promise)
185 if ($promise instanceof LazyPromise) {
186 $promise = $promise->promise();
189 return $promise;
217 // Keep references to this promise instance for the static resolve/reject functions.
219 // and passing the target promise instance by reference, we can
221 // reference when settling the promise. This helps avoiding