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/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)