1CHANGELOG for 2.x 2================= 3 4* 2.7.1 (2018-01-07) 5 6 * Fix: file_exists warning when resolving with long strings. 7 (#130 by @sbesselsen) 8 * Improve performance by prefixing all global functions calls with \ to skip the look up and resolve process and go straight to the global function. 9 (#133 by @WyriHaximus) 10 11* 2.7.0 (2018-06-13) 12 13 * Feature: Improve memory consumption for pending promises by using static internal callbacks without binding to self. 14 (#124 by @clue) 15 16* 2.6.0 (2018-06-11) 17 18 * Feature: Significantly improve memory consumption and performance by only passing resolver args 19 to resolver and canceller if callback requires them. Also use static callbacks without 20 binding to promise, clean up canceller function reference when they are no longer 21 needed and hide resolver and canceller references from call stack on PHP 7+. 22 (#113, #115, #116, #117, #118, #119 and #123 by @clue) 23 24 These changes combined mean that rejecting promises with an `Exception` should 25 no longer cause any internal circular references which could cause some unexpected 26 memory growth in previous versions. By explicitly avoiding and explicitly 27 cleaning up said references, we can avoid relying on PHP's circular garbage collector 28 to kick in which significantly improves performance when rejecting many promises. 29 30 * Mark legacy progress support / notification API as deprecated 31 (#112 by @clue) 32 33 * Recommend rejecting promises by throwing an exception 34 (#114 by @jsor) 35 36 * Improve documentation to properly instantiate LazyPromise 37 (#121 by @holtkamp) 38 39 * Follower cancellation propagation was originally planned for this release 40 but has been reverted for now and is planned for a future release. 41 (#99 by @jsor and #122 by @clue) 42 43* 2.5.1 (2017-03-25) 44 45 * Fix circular references when resolving with a promise which follows 46 itself (#94). 47 48* 2.5.0 (2016-12-22) 49 50 * Revert automatic cancellation of pending collection promises once the 51 output promise resolves. This was introduced in 42d86b7 (PR #36, released 52 in [v2.3.0](https://github.com/reactphp/promise/releases/tag/v2.3.0)) and 53 was both unintended and backward incompatible. 54 55 If you need automatic cancellation, you can use something like: 56 57 ```php 58 function allAndCancel(array $promises) 59 { 60 return \React\Promise\all($promises) 61 ->always(function() use ($promises) { 62 foreach ($promises as $promise) { 63 if ($promise instanceof \React\Promise\CancellablePromiseInterface) { 64 $promise->cancel(); 65 } 66 } 67 }); 68 } 69 ``` 70 * `all()` and `map()` functions now preserve the order of the array (#77). 71 * Fix circular references when resolving a promise with itself (#71). 72 73* 2.4.1 (2016-05-03) 74 75 * Fix `some()` not cancelling pending promises when too much input promises 76 reject (16ff799). 77 78* 2.4.0 (2016-03-31) 79 80 * Support foreign thenables in `resolve()`. 81 Any object that provides a `then()` method is now assimilated to a trusted 82 promise that follows the state of this thenable (#52). 83 * Fix `some()` and `any()` for input arrays containing not enough items 84 (#34). 85 86* 2.3.0 (2016-03-24) 87 88 * Allow cancellation of promises returned by functions working on promise 89 collections (#36). 90 * Handle `\Throwable` in the same way as `\Exception` (#51 by @joshdifabio). 91 92* 2.2.2 (2016-02-26) 93 94 * Fix cancellation handlers called multiple times (#47 by @clue). 95 96* 2.2.1 (2015-07-03) 97 98 * Fix stack error when resolving a promise in its own fulfillment or 99 rejection handlers. 100 101* 2.2.0 (2014-12-30) 102 103 * Introduce new `ExtendedPromiseInterface` implemented by all promises. 104 * Add new `done()` method (part of the `ExtendedPromiseInterface`). 105 * Add new `otherwise()` method (part of the `ExtendedPromiseInterface`). 106 * Add new `always()` method (part of the `ExtendedPromiseInterface`). 107 * Add new `progress()` method (part of the `ExtendedPromiseInterface`). 108 * Rename `Deferred::progress` to `Deferred::notify` to avoid confusion with 109 `ExtendedPromiseInterface::progress` (a `Deferred::progress` alias is 110 still available for backward compatibility) 111 * `resolve()` now always returns a `ExtendedPromiseInterface`. 112 113* 2.1.0 (2014-10-15) 114 115 * Introduce new `CancellablePromiseInterface` implemented by all promises. 116 * Add new `cancel()` method (part of the `CancellablePromiseInterface`). 117 118* 2.0.0 (2013-12-10) 119 120 New major release. The goal is to streamline the API and to make it more 121 compliant with other promise libraries and especially with the new upcoming 122 [ES6 promises specification](https://github.com/domenic/promises-unwrapping/). 123 124 * Add standalone Promise class. 125 * Add new `race()` function. 126 * BC break: Bump minimum PHP version to PHP 5.4. 127 * BC break: Remove `ResolverInterface` and `PromiseInterface` from 128 `Deferred`. 129 * BC break: Change signature of `PromiseInterface`. 130 * BC break: Remove `When` and `Util` classes and move static methods to 131 functions. 132 * BC break: `FulfilledPromise` and `RejectedPromise` now throw an exception 133 when initialized with a promise instead of a value/reason. 134 * BC break: `Deferred::resolve()` and `Deferred::reject()` no longer return 135 a promise. 136