Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Promise.php

function Promise::waitIfPending

1 call to Promise::waitIfPending()
Promise::wait in vendor/guzzlehttp/promises/src/Promise.php
Waits until the promise completes if possible.

File

vendor/guzzlehttp/promises/src/Promise.php, line 222

Class

Promise
Promises/A+ implementation that avoids recursion when possible.

Namespace

GuzzleHttp\Promise

Code

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');
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal