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