Type hinting incoherence for exceptions
soullivaneuh opened this issue · 4 comments
| Q | A |
|---|---|
| Bug? | no |
| New Feature? | no |
| Version | v1.0.1 |
On the exceptions property:
Lines 42 to 45 in 7b47440
The type hinting corresponds to Http\Client\Exception
But on the adder:
Lines 74 to 82 in 7b47440
It corresponds to \Exception.
AFAIK, it makes no sense. Which one should be choose?
I may add a PR after getting #21 merged.
Using Http\Client\Exception is the correct one since clients MUST NOT throw exceptions that does not implement this interface.
lets change the typehint on the private field, to not lie. but lets also add a comment that according to the spec this must be a http exception. changing the add method would be a bc break, and if people use custom plugins they might deliberately violate the contract, so it seems to me there are use cases for it. want to do a PR @soullivaneuh ?
@dbu In this case, why not trigger a deprecation error if the passed parameter is something else than a Http\Client\Exception instance and move the typing on a next major?
deprecation warning is a good idea, yes.