joomla-framework / http

Joomla Framework Http Package
GNU General Public License v2.0
17 stars 21 forks source link

Make the Http class and custom exceptions implement PSR-18 #37

Closed mbabker closed 6 years ago

mbabker commented 6 years ago

Summary of Changes

Since the PSR-18 vote has basically passed, this makes the Http class implement Psr\Http\Client\ClientInterface and our custom exceptions implement Psr\Http\Client\ClientExceptionInterface. The basic change needed was making the sendRequest method typehint the return type, and since this is only added on the 2.0 branch there's no B/C issue with that.

Note that for now this does NOT make the full package PSR-18 compliant; most of our exceptions are still core PHP exceptions and we need to add more exception subclasses for the other error types implementing Psr\Http\Client\ClientExceptionInterface for full minimal compliance (we really should be implementing Psr\Http\Client\NetworkExceptionInterface and Psr\Http\Client\RequestExceptionInterface in our exceptions but those require a Psr\Http\Message\RequestInterface object and our transports are not prepared to receive a PSR-7 Request object right now).

The other "significant" change in this PR is just changing the exception about an invalid param for the URI to use the FQCN instead of the shortened UriInterface.

wilsonge commented 6 years ago

Docs please

wilsonge commented 6 years ago

Nice one!