-
Notifications
You must be signed in to change notification settings - Fork 39
Adding PSR package #128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding PSR package #128
Changes from 3 commits
af00486
cbc903a
de1c010
307c7fe
58d0ada
7d9f4ec
f217324
310b13f
b45b737
f5b7e91
b1f4ee6
1b29077
b16582b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,9 +7,6 @@ cache: | |
- $HOME/.composer/cache/files | ||
|
||
php: | ||
- 5.4 | ||
- 5.5 | ||
- 5.6 | ||
- 7.0 | ||
- 7.1 | ||
- 7.2 | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,6 @@ | |
* | ||
* @author Márk Sági-Kazár <[email protected]> | ||
*/ | ||
interface Exception | ||
interface Exception extends \Throwable | ||
{ | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,30 +37,19 @@ public function __construct( | |
$this->code = $response->getStatusCode(); | ||
} | ||
|
||
/** | ||
* Returns the response. | ||
* | ||
* @return ResponseInterface | ||
*/ | ||
public function getResponse() | ||
public function getResponse(): ResponseInterface | ||
{ | ||
return $this->response; | ||
} | ||
|
||
/** | ||
* 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, | ||
ResponseInterface $response, | ||
\Exception $previous = null | ||
) { | ||
): self { | ||
|
||
$message = sprintf( | ||
'[url] %s [http method] %s [status code] %s [reason phrase] %s', | ||
$request->getRequestTarget(), | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,11 +17,9 @@ 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). | ||
*/ | ||
public function sendAsyncRequest(RequestInterface $request); | ||
public function sendAsyncRequest(RequestInterface $request): Promise; | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
|
||
namespace Http\Client; | ||
|
||
use Http\HttplugBundle\Tests\Unit\Collector\ClientInterface; | ||
use Psr\Http\Message\RequestInterface; | ||
use Psr\Http\Message\ResponseInterface; | ||
|
||
|
@@ -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; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a BC break: https://3v4l.org/LOOiv
Is this something we want to avoid in this update to make it as smooth as possible?