-
-
Notifications
You must be signed in to change notification settings - Fork 245
Allow new PSR interfaces #282
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
Changes from 13 commits
c071e6b
265e19f
323381c
2b4950d
25621c1
7205485
254ec45
e1e8e9e
0af430e
b0feed6
ca55449
cf8c33e
e70d8fe
93bfd29
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 |
|---|---|---|
|
|
@@ -42,20 +42,21 @@ | |
| "classmap": ["tests/OmnipayTest.php"] | ||
| }, | ||
| "require": { | ||
| "php": "^7.2|^8", | ||
| "php": "^8", | ||
| "php-http/client-implementation": "^1", | ||
| "php-http/message": "^1.5", | ||
| "php-http/message-factory": "^1.1", | ||
| "php-http/discovery": "^1.14", | ||
| "symfony/http-foundation": "^2.1|^3|^4|^5|^6|^7|^8", | ||
| "moneyphp/money": "^3.1|^4.0.3" | ||
| "moneyphp/money": "^3.1|^4.0.3", | ||
| "psr/http-factory": "^1" | ||
| }, | ||
| "require-dev": { | ||
| "omnipay/tests": "^4.1", | ||
| "php-http/mock-client": "^1.6", | ||
| "php-http/guzzle7-adapter": "^1", | ||
| "squizlabs/php_codesniffer": "^3.8.1", | ||
| "http-interop/http-factory-guzzle": "^1.1" | ||
| "http-interop/http-factory-guzzle": "^1.1", | ||
| "php-http/message-factory": "^1.1" | ||
| }, | ||
|
Comment on lines
53
to
60
|
||
| "extra": { | ||
| "branch-alias": { | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,109 @@ | ||||||
| <?php | ||||||
|
|
||||||
| namespace Omnipay\Common\Http; | ||||||
|
|
||||||
| use Http\Discovery\Psr17FactoryDiscovery; | ||||||
| use Http\Discovery\Psr18ClientDiscovery; | ||||||
| use Http\Message\RequestFactory; | ||||||
| use Omnipay\Common\Http\Exception\NetworkException; | ||||||
| use Omnipay\Common\Http\Exception\RequestException; | ||||||
| use Psr\Http\Client\ClientInterface as HttpClientInterface; | ||||||
| use Psr\Http\Client\NetworkExceptionInterface; | ||||||
| use Psr\Http\Message\RequestFactoryInterface; | ||||||
| use Psr\Http\Message\RequestInterface; | ||||||
| use Psr\Http\Message\ResponseInterface; | ||||||
| use Psr\Http\Message\StreamFactoryInterface; | ||||||
| use Psr\Http\Message\StreamInterface; | ||||||
|
|
||||||
| abstract class AbstractClient implements ClientInterface | ||||||
| { | ||||||
| /** @var HttpClientInterface */ | ||||||
| private $httpClient; | ||||||
|
|
||||||
| /** @var RequestFactoryInterface|RequestFactory */ | ||||||
| private $requestFactory; | ||||||
|
|
||||||
| /** @var StreamFactoryInterface|null */ | ||||||
| private $streamFactory; | ||||||
|
|
||||||
| public function __construct( | ||||||
| $httpClient = null, | ||||||
| RequestFactoryInterface|RequestFactory $requestFactory = null, | ||||||
|
||||||
| RequestFactoryInterface|RequestFactory $requestFactory = null, | |
| RequestFactoryInterface|object $requestFactory = null, |
Copilot
AI
Jan 29, 2026
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.
sendRequest()’s docblock says it throws \Http\Client\Exception, but the implementation catches and wraps exceptions into Omnipay’s NetworkException/RequestException (and also depends on PSR-18 NetworkExceptionInterface). Update the docblock to reflect the actual thrown exceptions to avoid misleading implementers.
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -2,71 +2,15 @@ | |||||
|
|
||||||
| namespace Omnipay\Common\Http; | ||||||
|
|
||||||
| use Http\Client\HttpClient; | ||||||
| use Http\Discovery\HttpClientDiscovery; | ||||||
| use Http\Discovery\MessageFactoryDiscovery; | ||||||
| use Http\Message\RequestFactory; | ||||||
| use Omnipay\Common\Http\Exception\NetworkException; | ||||||
| use Omnipay\Common\Http\Exception\RequestException; | ||||||
| use Psr\Http\Message\RequestInterface; | ||||||
| use Psr\Http\Message\ResponseInterface; | ||||||
| use Psr\Http\Message\StreamInterface; | ||||||
|
|
||||||
| class Client implements ClientInterface | ||||||
| /** | ||||||
| * @deprecated use Psr18Client instead | ||||||
|
||||||
| * @deprecated use Psr18Client instead | |
| * @deprecated use PsrClient instead |
Copilot
AI
Jan 29, 2026
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.
Client.php imports and typehints Http\Message\RequestFactory. If php-http/message-factory is no longer a required dependency, this hard reference can trigger fatal errors when loading the class. Either keep the dependency in require or remove/loosen this typehint to avoid a mandatory runtime dependency on the abandoned package.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| <?php | ||
|
|
||
| namespace Omnipay\Common\Http; | ||
|
|
||
| use Psr\Http\Client\ClientInterface as HttpClientInterface; | ||
| use Psr\Http\Message\RequestFactoryInterface; | ||
| use Psr\Http\Message\StreamFactoryInterface; | ||
|
|
||
| class PsrClient extends AbstractClient | ||
| { | ||
| public function __construct( | ||
| ?HttpClientInterface $httpClient = null, | ||
| ?RequestFactoryInterface $requestFactory = null, | ||
| ?StreamFactoryInterface $streamFactory = null | ||
| ) { | ||
| parent::__construct($httpClient, $requestFactory, $streamFactory); | ||
| } | ||
| } |
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.
The PR description suggests this is not a big BC break, but composer.json now requires PHP ^8 (dropping ^7.2|^8). If this is intentional, it should be called out explicitly as a BC break (and aligned with the project’s release/UPGRADE notes). If not intentional, restore the previous PHP constraint.