Add react/promise v2 to v3 transition helper #26
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is helper class for transitioning react/promise v2 to react/promise v3. No, we do not need to make sudden breaking changes to force everyone replace done() and then() because it is difficult to determine whether the promise should be chained or ends there.
With this, users are not forced to go with v3, they can force their composer install to v2, and the polyfill will wraps it directly to the v2 codes.
BC Note: progress/onProgress is not supported (it was deprecated long ago in v2, so the requirement is now atleast v2.8)
However, our internal codes must be changed to the react/promise v3 styles, while using the provided helper class, instead of the react/promise v3 class directly.
Many things that still need to be adjusted such as the ratelimit promise rejection since the react/promise reject() requires the value to be a throwable now (currently, the wrapper will force non exceptions values as resolved).
It has been tested with very simple basic requests.
Log for both promise v2 and promise v3
Real changes will not affect to Bots yet until the DiscordPHP library package is updated to use the provided polyfill class.
If possible, I'd make this separate package and should be only installed for those still doing transition. But I have not find any way yet.
Note: I personally bump this implementation for v11 DiscordPHP, after releasing v10