Skip to content
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ cache:
- $HOME/.composer/cache/files

php:
- 5.4
- 5.5
- 5.6
- 7.0
- 7.1
- 7.2
Expand All @@ -25,14 +22,11 @@ branches:
matrix:
fast_finish: true
include:
- php: 5.4
- php: 7.0
env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest" COVERAGE=true TEST_COMMAND="composer test-ci"
- php: hhvm
dist: trusty

before_install:
- if [[ $COVERAGE != true && $TRAVIS_PHP_VERSION != hhvm ]]; then phpenv config-rm xdebug.ini || true; fi
- travis_retry composer self-update
- if [[ $COVERAGE != true ]]; then phpenv config-rm xdebug.ini || true; fi

install:
- travis_retry composer update ${COMPOSER_FLAGS} --prefer-dist --no-interaction
Expand Down
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
# Change Log

## 2.0.0 - UNRELEASED

This version contains is technically a BC break because we drop PHP5 and add return
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dropping PHP5 support is no BC break. it just prevents people on an obsolete stack from updating

how do you mean "technically"? i think we should say: "This version is no BC break for consumers using HTTPlug. However, HTTP clients that implement HTTPlug need to adjust because we add return type declarations."

type annotation to support `psr/http-client`.

### Added

- Support for PSR-18 (Http client).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Http or HTTP? (i don't really care but we should be consistent in our doc and consistent with how fig documents write it)


### Removed

- PHP 5 support

### Changed

- [BC Break] `HttpClient::sendRequest(RequestInterface $request)` has a return type annotation. The mew
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/mew/new/ ;-)

signature is `HttpClient::sendRequest(RequestInterface $request): ResponseInterface`.
- [BC Break] `RequestException::getRequest()` has a return type annotation. The new
signature is `RequestException::getRequest(): RequestInterface`.

## 1.1.0 - 2016-08-31

Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
}
],
"require": {
"php": ">=5.4",
"php": "^7.0",
"psr/http-message": "^1.0",
"psr/http-client": "^0.1",
"php-http/promise": "^1.0"
},
"require-dev": {
Expand Down
4 changes: 3 additions & 1 deletion src/Exception.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@

namespace Http\Client;

use Psr\Http\Client\ClientException as PsrClientException;

/**
* Every HTTP Client related Exception must implement this interface.
*
* @author Márk Sági-Kazár <[email protected]>
*/
interface Exception
interface Exception extends PsrClientException
{
}
6 changes: 0 additions & 6 deletions src/Exception/HttpException.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,6 @@ public function getResponse()

/**
* Factory method to create a new exception with a normalized error message.
*
* @param RequestInterface $request
* @param ResponseInterface $response
* @param \Exception|null $previous
*
* @return HttpException
*/
public static function create(
RequestInterface $request,
Expand Down
4 changes: 3 additions & 1 deletion src/Exception/NetworkException.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@

namespace Http\Client\Exception;

use Psr\Http\Client\Exception\NetworkException as PsrNetworkException;

/**
* Thrown when the request cannot be completed because of network issues.
*
* There is no response object as this exception is thrown when no response has been received.
*
* @author Márk Sági-Kazár <[email protected]>
*/
class NetworkException extends RequestException
class NetworkException extends RequestException implements PsrNetworkException
{
}
10 changes: 3 additions & 7 deletions src/Exception/RequestException.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Http\Client\Exception;

use Psr\Http\Message\RequestInterface;
use Psr\Http\Client\Exception\RequestException as PsrRequestException;

/**
* Exception for when a request failed, providing access to the failed request.
Expand All @@ -12,7 +13,7 @@
*
* @author Márk Sági-Kazár <[email protected]>
*/
class RequestException extends TransferException
class RequestException extends TransferException implements PsrRequestException
{
/**
* @var RequestInterface
Expand All @@ -31,12 +32,7 @@ public function __construct($message, RequestInterface $request, \Exception $pre
parent::__construct($message, 0, $previous);
}

/**
* Returns the request.
*
* @return RequestInterface
*/
public function getRequest()
public function getRequest(): RequestInterface
{
return $this->request;
}
Expand Down
2 changes: 0 additions & 2 deletions src/HttpAsyncClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ interface HttpAsyncClient
*
* Exceptions related to processing the request are available from the returned Promise.
*
* @param RequestInterface $request
*
* @return Promise Resolves a PSR-7 Response or fails with an Http\Client\Exception.
*
* @throws \Exception If processing the request is impossible (eg. bad configuration).
Expand Down
9 changes: 3 additions & 6 deletions src/HttpClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Http\Client;

use Psr\Http\Client\ClientInterface;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;

Expand All @@ -12,17 +13,13 @@
* @author Márk Sági-Kazár <[email protected]>
* @author David Buchmann <[email protected]>
*/
interface HttpClient
interface HttpClient extends ClientInterface
{
/**
* Sends a PSR-7 request.
*
* @param RequestInterface $request
*
* @return ResponseInterface
*
* @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);
public function sendRequest(RequestInterface $request): ResponseInterface;
}