-
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
Merged
Merged
Adding PSR package #128
Changes from 11 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
af00486
Adding PSR package
Nyholm cbc903a
Added return types and dropped PHP5
Nyholm de1c010
Removed redundant comments
Nyholm 307c7fe
Removed return type
Nyholm 58d0ada
Removed return types
Nyholm 7d9f4ec
Make sure our exception implements the correct interfaces
Nyholm f217324
Make it more clear what interface we are implementing
Nyholm 310b13f
minor
Nyholm b45b737
Use version 0.1
Nyholm f5b7e91
Remove HHVM
Nyholm b1f4ee6
Added change log
Nyholm 1b29077
Small fixes
Nyholm b16582b
Updated branch alias
Nyholm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
type annotation to support `psr/http-client`. | ||
|
||
### Added | ||
|
||
- Support for PSR-18 (Http client). | ||
|
||
|
||
### Removed | ||
|
||
- PHP 5 support | ||
|
||
### Changed | ||
|
||
- [BC Break] `HttpClient::sendRequest(RequestInterface $request)` has a return type annotation. The mew | ||
|
||
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 | ||
|
||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
{ | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
{ | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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. | ||
|
@@ -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 | ||
|
@@ -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; | ||
} | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
|
||
namespace Http\Client; | ||
|
||
use Psr\Http\Client\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; | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
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."