diff -Nru php-http-httplug-2.0.0/CHANGELOG.md php-http-httplug-2.1.0/CHANGELOG.md --- php-http-httplug-2.0.0/CHANGELOG.md 2018-10-31 09:14:44.000000000 +0000 +++ php-http-httplug-2.1.0/CHANGELOG.md 2019-12-27 10:07:11.000000000 +0000 @@ -9,6 +9,12 @@ ## [Unreleased] +## [2.1.0] - 2019-12-27 + +### Changed + +- `Http\Client\Exception\NetworkException` no longer extends `Http\Client\Exception\RequestException`, + in accordance with [PSR-18](https://www.php-fig.org/psr/psr-18/) ## [2.0.0] - 2018-10-31 diff -Nru php-http-httplug-2.0.0/composer.json php-http-httplug-2.1.0/composer.json --- php-http-httplug-2.0.0/composer.json 2018-10-31 09:14:44.000000000 +0000 +++ php-http-httplug-2.1.0/composer.json 2019-12-27 10:07:11.000000000 +0000 @@ -21,8 +21,8 @@ "php-http/promise": "^1.0" }, "require-dev": { - "phpspec/phpspec": "^2.4", - "henrikbjorn/phpspec-code-coverage" : "^1.0" + "phpspec/phpspec": "^4.3.4|^5.0|^6.0", + "friends-of-phpspec/phpspec-code-coverage" : "^4.1" }, "autoload": { "psr-4": { @@ -35,7 +35,7 @@ }, "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "2.x-dev" } } } diff -Nru php-http-httplug-2.0.0/debian/changelog php-http-httplug-2.1.0/debian/changelog --- php-http-httplug-2.0.0/debian/changelog 2019-12-26 22:27:13.000000000 +0000 +++ php-http-httplug-2.1.0/debian/changelog 2020-01-01 21:47:49.000000000 +0000 @@ -1,3 +1,13 @@ +php-http-httplug (2.1.0-1) unstable; urgency=medium + + [ David Buchmann ] + * prepare release + + [ David Grayston ] + * PSR-18: Network / Request exception inheritance (#158) + + -- David Prévot Thu, 02 Jan 2020 08:47:49 +1100 + php-http-httplug (2.0.0-2) unstable; urgency=medium * Set upstream metadata fields: diff -Nru php-http-httplug-2.0.0/README.md php-http-httplug-2.1.0/README.md --- php-http-httplug-2.0.0/README.md 2018-10-31 09:14:44.000000000 +0000 +++ php-http-httplug-2.1.0/README.md 2019-12-27 10:07:11.000000000 +0000 @@ -15,15 +15,26 @@ ## Intro -HTTPlug is the predecessor of [PSR-18](http://www.php-fig.org/psr/psr-18/) -HTTP Client standard built on [PSR-7](http://www.php-fig.org/psr/psr-7/) HTTP messages. -Since there is an entire ecosystem built around HTTPlug which is already widely adopted, -we will keep maintaining this package for the time being, -but new implementations and consumers should use the PSR-18 interfaces. -HTTPlug 2.x extends the PSR-18 interfaces to allow a convenient migration path. -In the long term, we expect PSR-18 to completely replace the need for HTTPlug. +HTTP client standard built on [PSR-7](http://www.php-fig.org/psr/psr-7/) HTTP +messages. The HTTPlug client interface is compatible with the official standard +for the HTTP client interface, [PSR-18](http://www.php-fig.org/psr/psr-18/). +HTTPlug adds an interface for asynchronous HTTP requests, which PSR-18 does not +cover. -This library is the official successor of the [ivory http adapter](https://github.com/egeloen/ivory-http-adapter). +Since HTTPlug has already been widely adopted and a whole ecosystem has been +built around it, we will keep maintaining this package for the time being. +HTTPlug 2.0 and newer extend the PSR-18 interface to allow for a convenient +migration path. + +New client implementations and consumers should use the PSR-18 interfaces +directly. In the long term, we expect PSR-18 to completely replace the need +for HTTPlug. + + +## History + +HTTPlug is the official successor of the [ivory http adapter](https://github.com/egeloen/ivory-http-adapter). +HTTPlug is a predecessor of [PSR-18](http://www.php-fig.org/psr/psr-18/) ## Install diff -Nru php-http-httplug-2.0.0/src/Exception/HttpException.php php-http-httplug-2.1.0/src/Exception/HttpException.php --- php-http-httplug-2.0.0/src/Exception/HttpException.php 2018-10-31 09:14:44.000000000 +0000 +++ php-http-httplug-2.1.0/src/Exception/HttpException.php 2019-12-27 10:07:11.000000000 +0000 @@ -63,6 +63,6 @@ $response->getReasonPhrase() ); - return new self($message, $request, $response, $previous); + return new static($message, $request, $response, $previous); } } diff -Nru php-http-httplug-2.0.0/src/Exception/NetworkException.php php-http-httplug-2.1.0/src/Exception/NetworkException.php --- php-http-httplug-2.0.0/src/Exception/NetworkException.php 2018-10-31 09:14:44.000000000 +0000 +++ php-http-httplug-2.1.0/src/Exception/NetworkException.php 2019-12-27 10:07:11.000000000 +0000 @@ -2,6 +2,7 @@ namespace Http\Client\Exception; +use Psr\Http\Message\RequestInterface; use Psr\Http\Client\NetworkExceptionInterface as PsrNetworkException; /** @@ -11,6 +12,19 @@ * * @author Márk Sági-Kazár */ -class NetworkException extends RequestException implements PsrNetworkException +class NetworkException extends TransferException implements PsrNetworkException { + use RequestAwareTrait; + + /** + * @param string $message + * @param RequestInterface $request + * @param \Exception|null $previous + */ + public function __construct($message, RequestInterface $request, \Exception $previous = null) + { + $this->setRequest($request); + + parent::__construct($message, 0, $previous); + } } diff -Nru php-http-httplug-2.0.0/src/Exception/RequestAwareTrait.php php-http-httplug-2.1.0/src/Exception/RequestAwareTrait.php --- php-http-httplug-2.0.0/src/Exception/RequestAwareTrait.php 1970-01-01 00:00:00.000000000 +0000 +++ php-http-httplug-2.1.0/src/Exception/RequestAwareTrait.php 2019-12-27 10:07:11.000000000 +0000 @@ -0,0 +1,26 @@ +request = $request; + } + + /** + * {@inheritdoc} + */ + public function getRequest(): RequestInterface + { + return $this->request; + } +} diff -Nru php-http-httplug-2.0.0/src/Exception/RequestException.php php-http-httplug-2.1.0/src/Exception/RequestException.php --- php-http-httplug-2.0.0/src/Exception/RequestException.php 2018-10-31 09:14:44.000000000 +0000 +++ php-http-httplug-2.1.0/src/Exception/RequestException.php 2019-12-27 10:07:11.000000000 +0000 @@ -15,10 +15,7 @@ */ class RequestException extends TransferException implements PsrRequestException { - /** - * @var RequestInterface - */ - private $request; + use RequestAwareTrait; /** * @param string $message @@ -27,13 +24,8 @@ */ public function __construct($message, RequestInterface $request, \Exception $previous = null) { - $this->request = $request; + $this->setRequest($request); parent::__construct($message, 0, $previous); } - - public function getRequest(): RequestInterface - { - return $this->request; - } } diff -Nru php-http-httplug-2.0.0/src/HttpClient.php php-http-httplug-2.1.0/src/HttpClient.php --- php-http-httplug-2.0.0/src/HttpClient.php 2018-10-31 09:14:44.000000000 +0000 +++ php-http-httplug-2.1.0/src/HttpClient.php 2019-12-27 10:07:11.000000000 +0000 @@ -3,23 +3,13 @@ namespace Http\Client; use Psr\Http\Client\ClientInterface; -use Psr\Http\Message\RequestInterface; -use Psr\Http\Message\ResponseInterface; /** - * Sends a PSR-7 Request and returns a PSR-7 response. + * {@inheritdoc} * - * @author GeLo - * @author Márk Sági-Kazár - * @author David Buchmann + * Provide the Httplug HttpClient interface for BC. + * You should typehint Psr\Http\Client\ClientInterface in new code */ interface HttpClient extends ClientInterface { - /** - * Sends a PSR-7 request. - * - * @throws \Http\Client\Exception If an error happens during processing the request. - * @throws \Exception If processing the request is impossible (eg. bad configuration). - */ - public function sendRequest(RequestInterface $request): ResponseInterface; }