promise icon indicating copy to clipboard operation
promise copied to clipboard

ExtendedPromiseInterface: type-hint for then()

Open Thomas-Gelf opened this issue 3 years ago • 1 comments

This solves the problem that a PHP IDE always believes your then() method returns a PromiseInterface and not an ExtendedPromiseInterface

Thomas-Gelf avatar Nov 19 '21 20:11 Thomas-Gelf

@Thomas-Gelf thanks for looking into this :+1:

It's not 100% guaranteed that this will always return a ExtendedPromiseInterface. I discussed this with @clue and maybe there should be something like @return PromiseInterface || ExtendedPromiseInterface inside the docblock of the then() method inside PromiseInterface. This should lead to the same results as your addition.

What do you think about this?

SimonFrings avatar Feb 07 '22 10:02 SimonFrings