Created
January 12, 2016 14:09
-
-
Save jsor/6d48508d074e632752dd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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