DiscordPHP icon indicating copy to clipboard operation
DiscordPHP copied to clipboard

Promises v3 Checklist

Open valzargaming opened this issue 2 years ago • 4 comments

Per https://github.com/reactphp/promise/releases/tag/v3.0.0

Irrelevant:

  • [x] Existing instances of FulfilledPromise and RejectedPromise classes must be updated to use resolve() and reject() functions instead
  • [x] Existing instances of LazyPromise should be removed
  • [x] Any instances of some(), map(), and reduce() functions must be replaced with the any() or all() functions (I don't think we use these)

Breaking changes:

  • [x] #1150 - Instances of existing code explicitly typecasting ExtendedPromiseInterface should be removed.
  • [x] #1151 - Instances of existing code need to call resolve or reject and handle errors appropriately.
  • [x] #1152 - Instances of existing code need to be replaced with then and resolved.

Non-breaking changes:

  • [x] otherwise() and always() are deprecated, replaced by catch() and finally() (only instance I could find was Discord.php)

valzargaming avatar Jul 13 '23 12:07 valzargaming

All this should be in https://github.com/discord-php/DiscordPHP/tree/promise-v3 now

key2peace avatar Jul 17 '23 14:07 key2peace

ExtendedPromiseInterface extends PromiseInterface, and Promise v2 implements ExtendedPromiseInterface, so instead of replacing the existing typehinting to PromiseInterface we could just use React\Promise\Promise, which would overcome the hurdle and be better for futureproofing code. This seems to be the ReactPHP developers' intent as well, given they have made all classes final to encourage composition.

valzargaming avatar Jul 31 '23 17:07 valzargaming

It's painful to read this @valzargaming :) Code-ify more please.

shehi avatar Jul 31 '23 23:07 shehi

It's painful to read this @valzargaming :) Code-ify more please.

This is already coded in the promises v3 branch as of today.

valzargaming avatar Jul 31 '23 23:07 valzargaming