reactphp / promise

Promises/A implementation for PHP.
https://reactphp.org/promise/
MIT License
2.38k stars 146 forks source link

Add PHPDoc in Promise::then method #136

Closed tifabien closed 5 years ago

tifabien commented 5 years ago

I'm using PHPStan to check my code. When I'm using chaining method calls with Promise->then(...)->otherwise(...), PHPStan is complaining about the fact that otherwise method is undefined in PromiseInterface. I can break my chaining method calls and use the PHPDoc comment but it's not very sexy...

/** @var ExtendedPromiseInterface $promise */
$promise = $this->session->call(...)->then(...);
$promise->otherwise(...);

By adding the PHPDoc it fixes this warning and I can continue to use chaining method calls.

jsor commented 5 years ago

Thanks for your PR. Unfortunately, this would be a BC break, see #139 for a discussion around this.