diff --git a/.php_cs b/.php_cs deleted file mode 100644 index 23ba165..0000000 --- a/.php_cs +++ /dev/null @@ -1,13 +0,0 @@ -exclude('vendor') + ->in(__DIR__) +; + +return PhpCsFixer\Config::create() + ->setRules([ + '@Symfony' => true, + 'array_syntax' => ['syntax' => 'short'], + ]) + ->setFinder($finder); diff --git a/phpstan.neon.dist b/phpstan.neon.dist new file mode 100644 index 0000000..776ccd8 --- /dev/null +++ b/phpstan.neon.dist @@ -0,0 +1,4 @@ +parameters: + level: max + paths: + - src diff --git a/src/Client.php b/src/Client.php index 34570c5..35ded8c 100644 --- a/src/Client.php +++ b/src/Client.php @@ -2,8 +2,8 @@ namespace Http\Adapter\React; -use Http\Client\HttpClient; use Http\Client\HttpAsyncClient; +use Http\Client\HttpClient; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; use React\EventLoop\LoopInterface; diff --git a/src/Promise.php b/src/Promise.php index f522d65..ec7d852 100644 --- a/src/Promise.php +++ b/src/Promise.php @@ -30,14 +30,14 @@ final class Promise implements HttpPromise /** * PSR7 received response. * - * @var ResponseInterface + * @var ResponseInterface|null */ private $response; /** * Execution error. * - * @var Exception + * @var HttplugException */ private $exception; @@ -69,7 +69,7 @@ public function __construct(PromiseInterface $promise, LoopInterface $loop, Requ $this->request = $request; $this->loop = $loop; $this->promise = $promise->then( - function (?ResponseInterface $response): ResponseInterface { + function (?ResponseInterface $response): ?ResponseInterface { $this->response = $response; $this->state = self::FULFILLED; @@ -92,7 +92,8 @@ function ($reason): void { } throw $this->exception; - }); + } + ); } public function then(?callable $onFulfilled = null, ?callable $onRejected = null) diff --git a/src/ReactFactory.php b/src/ReactFactory.php index 08085c0..62dbe94 100644 --- a/src/ReactFactory.php +++ b/src/ReactFactory.php @@ -2,8 +2,8 @@ namespace Http\Adapter\React; -use React\EventLoop\LoopInterface; use React\EventLoop\Factory as EventLoopFactory; +use React\EventLoop\LoopInterface; use React\Http\Browser; use React\Socket\ConnectorInterface; @@ -25,8 +25,8 @@ public static function buildEventLoop(): LoopInterface /** * Build a React Http Client. * - * @param ConnectorInterface|null $connector Only pass this argument if you need to customize DNS - * behaviour. + * @param ConnectorInterface|null $connector only pass this argument if you need to customize DNS + * behaviour */ public static function buildHttpClient( LoopInterface $loop, diff --git a/tests/AsyncClientTest.php b/tests/AsyncClientTest.php index bcf9540..7ab4d63 100644 --- a/tests/AsyncClientTest.php +++ b/tests/AsyncClientTest.php @@ -2,9 +2,9 @@ namespace Http\Adapter\React\Tests; -use Http\Client\Tests\HttpAsyncClientTest; use Http\Adapter\React\Client; use Http\Client\HttpAsyncClient; +use Http\Client\Tests\HttpAsyncClientTest; /** * @author Stéphane Hulard diff --git a/tests/ClientTest.php b/tests/ClientTest.php index 57c6614..e2ef2ac 100644 --- a/tests/ClientTest.php +++ b/tests/ClientTest.php @@ -2,8 +2,8 @@ namespace Http\Adapter\React\Tests; -use Http\Client\Tests\HttpClientTest; use Http\Adapter\React\Client; +use Http\Client\Tests\HttpClientTest; use Psr\Http\Client\ClientInterface; /**