Skip to content

Commit c3889f7

Browse files
committed
Fix cs make promise final
1 parent 554fc0e commit c3889f7

File tree

3 files changed

+6
-8
lines changed

3 files changed

+6
-8
lines changed

src/Client.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
use Psr\Http\Message\ResponseInterface;
1515
use Psr\Http\Message\StreamInterface;
1616
use React\EventLoop\LoopInterface;
17-
use React\Promise\Deferred;
1817
use React\HttpClient\Client as ReactClient;
1918
use React\HttpClient\Request as ReactRequest;
2019
use React\HttpClient\Response as ReactResponse;

src/Promise.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
*
1515
* @internal
1616
*/
17-
class Promise implements HttpPromise
17+
final class Promise implements HttpPromise
1818
{
1919
/**
2020
* Promise status.
@@ -69,7 +69,7 @@ public function __construct(LoopInterface $loop)
6969
*/
7070
public function then(callable $onFulfilled = null, callable $onRejected = null)
7171
{
72-
$newPromise = new Promise($this->loop);
72+
$newPromise = new self($this->loop);
7373

7474
$onFulfilled = $onFulfilled !== null ? $onFulfilled : function (ResponseInterface $response) {
7575
return $response;
@@ -79,15 +79,15 @@ public function then(callable $onFulfilled = null, callable $onRejected = null)
7979
throw $exception;
8080
};
8181

82-
$this->onFulfilled = function(ResponseInterface $response) use ($onFulfilled, $newPromise) {
82+
$this->onFulfilled = function (ResponseInterface $response) use ($onFulfilled, $newPromise) {
8383
try {
8484
$newPromise->resolve($onFulfilled($response));
8585
} catch (Exception $exception) {
8686
$newPromise->reject($exception);
8787
}
8888
};
8989

90-
$this->onRejected = function(Exception $exception) use ($onRejected, $newPromise) {
90+
$this->onRejected = function (Exception $exception) use ($onRejected, $newPromise) {
9191
try {
9292
$newPromise->resolve($onRejected($exception));
9393
} catch (Exception $exception) {
@@ -99,7 +99,7 @@ public function then(callable $onFulfilled = null, callable $onRejected = null)
9999
}
100100

101101
/**
102-
* Resolve this promise
102+
* Resolve this promise.
103103
*
104104
* @param ResponseInterface $response
105105
*
@@ -121,7 +121,7 @@ public function resolve(ResponseInterface $response)
121121
}
122122

123123
/**
124-
* Reject this promise
124+
* Reject this promise.
125125
*
126126
* @param Exception $exception
127127
*

tests/PromiseTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
use Http\Adapter\React\Promise;
77
use Http\Adapter\React\ReactFactory;
88
use PHPUnit\Framework\TestCase;
9-
use React\Promise\Deferred;
109

1110
class PromiseTest extends TestCase
1211
{

0 commit comments

Comments
 (0)