Skip to content

Instantly share code, notes, and snippets.

@jsor
Created January 12, 2016 14:09
Show Gist options
  • Save jsor/6d48508d074e632752dd to your computer and use it in GitHub Desktop.
Save jsor/6d48508d074e632752dd to your computer and use it in GitHub Desktop.
<?php
function resolve($promiseOrValue = null)
{
if ($promiseOrValue instanceof ReactPromiseInterface) {
return $promiseOrValue;
}
// Create a React\Promise from a foreign promise
if ($promiseOrValue instanceof FigPromiseInterface) {
return new Promise(function ($resolve, $reject, $notify) use ($promiseOrValue) {
$promiseOrValue->then($resolve, $reject, $notify);
});
}
return new FulfilledPromise($promiseOrValue);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment