Skip to content

Commit 4ab8722

Browse files
committed
add generics
1 parent 1edce55 commit 4ab8722

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/Executor/Promise/Promise.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22

33
namespace GraphQL\Executor\Promise;
44

5-
use Amp\Promise as AmpPromise;
65
use GraphQL\Error\InvariantViolation;
76
use GraphQL\Executor\Promise\Adapter\SyncPromise;
87
use React\Promise\PromiseInterface as ReactPromise;
8+
use Throwable;
99

1010
/**
1111
* Convenience wrapper for promises represented by Promise Adapter.
12+
* @template T
1213
*/
1314
class Promise
1415
{
@@ -30,6 +31,11 @@ public function __construct($adoptedPromise, PromiseAdapter $adapter)
3031
$this->adapter = $adapter;
3132
}
3233

34+
/**
35+
* @param Closure(T):mixed $onfulfilled
36+
* @param Closure(Throwable):mixed $onRejected
37+
* @return Promise<T>
38+
*/
3339
public function then(?callable $onFulfilled = null, ?callable $onRejected = null): Promise
3440
{
3541
return $this->adapter->then($this, $onFulfilled, $onRejected);

0 commit comments

Comments
 (0)