Skip to content

Commit 4773b70

Browse files
committed
Clean up event loop left overs from promise
I somehow missed those while working on #50
1 parent 99bd0fa commit 4773b70

File tree

3 files changed

+4
-13
lines changed

3 files changed

+4
-13
lines changed

src/Client.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ public function sendAsyncRequest(RequestInterface $request)
6969
$request->getHeaders(),
7070
$request->getBody()
7171
),
72-
$this->loop,
7372
$request
7473
);
7574

src/Promise.php

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,19 +58,11 @@ final class Promise implements HttpPromise
5858
*/
5959
private $promise;
6060

61-
/**
62-
* ReactPHP LoopInterface.
63-
*
64-
* @var LoopInterface
65-
*/
66-
private $loop;
67-
68-
public function __construct(PromiseInterface $promise, LoopInterface $loop, RequestInterface $request)
61+
public function __construct(PromiseInterface $promise, RequestInterface $request)
6962
{
7063
$this->state = self::PENDING;
7164

7265
$this->request = $request;
73-
$this->loop = $loop;
7466
$this->promise = $promise->then(
7567
function (?ResponseInterface $response): ?ResponseInterface {
7668
$this->response = $response;
@@ -101,7 +93,7 @@ function ($reason): void {
10193

10294
public function then(?callable $onFulfilled = null, ?callable $onRejected = null)
10395
{
104-
return new self($this->promise->then($onFulfilled, $onRejected), $this->loop, $this->request);
96+
return new self($this->promise->then($onFulfilled, $onRejected), $this->request);
10597
}
10698

10799
/**

tests/PromiseTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function testChain()
3535
$resolve($response);
3636
});
3737

38-
$promise = new Promise($reactPromise, $this->loop, $request);
38+
$promise = new Promise($reactPromise, $request);
3939

4040
$lastPromise = $promise->then(function (ResponseInterface $response) use ($factory) {
4141
return $factory->createResponse(300, $response->getReasonPhrase());
@@ -60,7 +60,7 @@ public function testPromiseExceptionsAreTranslatedToHttplug(
6060
$reject($reason);
6161
});
6262

63-
$promise = new Promise($reactPromise, $this->loop, $request);
63+
$promise = new Promise($reactPromise, $request);
6464
$this->expectException($adapterExceptionClass);
6565
$promise->wait();
6666
}

0 commit comments

Comments
 (0)