Promise Changelog

2018

2.7.0 (2018-06-13) Release on GitHub

  • Feature: Improve memory consumption for pending promises by using static internal callbacks without binding to self.
    (#124 by @clue)

2.6.0 (2018-06-11) Release on GitHub

  • Feature: Significantly improve memory consumption and performance by only passing resolver args
    to resolver and canceller if callback requires them. Also use static callbacks without
    binding to promise, clean up canceller function reference when they are no longer
    needed and hide resolver and canceller references from call stack on PHP 7+.
    (#113, #115, #116, #117, #118, #119 and #123 by @clue)

    These changes combined mean that rejecting promises with an Exception should
    no longer cause any internal circular references which could cause some unexpected
    memory growth in previous versions. By explicitly avoiding and explicitly
    cleaning up said references, we can avoid relying on PHP's circular garbage collector
    to kick in which significantly improves performance when rejecting many promises.

  • Mark legacy progress support / notification API as deprecated
    (#112 by @clue)

  • Recommend rejecting promises by throwing an exception
    (#114 by @jsor)

  • Improve documentation to properly instantiate LazyPromise
    (#121 by @holtkamp)

  • Follower cancellation propagation was originally planned for this release
    but has been reverted for now and is planned for a future release.
    (#99 by @jsor and #122 by @clue)


2017

2.5.1 (2017-03-25) Release on GitHub

  • Fix circular references when resolving with a promise which follows itself (#94).

2016

2.5.0 (2016-12-22) Release on GitHub

  • Revert automatic cancellation of pending collection promises once the output promise resolves. This was introduced in 42d86b7 (PR #36, released in v2.3.0) and was both unintended and backward incompatible.

    If you need automatic cancellation, you can use something like:

    function allAndCancel(array $promises)
    {
         return \React\Promise\all($promises)
             ->always(function() use ($promises) {
                 foreach ($promises as $promise) {
                     if ($promise instanceof \React\Promise\CancellablePromiseInterface) {
                         $promise->cancel();
                     }
                 }
            });
    }
  • all() and map() functions now preserve the order of the array (#77).

  • Fix circular references when resolving a promise with itself (#71).


2.4.1 (2016-05-03) Release on GitHub

  • Fix some() not cancelling pending promises when too much input promises reject (16ff799).

2.4.0 (2016-03-31) Release on GitHub

  • Support foreign thenables in resolve().
    Any object that provides a then() method is now assimilated to a trusted promise that follows the state of this thenable (#52).
  • Fix some() and any() for input arrays containing not enough items (#34).

2.3.0 (2016-03-24) Release on GitHub

  • Allow cancellation of promises returned by functions working on promise collections (#36).
  • Handle \Throwable in the same way as \Exception (#51 by @joshdifabio).

1.2.1 (2016-03-07) Release on GitHub

  • Fix DeferredPromise to also implement the CancellablePromiseInterface.

1.2.0 (2016-02-27) Release on GitHub

This release makes the API more compatible with 2.0 while preserving full backward compatibility.

  • Introduce new CancellablePromiseInterface implemented by all promises.
  • Add new .cancel() method (part of the CancellablePromiseInterface).

2.2.2 (2016-02-26) Release on GitHub

  • Fix cancellation handlers called multiple times (#47 by @clue).

2015

2.2.1 (2015-07-03) Release on GitHub

  • Fix stack error when resolving a promise in its own fulfillment or rejection handlers.

1.1.0 (2015-07-01) Release on GitHub

This release makes the API more compatible with 2.0 while preserving full backward compatibility.

  • Add React\Promise\Promise class.
  • Move methods of React\Promise\When and React\Promise\Util to functions while keeping the classes as a proxy for BC.

2014

2.2.0 (2014-12-30) Release on GitHub

This release introduces the ExtendedPromiseInterface.

The ExtendedPromiseInterface extends the PromiseInterface with useful shortcut
and utility methods which are not part of the Promises/A specification.


2.1.0 (2014-10-15) Release on GitHub

Introduce new CancellablePromiseInterface implemented by all promises.


2013

2.0.0 (2013-12-10) Release on GitHub

New major release. The goal was to streamline the API and to make it more compliant with other promise libraries and especially with the new upcoming ES6 promises specification.

  • Add standalone Promise class.
  • Add new React\Promise\race() function.
  • BC break: Bump minimum PHP version to PHP 5.4.
  • BC break: Remove ResolverInterface and PromiseInterface from Deferred.
  • BC break: Change signature of PromiseInterface.
  • BC break: Remove When and Util classes and move static methods to functions.
  • BC break: FulfilledPromise and RejectedPromise now throw an exception when initialized with a promise instead of a value/reason.
  • BC break: React\Promise\Deferred::resolve() and React\Promise\Deferred::reject() no longer return a promise.

1.0.4 (2013-04-03) Release on GitHub

  • Trigger PHP errors when invalid callback is passed.
  • Fully resolve rejection value before calling rejection handler.
  • Add When::lazy() to create lazy promises which will be initialized once a consumer calls the then() method.

2012

1.0.3 (2012-11-17) Release on GitHub

  • Add PromisorInterface for objects that have a promise() method.

1.0.2 (2012-11-14) Release on GitHub

  • Fix bug in When::any() not correctly unwrapping to a single result value
  • $promiseOrValue argument of When::resolve() and When::reject() is now optional

1.0.1 (2012-11-13) Release on GitHub

  • Prevent deep recursion which was reaching xdebug.max_nesting_level default of 100

1.0.0 (2012-11-07) Release on GitHub

  • First tagged release