I have some code which uses guzzle 5 and I am trying to upgrade it to guzzle 6. One of the changes in guzzle 6 is that it no longer makes use of the react/promise
library and instead uses its own promise library. My understanding is that the two are not interchangeable.
There is code which uses the the always()
function from react/promise
like so:
$promise->then(
// function
)->otherwise(
// function
)->always(
// function
);
The problem I have is that guzzle promises don't have an always()
function. According to the react/promise
documentation, this function acts as cleanup for a promise chain in a similar way to the finally
block in a try
/catch
/finally
sequence.
How can I emulate this?
Put the code from the always in both then and otherwise