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