Skip to content

Commit 8bf9ff1

Browse files
authored
Expect a PSR-18 client instead of a PHP-HTTP client (#1110)
* Expect a PSR-18 client instead of a PHP-HTTP client * Update integration tests
1 parent c55dea3 commit 8bf9ff1

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

Provider/AbstractHttpProvider.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
use Geocoder\Provider\AbstractProvider;
1919
use Http\Message\MessageFactory;
2020
use Http\Discovery\MessageFactoryDiscovery;
21-
use Http\Client\HttpClient;
21+
use Psr\Http\Client\ClientInterface;
2222
use Psr\Http\Message\RequestInterface;
2323

2424
/**
@@ -28,7 +28,7 @@
2828
abstract class AbstractHttpProvider extends AbstractProvider
2929
{
3030
/**
31-
* @var HttpClient
31+
* @var ClientInterface
3232
*/
3333
private $client;
3434

@@ -38,10 +38,10 @@ abstract class AbstractHttpProvider extends AbstractProvider
3838
private $messageFactory;
3939

4040
/**
41-
* @param HttpClient $client
41+
* @param ClientInterface $client
4242
* @param MessageFactory|null $factory
4343
*/
44-
public function __construct(HttpClient $client, MessageFactory $factory = null)
44+
public function __construct(ClientInterface $client, MessageFactory $factory = null)
4545
{
4646
$this->client = $client;
4747
$this->messageFactory = $factory ?: MessageFactoryDiscovery::find();
@@ -106,9 +106,9 @@ protected function getParsedResponse(RequestInterface $request): string
106106
/**
107107
* Returns the HTTP adapter.
108108
*
109-
* @return HttpClient
109+
* @return ClientInterface
110110
*/
111-
protected function getHttpClient(): HttpClient
111+
protected function getHttpClient(): ClientInterface
112112
{
113113
return $this->client;
114114
}

Tests/Provider/AbstractHttpProviderTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
use Geocoder\Model\AddressCollection;
1818
use Geocoder\Query\GeocodeQuery;
1919
use Geocoder\Query\ReverseQuery;
20-
use Http\Client\HttpClient;
20+
use Psr\Http\Client\ClientInterface;
2121
use Http\Mock\Client;
2222
use PHPUnit\Framework\TestCase;
2323

@@ -33,7 +33,7 @@ public function testHttpClientGetter()
3333

3434
class DummyProvider extends AbstractHttpProvider
3535
{
36-
public function getHttpClient(): HttpClient
36+
public function getHttpClient(): ClientInterface
3737
{
3838
return parent::getHttpClient();
3939
}

0 commit comments

Comments
 (0)