Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"require-dev": {
"guzzlehttp/promises": "^1.5.0 || ^2.0.0",
"phpunit/phpunit": "^10.3",
"react/promise": "^2.8.0",
"react/promise": "^2.8 || ^3.0",
"webonyx/graphql-php": "^15.0"
},
"suggest": {
Expand Down
18 changes: 7 additions & 11 deletions lib/promise-adapter/src/Adapter/ReactPromiseAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,18 @@
namespace Overblog\PromiseAdapter\Adapter;

use Overblog\PromiseAdapter\PromiseAdapterInterface;
use React\Promise\CancellablePromiseInterface;
use React\Promise\Deferred;
use React\Promise\FulfilledPromise;
use React\Promise\Promise;
use React\Promise\PromiseInterface;
use React\Promise\RejectedPromise;

/**
* @implements PromiseAdapterInterface<Promise>
* @implements PromiseAdapterInterface<PromiseInterface>
*/
class ReactPromiseAdapter implements PromiseAdapterInterface
{
/**
* {@inheritdoc}
*
* @return Promise
* @return PromiseInterface
*/
public function create(&$resolve = null, &$reject = null, ?callable $canceller = null)
{
Expand All @@ -42,7 +38,7 @@ public function create(&$resolve = null, &$reject = null, ?callable $canceller =
/**
* {@inheritdoc}
*
* @return FulfilledPromise a full filed Promise
* @return PromiseInterface a fulfilled promise
*/
public function createFulfilled($promiseOrValue = null)
{
Expand All @@ -52,7 +48,7 @@ public function createFulfilled($promiseOrValue = null)
/**
* {@inheritdoc}
*
* @return RejectedPromise a rejected promise
* @return PromiseInterface a rejected promise
*/
public function createRejected($reason)
{
Expand All @@ -62,7 +58,7 @@ public function createRejected($reason)
/**
* {@inheritdoc}
*
* @return Promise
* @return PromiseInterface
*/
public function createAll($promisesOrValues)
{
Expand Down Expand Up @@ -118,11 +114,11 @@ public function await($promise = null, $unwrap = false)
/**
* Cancel a promise
*
* @param CancellablePromiseInterface $promise
* @param PromiseInterface $promise
*/
public function cancel($promise)
{
if (!$promise instanceof CancellablePromiseInterface) {
if (!$promise instanceof PromiseInterface || !is_callable([$promise, 'cancel'])) {
throw new \InvalidArgumentException(sprintf('The "%s" method must be called with a compatible Promise.', __METHOD__));
}
$promise->cancel();
Expand Down
Loading