Overview

Namespaces

  • Docta
    • MercadoLibre
      • Exception
      • OAuth2
        • Client
          • Test
  • GuzzleHttp
    • Cookie
    • Exception
    • Handler
    • Promise
      • Test
      • Tests
    • Psr7
    • Test
      • Handler
    • Tests
      • CookieJar
      • Event
      • Exception
      • Handler
      • Promise
      • Psr7
  • League
    • OAuth2
      • Client
        • Grant
          • Exception
        • Provider
          • Exception
        • Test
          • Grant
          • Provider
            • Exception
            • Fake
          • Token
          • Tool
        • Token
        • Tool
  • None
  • Psr
    • Http
      • Message

Classes

  • AggregateExceptionTest
  • CoroutineTest
  • EachPromiseTest
  • FunctionsTest
  • NotPromiseInstance
  • PromiseTest
  • RejectedPromiseTest
  • RejectionExceptionTest
  • Thennable
  • Thing1
  • Thing2
  • Overview
  • Namespace
  • Class
  • Download

Class NotPromiseInstance

A promise represents the eventual result of an asynchronous operation.

The primary way of interacting with a promise is through its then method, which registers callbacks to receive either a promise’s eventual value or the reason why the promise cannot be fulfilled.

GuzzleHttp\Promise\Tests\Thennable
Extended by GuzzleHttp\Promise\Tests\NotPromiseInstance implements GuzzleHttp\Promise\PromiseInterface
Namespace: GuzzleHttp\Promise\Tests
Link: https://promisesaplus.com/
Located at tests/NotPromiseInstance.php
Methods summary
public
# __construct( )

Overrides

GuzzleHttp\Promise\Tests\Thennable::__construct()
public GuzzleHttp\Promise\PromiseInterface
# then( callable $res = null, callable $rej = null )

Appends fulfillment and rejection handlers to the promise, and returns a new promise resolving to the return value of the called handler.

Appends fulfillment and rejection handlers to the promise, and returns a new promise resolving to the return value of the called handler.

Parameters

$res
$onFulfilled Invoked when the promise fulfills.
$rej
$onRejected Invoked when the promise is rejected.

Returns

GuzzleHttp\Promise\PromiseInterface

Overrides

GuzzleHttp\Promise\Tests\Thennable::then()

Implementation of

GuzzleHttp\Promise\PromiseInterface::then()
public GuzzleHttp\Promise\PromiseInterface
# otherwise( callable $onRejected )

Appends a rejection handler callback to the promise, and returns a new promise resolving to the return value of the callback if it is called, or to its original fulfillment value if the promise is instead fulfilled.

Appends a rejection handler callback to the promise, and returns a new promise resolving to the return value of the callback if it is called, or to its original fulfillment value if the promise is instead fulfilled.

Parameters

$onRejected
Invoked when the promise is rejected.

Returns

GuzzleHttp\Promise\PromiseInterface

Implementation of

GuzzleHttp\Promise\PromiseInterface::otherwise()
public
# resolve( mixed $value )

Resolve the promise with the given value.

Resolve the promise with the given value.

Parameters

$value

Throws

RuntimeException
if the promise is already resolved.

Overrides

GuzzleHttp\Promise\Tests\Thennable::resolve()

Implementation of

GuzzleHttp\Promise\PromiseInterface::resolve()
public
# reject( mixed $reason )

Reject the promise with the given reason.

Reject the promise with the given reason.

Parameters

$reason

Throws

RuntimeException
if the promise is already resolved.

Implementation of

GuzzleHttp\Promise\PromiseInterface::reject()
public mixed
# wait( boolean $unwrap = true, $defaultResolution = null )

Waits until the promise completes if possible.

Waits until the promise completes if possible.

Pass $unwrap as true to unwrap the result of the promise, either returning the resolved value or throwing the rejected exception.

If the promise cannot be waited on, then the promise will be rejected.

Parameters

$unwrap
$defaultResolution

Returns

mixed

Throws

LogicException

if the promise has no wait function or if the promise does not settle after waiting.

Implementation of

GuzzleHttp\Promise\PromiseInterface::wait()
public
# cancel( )

Cancels the promise if possible.

Cancels the promise if possible.

Link

https://github.com/promises-aplus/cancellation-spec/issues/7

Implementation of

GuzzleHttp\Promise\PromiseInterface::cancel()
public string
# getState( )

Get the state of the promise ("pending", "rejected", or "fulfilled").

Get the state of the promise ("pending", "rejected", or "fulfilled").

The three states can be checked against the constants defined on PromiseInterface: PENDING, FULFILLED, and REJECTED.

Returns

string

Implementation of

GuzzleHttp\Promise\PromiseInterface::getState()
Constants inherited from GuzzleHttp\Promise\PromiseInterface
FULFILLED, PENDING, REJECTED
MercadoLibre PHP SDK API documentation generated by ApiGen