Skip to content

Commit

Permalink
chore(static): Add PHPStan configuration.
Browse files Browse the repository at this point in the history
Also fix static errors in Promise.
  • Loading branch information
shulard committed Dec 17, 2020
1 parent 16e7abd commit de35d3f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
4 changes: 4 additions & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
parameters:
level: max
paths:
- src
9 changes: 5 additions & 4 deletions src/Promise.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;

Expand All @@ -92,7 +92,8 @@ function ($reason): void {
}

throw $this->exception;
});
}
);
}

public function then(?callable $onFulfilled = null, ?callable $onRejected = null)
Expand Down

0 comments on commit de35d3f

Please sign in to comment.