Skip to content

Chained Promises will always resolve

Choose a tag to compare

@g105b g105b released this 21 Jan 13:56
7a4f103

Along with PHP 7.4 - 8.0 interoperability, this update brings bugfix #12.

If any Chainable returns an instance of PromiseInterface, the next Chainable will not be called until the PromiseInterface resolves, at which point the next Chainable will be resolved with the resolved value of the promise, instead of the Promise itself.

This is more consistent with how the Web APIs work. Specifically, using the Fetch API - a Promise is returned for the actual fetch, but also for retrieving the response body. The final callback in the chain doesn't want to be provided with an unresolved promise, instead it only cares about the final resolved value of the promise.