Skip to content

Commit 6c846fb

Browse files
authored
Merge pull request #53 from packagist/t/psr-18
PSR: replace php-http/client-implementation with psr/http-client-implementation
2 parents 42be3bd + 1b14f0e commit 6c846fb

File tree

6 files changed

+11
-14
lines changed

6 files changed

+11
-14
lines changed

.php-cs-fixer.php

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
->setRiskyAllowed(true)
1313
->setRules(array(
1414
'@PSR2' => true,
15+
'no_unused_imports' => true,
1516
))
1617
->setFinder($finder)
1718
;

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,10 @@
121121
Via Composer:
122122

123123
```bash
124-
$ composer require private-packagist/api-client php-http/guzzle6-adapter
124+
$ composer require private-packagist/api-client guzzlehttp/guzzle
125125
```
126126

127-
Why do you need to require `php-http/guzzle6-adapter`? We are decoupled from any HTTP messaging client with help by [HTTPlug](http://httplug.io/), so you can pick an HTTP client of your choice, guzzle is merely a recommendation.
127+
Why do you need to require `guzzlehttp/guzzle`? We are decoupled from any HTTP messaging client with help by [HTTPlug](http://httplug.io/), so you can pick an HTTP client of your choice, guzzle is merely a recommendation.
128128

129129
## Basic usage of `private-packagist/api-client` client
130130

composer.json

+2-4
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,14 @@
1515
"psr/http-message": "^1.0",
1616
"php-http/httplug": "^1.1 || ^2.0",
1717
"php-http/discovery": "^1.0",
18-
"php-http/client-implementation": "^1.0",
18+
"psr/http-client-implementation": "^1.0",
1919
"php-http/client-common": "^1.9 || ^2.0",
2020
"composer-runtime-api": "^2.0"
2121
},
2222
"require-dev": {
2323
"phpunit/phpunit": "^8.0 || ^9.0",
24-
"php-http/guzzle6-adapter": "^1.0 || ^2.0",
24+
"guzzlehttp/guzzle": "^7",
2525
"php-http/mock-client": "^1.0",
26-
"guzzlehttp/psr7": "^1.2",
27-
"cache/array-adapter": "^1.1.0",
2826
"friendsofphp/php-cs-fixer": "^3.0",
2927
"phpstan/phpstan": "^1.2"
3028
},

src/Api/Projects.php

-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99

1010
namespace PrivatePackagist\ApiClient\Api;
1111

12-
use PrivatePackagist\ApiClient\Exception\InvalidArgumentException;
13-
1412
/**
1513
* @deprecated Use the Subrepositories API instead
1614
*/

src/HttpClient/HttpPluginClientBuilder.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@
1212
use Http\Client\Common\HttpMethodsClient;
1313
use Http\Client\Common\Plugin;
1414
use Http\Client\Common\PluginClient;
15-
use Http\Client\HttpClient;
1615
use Http\Discovery\HttpClientDiscovery;
1716
use Http\Discovery\MessageFactoryDiscovery;
1817
use Http\Message\RequestFactory;
18+
use Psr\Http\Client\ClientInterface;
1919

2020
class HttpPluginClientBuilder
2121
{
22-
/** @var HttpClient */
22+
/** @var ClientInterface */
2323
private $httpClient;
2424
/** @var HttpMethodsClient|null */
2525
private $pluginClient;
@@ -28,7 +28,7 @@ class HttpPluginClientBuilder
2828
/** @var Plugin[] */
2929
private $plugins = [];
3030

31-
public function __construct(HttpClient $httpClient = null, RequestFactory $requestFactory = null)
31+
public function __construct(ClientInterface $httpClient = null, RequestFactory $requestFactory = null)
3232
{
3333
$this->httpClient = $httpClient ?: HttpClientDiscovery::find();
3434
$this->requestFactory = $requestFactory ?: MessageFactoryDiscovery::find();

tests/HttpClient/Message/ResponseMediatorTest.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function testGetContent()
2828
$response = new Response(
2929
200,
3030
['Content-Type' => 'application/json'],
31-
\GuzzleHttp\Psr7\stream_for(json_encode($body))
31+
json_encode($body)
3232
);
3333
$this->assertSame($body, $this->responseMediator->getContent($response));
3434
}
@@ -39,7 +39,7 @@ public function testGetContentNotJson()
3939
$response = new Response(
4040
200,
4141
[],
42-
\GuzzleHttp\Psr7\stream_for($body)
42+
$body
4343
);
4444
$this->assertSame($body, $this->responseMediator->getContent($response));
4545
}
@@ -50,7 +50,7 @@ public function testGetContentInvalidJson()
5050
$response = new Response(
5151
200,
5252
['Content-Type' => 'application/json'],
53-
\GuzzleHttp\Psr7\stream_for($body)
53+
$body
5454
);
5555
$this->assertEquals($body, $this->responseMediator->getContent($response));
5656
}

0 commit comments

Comments
 (0)