Skip to content

Commit 0757afa

Browse files
committed
Typehint ClientInterface
1 parent eb24fe0 commit 0757afa

File tree

4 files changed

+14
-12
lines changed

4 files changed

+14
-12
lines changed

src/Common/AbstractGateway.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
namespace Omnipay\Common;
77

88
use Omnipay\Common\Http\Client;
9+
use Omnipay\Common\Http\ClientInterface;
910
use Symfony\Component\HttpFoundation\ParameterBag;
1011
use Symfony\Component\HttpFoundation\Request as HttpRequest;
1112

@@ -49,7 +50,7 @@ abstract class AbstractGateway implements GatewayInterface
4950
protected $parameters;
5051

5152
/**
52-
* @var Client
53+
* @var ClientInterface
5354
*/
5455
protected $httpClient;
5556

@@ -61,10 +62,10 @@ abstract class AbstractGateway implements GatewayInterface
6162
/**
6263
* Create a new gateway instance
6364
*
64-
* @param Client $httpClient A HTTP client to make API calls with
65+
* @param ClientInterface $httpClient A HTTP client to make API calls with
6566
* @param HttpRequest $httpRequest A Symfony HTTP request object
6667
*/
67-
public function __construct(Client $httpClient = null, HttpRequest $httpRequest = null)
68+
public function __construct(ClientInterface $httpClient = null, HttpRequest $httpRequest = null)
6869
{
6970
$this->httpClient = $httpClient ?: $this->getDefaultHttpClient();
7071
$this->httpRequest = $httpRequest ?: $this->getDefaultHttpRequest();
@@ -326,7 +327,7 @@ protected function createRequest($class, array $parameters)
326327
/**
327328
* Get the global default HTTP client.
328329
*
329-
* @return Client
330+
* @return ClientInterface
330331
*/
331332
protected function getDefaultHttpClient()
332333
{

src/Common/GatewayFactory.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
namespace Omnipay\Common;
77

88
use Omnipay\Common\Exception\RuntimeException;
9-
use Omnipay\Common\Http\Client;
9+
use Omnipay\Common\Http\ClientInterface;
1010
use Symfony\Component\HttpFoundation\Request as HttpRequest;
1111

1212
/**
@@ -73,12 +73,12 @@ public function register($className)
7373
* Create a new gateway instance
7474
*
7575
* @param string $class Gateway name
76-
* @param Client|null $httpClient A HTTP Client implementation
76+
* @param ClientInterface|null $httpClient A HTTP Client implementation
7777
* @param HttpRequest|null $httpRequest A Symfony HTTP Request implementation
7878
* @throws RuntimeException If no such gateway is found
7979
* @return GatewayInterface An object of class $class is created and returned
8080
*/
81-
public function create($class, Client $httpClient = null, HttpRequest $httpRequest = null)
81+
public function create($class, ClientInterface $httpClient = null, HttpRequest $httpRequest = null)
8282
{
8383
$class = Helper::getGatewayClassName($class);
8484

src/Common/Message/AbstractRequest.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use Omnipay\Common\Exception\RuntimeException;
1717
use Omnipay\Common\Helper;
1818
use Omnipay\Common\Http\Client;
19+
use Omnipay\Common\Http\ClientInterface;
1920
use Omnipay\Common\ItemBag;
2021
use Symfony\Component\HttpFoundation\ParameterBag;
2122
use Symfony\Component\HttpFoundation\Request as HttpRequest;
@@ -75,7 +76,7 @@ abstract class AbstractRequest implements RequestInterface
7576
/**
7677
* The request client.
7778
*
78-
* @var Client
79+
* @var ClientInterface
7980
*/
8081
protected $httpClient;
8182

@@ -111,10 +112,10 @@ abstract class AbstractRequest implements RequestInterface
111112
/**
112113
* Create a new Request
113114
*
114-
* @param Client $httpClient A HTTP client to make API calls with
115+
* @param ClientInterface $httpClient A HTTP client to make API calls with
115116
* @param HttpRequest $httpRequest A Symfony HTTP request object
116117
*/
117-
public function __construct(Client $httpClient, HttpRequest $httpRequest)
118+
public function __construct(ClientInterface $httpClient, HttpRequest $httpRequest)
118119
{
119120
$this->httpClient = $httpClient;
120121
$this->httpRequest = $httpRequest;

src/Omnipay.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
namespace Omnipay;
77

88
use Omnipay\Common\GatewayFactory;
9-
use Omnipay\Common\Http\Client;
9+
use Omnipay\Common\Http\ClientInterface;
1010

1111
/**
1212
* Omnipay class
@@ -47,7 +47,7 @@
4747
* @method static array find()
4848
* @method static array getSupportedGateways()
4949
* @codingStandardsIgnoreStart
50-
* @method static \Omnipay\Common\GatewayInterface create(string $class, Client $httpClient = null, \Symfony\Component\HttpFoundation\Request $httpRequest = null)
50+
* @method static \Omnipay\Common\GatewayInterface create(string $class, ClientInterface $httpClient = null, \Symfony\Component\HttpFoundation\Request $httpRequest = null)
5151
* @codingStandardsIgnoreEnd
5252
*
5353
* @see Omnipay\Common\GatewayFactory

0 commit comments

Comments
 (0)