Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependency react/promise to v3 #80

Merged
merged 1 commit into from
Nov 3, 2023

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented Nov 1, 2023

Mend Renovate

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
react/promise ^2.10 -> ^2.10 || ^3.0 age adoption passing confidence

Release Notes

reactphp/promise (react/promise)

v3.0.0

Compare Source

A major new feature release, see release announcement.

  • We'd like to emphasize that this component is production ready and battle-tested.
    We plan to support all long-term support (LTS) releases for at least 24 months,
    so you have a rock-solid foundation to build on top of.

  • The v3 release will be the way forward for this package. However, we will still
    actively support v2 and v1 to provide a smooth upgrade path for those not yet
    on the latest versions.

This update involves some major new features and a minor BC break over the
v2.0.0 release. We've tried hard to avoid BC breaks where possible and
minimize impact otherwise. We expect that most consumers of this package will be
affected by BC breaks, but updating should take no longer than a few minutes.
See below for more details:

  • BC break: PHP 8.1+ recommended, PHP 7.1+ required.
    (#​138 and #​149 by @​WyriHaximus)

  • Feature / BC break: The PromiseInterface now includes the functionality of the old ExtendedPromiseInterface and CancellablePromiseInterface.
    Each promise now always includes the then(), catch(), finally() and cancel() methods.
    The new catch() and finally() methods replace the deprecated otherwise() and always() methods which continue to exist for BC reasons.
    The old ExtendedPromiseInterface and CancellablePromiseInterface are no longer needed and have been removed as a consequence.
    (#​75 by @​jsor and #​208 by @​clue and @​WyriHaximus)

    // old (multiple interfaces may or may not be implemented)
    assert($promise instanceof PromiseInterface);
    assert(method_exists($promise, 'then'));
    if ($promise instanceof ExtendedPromiseInterface) { assert(method_exists($promise, 'otherwise')); }
    if ($promise instanceof ExtendedPromiseInterface) { assert(method_exists($promise, 'always')); }
    if ($promise instanceof CancellablePromiseInterface) { assert(method_exists($promise, 'cancel')); }
    
    // new (single PromiseInterface with all methods)
    assert($promise instanceof PromiseInterface);
    assert(method_exists($promise, 'then'));
    assert(method_exists($promise, 'catch'));
    assert(method_exists($promise, 'finally'));
    assert(method_exists($promise, 'cancel'));
  • Feature / BC break: Improve type safety of promises. Require mixed fulfillment value argument and Throwable (or Exception) as rejection reason.
    Add PHPStan template types to ensure strict types for resolve(T $value): PromiseInterface<T> and reject(Throwable $reason): PromiseInterface<never>.
    It is no longer possible to resolve a promise without a value (use null instead) or reject a promise without a reason (use Throwable instead).
    (#​93, #​141 and #​142 by @​jsor, #​138, #​149 and #​247 by @​WyriHaximus and #​213 and #​246 by @​clue)

    // old (arguments used to be optional)
    $promise = resolve();
    $promise = reject();
    
    // new (already supported before)
    $promise = resolve(null);
    $promise = reject(new RuntimeException());
  • Feature / BC break: Report all unhandled rejections by default and remove done() method.
    Add new set_rejection_handler() function to set the global rejection handler for unhandled promise rejections.
    (#​248, #​249 and #​224 by @​clue)

    // Unhandled promise rejection with RuntimeException: Unhandled in example.php:2
    reject(new RuntimeException('Unhandled'));
  • BC break: Remove all deprecated APIs and reduce API surface.
    Remove some(), map(), reduce() functions, use any() and all() functions instead.
    Remove internal FulfilledPromise and RejectedPromise classes, use resolve() and reject() functions instead.
    Remove legacy promise progress API (deprecated third argument to then() method) and deprecated LazyPromise class.
    (#​32 and #​98 by @​jsor and #​164, #​219 and #​220 by @​clue)

  • BC break: Make all classes final to encourage composition over inheritance.
    (#​80 by @​jsor)

  • Feature / BC break: Require array (or iterable) type for all() + race() + any() functions and bring in line with ES6 specification.
    These functions now require a single argument with a variable number of promises or values as input.
    (#​225 by @​clue and #​35 by @​jsor)

  • Fix / BC break: Fix race() to return a forever pending promise when called with an empty array (or iterable) and bring in line with ES6 specification.
    (#​83 by @​jsor and #​225 by @​clue)

  • Minor performance improvements by initializing Deferred in the constructor and avoiding call_user_func() calls.
    (#​151 by @​WyriHaximus and #​171 by @​Kubo2)

  • Minor documentation improvements.
    (#​110 by @​seregazhuk, #​132 by @​CharlotteDunois, #​145 by @​danielecr, #​178 by @​WyriHaximus, #​189 by @​srdante, #​212 by @​clue, #​214, #​239 and #​243 by @​SimonFrings and #​231 by @​nhedger)

The following changes had to be ported to this release due to our branching
strategy, but also appeared in the 2.x branch:

The following changes were originally planned for this release but later reverted
and are not part of the final release:


Configuration

📅 Schedule: Branch creation - "* 6-22/3 * * 1-5,* 12-23/3 * * 0,6" in timezone Europe/Amsterdam, Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR has been generated by Mend Renovate. View repository job log here.

@renovate renovate bot requested a review from WyriHaximus as a code owner November 1, 2023 14:11
@renovate renovate bot added Dependencies 📦 Pull requests that update a dependency file PHP 🐘 Hypertext Pre Processor labels Nov 1, 2023
@github-actions github-actions bot added this to the 3.1.0 milestone Nov 1, 2023
@renovate renovate bot force-pushed the renovate/react-promise-3.x branch 2 times, most recently from f4b8390 to 96c9883 Compare November 2, 2023 11:36
Copy link

github-actions bot commented Nov 2, 2023

🏰 Composer Production Dependency changes 🏰

Prod Packages Operation Base Target Link
react/promise Upgraded v2.10.0 v3.0.0 Compare

@WyriHaximus WyriHaximus merged commit 4dbeb48 into master Nov 3, 2023
@WyriHaximus WyriHaximus deleted the renovate/react-promise-3.x branch November 3, 2023 06:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Dependencies 📦 Pull requests that update a dependency file JSON 👨‍💼 PHP 🐘 Hypertext Pre Processor Source 🔮 Tests 🧪
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant