Update PHPStan and fix type annotations#267
Conversation
clue
left a comment
There was a problem hiding this comment.
@PaulRotmann Thanks for looking into this, updating PHPStan sounds good. I've added some remarks below.
| /** | ||
| * @param callable(): (void|PromiseInterface<void>) $onFulfilledOrRejected | ||
| * @return PromiseInterface<T> | ||
| */ |
There was a problem hiding this comment.
Tested this locally and this doesn't appear to be needed, as its types would be inherited directly from the PromiseInterface:
| /** | |
| * @param callable(): (void|PromiseInterface<void>) $onFulfilledOrRejected | |
| * @return PromiseInterface<T> | |
| */ |
May I ask you do confirm?
| /** | ||
| * @param callable(): (void|PromiseInterface<void>) $onFulfilledOrRejected | ||
| * @return PromiseInterface<T> | ||
| */ |
There was a problem hiding this comment.
Tested this locally and this doesn't appear to be needed, as its types would be inherited directly from the PromiseInterface:
| /** | |
| * @param callable(): (void|PromiseInterface<void>) $onFulfilledOrRejected | |
| * @return PromiseInterface<T> | |
| */ |
May I ask you do confirm?
| public function finally(callable $onFulfilledOrRejected): PromiseInterface | ||
| { | ||
| return $this->then(function ($value) use ($onFulfilledOrRejected): PromiseInterface { | ||
| /** @var T $value */ |
There was a problem hiding this comment.
nit: Mixed whitespace, should use spaces only
| /** @var T $value */ | |
| /** @var T $value */ |
| public function finally(callable $onFulfilledOrRejected): PromiseInterface | ||
| { | ||
| return $this->then(static function ($value) use ($onFulfilledOrRejected): PromiseInterface { | ||
| /** @var T $value */ |
There was a problem hiding this comment.
nit: Mixed whitespace, should use spaces only
| /** @var T $value */ | |
| /** @var T $value */ |
| }, | ||
| "require-dev": { | ||
| "phpstan/phpstan": "1.10.39 || 1.4.10", | ||
| "phpstan/phpstan": "1.12.19 || 1.4.10", |
There was a problem hiding this comment.
@PaulRotmann This is quite old, are you sure we don't want to go to 1.12.28 at least?
The updated PHPStan version provides improved type checking capabilities. The added type annotations resolve static analysis warnings and improve code documentation, making the generic type flow more explicit in the finally() method implementations.
Builds on top of #251.
This PR breaks down #266 into smaller parts.