diff --git a/.travis.yml b/.travis.yml index a03f560..81a8f42 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,5 @@ +dist: trusty + language: php php: diff --git a/composer.json b/composer.json index 88ca24a..a0a16ee 100644 --- a/composer.json +++ b/composer.json @@ -33,7 +33,7 @@ "guzzlehttp/promises": "^1.3.0", "phpunit/phpunit": "^4.1|^5.1", "react/promise": "^2.5.0", - "webonyx/graphql-php": "^0.9.0" + "webonyx/graphql-php": "^0.9.14" }, "suggest": { "guzzlehttp/promises": "To use with Guzzle promise", diff --git a/lib/promise-adapter/src/PromiseAdapterInterface.php b/lib/promise-adapter/src/PromiseAdapterInterface.php index 6517a9e..ea28744 100644 --- a/lib/promise-adapter/src/PromiseAdapterInterface.php +++ b/lib/promise-adapter/src/PromiseAdapterInterface.php @@ -22,60 +22,60 @@ interface PromiseAdapterInterface * * @return mixed a Promise */ - public function create(&$resolve = null, &$reject = null, callable $canceller = null); + public function create(&$resolve = null, &$reject = null, callable $canceller = null); - /** - * Creates a full filed Promise for a value if the value is not a promise. - * - * @param mixed $promiseOrValue - * - * @return mixed a full filed Promise - */ - public function createFulfilled($promiseOrValue = null); + /** + * Creates a full filed Promise for a value if the value is not a promise. + * + * @param mixed $promiseOrValue + * + * @return mixed a full filed Promise + */ + public function createFulfilled($promiseOrValue = null); - /** - * Creates a rejected promise for a reason if the reason is not a promise. If - * the provided reason is a promise, then it is returned as-is. - * - * @param mixed $reason - * - * @return mixed a rejected promise - */ - public function createRejected($reason); + /** + * Creates a rejected promise for a reason if the reason is not a promise. If + * the provided reason is a promise, then it is returned as-is. + * + * @param mixed $reason + * + * @return mixed a rejected promise + */ + public function createRejected($reason); - /** - * Given an array of promises, return a promise that is fulfilled when all the - * items in the array are fulfilled. - * - * @param mixed $promisesOrValues Promises or values. - * - * @return mixed a Promise - */ - public function createAll($promisesOrValues); + /** + * Given an array of promises, return a promise that is fulfilled when all the + * items in the array are fulfilled. + * + * @param mixed $promisesOrValues Promises or values. + * + * @return mixed a Promise + */ + public function createAll($promisesOrValues); - /** - * Check if value is a promise - * - * @param mixed $value - * @param bool $strict - * - * @return bool - */ - public function isPromise($value, $strict = false); + /** + * Check if value is a promise + * + * @param mixed $value + * @param bool $strict + * + * @return bool + */ + public function isPromise($value, $strict = false); - /** - * Cancel a promise - * - * @param $promise - */ - public function cancel($promise); + /** + * Cancel a promise + * + * @param $promise + */ + public function cancel($promise); - /** - * wait for Promise to complete - * @param mixed $promise - * @param bool $unwrap - * - * @return mixed - */ - public function await($promise = null, $unwrap = false); + /** + * wait for Promise to complete + * @param mixed $promise + * @param bool $unwrap + * + * @return mixed + */ + public function await($promise = null, $unwrap = false); } diff --git a/lib/promise-adapter/tests/AdapterTest.php b/lib/promise-adapter/tests/AdapterTest.php index 738d39d..a51e9e1 100644 --- a/lib/promise-adapter/tests/AdapterTest.php +++ b/lib/promise-adapter/tests/AdapterTest.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - namespace Overblog\PromiseAdapter\Tests; use Overblog\PromiseAdapter\Adapter\GuzzleHttpPromiseAdapter; diff --git a/src/Promise/Adapter/Webonyx/GraphQL/SyncPromiseAdapter.php b/src/Promise/Adapter/Webonyx/GraphQL/SyncPromiseAdapter.php index f817ce6..fc2f82a 100644 --- a/src/Promise/Adapter/Webonyx/GraphQL/SyncPromiseAdapter.php +++ b/src/Promise/Adapter/Webonyx/GraphQL/SyncPromiseAdapter.php @@ -11,27 +11,19 @@ namespace Overblog\DataLoader\Promise\Adapter\Webonyx\GraphQL; -use GraphQL\Deferred; -use GraphQL\Executor\Promise\Adapter\SyncPromise; use GraphQL\Executor\Promise\Adapter\SyncPromiseAdapter as BaseSyncPromiseAdapter; use GraphQL\Executor\Promise\Promise; use Overblog\DataLoader\DataLoader; class SyncPromiseAdapter extends BaseSyncPromiseAdapter { - /** - * Synchronously wait when promise completes - * - * @param Promise $promise - * @return mixed - */ - public function wait(Promise $promise) + protected function beforeWait(Promise $promise) { DataLoader::await(); - Deferred::runQueue(); - SyncPromise::runQueue(); - DataLoader::await(); + } - return parent::wait($promise); + protected function onWait(Promise $promise) + { + DataLoader::await(); } }