You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

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