Skip to content

Commit 599e7d4

Browse files
authored
Support common client 2.x (#293)
* Show that we support 2.0 of plugins * Use version bridge * Use Traits * better for testning unreleased stuff * Test with phpunit 6.5 * Bugfix * Make it easier for Composer to solve SAT
1 parent a8e2caf commit 599e7d4

File tree

6 files changed

+35
-36
lines changed

6 files changed

+35
-36
lines changed

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ cache:
1010
env:
1111
global:
1212
- TEST_COMMAND="composer test"
13-
- SYMFONY_PHPUNIT_VERSION="6.3"
13+
- SYMFONY_PHPUNIT_VERSION="6.5"
1414
- SYMFONY_PHPUNIT_DIR="$HOME/symfony-bridge/.phpunit"
1515

1616
branches:

Collector/ProfileClient.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Http\HttplugBundle\Collector;
44

55
use Http\Client\Common\FlexibleHttpClient;
6+
use Http\Client\Common\VersionBridgeClient;
67
use Http\Client\Exception\HttpException;
78
use Http\Client\HttpAsyncClient;
89
use Http\Client\HttpClient;
@@ -21,6 +22,8 @@
2122
*/
2223
class ProfileClient implements HttpClient, HttpAsyncClient
2324
{
25+
use VersionBridgeClient;
26+
2427
/**
2528
* @var HttpClient|HttpAsyncClient
2629
*/
@@ -114,10 +117,7 @@ public function sendAsyncRequest(RequestInterface $request)
114117
}
115118
}
116119

117-
/**
118-
* {@inheritdoc}
119-
*/
120-
public function sendRequest(RequestInterface $request)
120+
protected function doSendRequest(RequestInterface $request)
121121
{
122122
$stack = $this->collector->getActiveStack();
123123
if (null === $stack) {

Collector/ProfilePlugin.php

+3-4
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
*/
1818
class ProfilePlugin implements Plugin
1919
{
20+
use Plugin\VersionBridgePlugin;
21+
2022
/**
2123
* @var Plugin
2224
*/
@@ -44,10 +46,7 @@ public function __construct(Plugin $plugin, Collector $collector, Formatter $for
4446
$this->formatter = $formatter;
4547
}
4648

47-
/**
48-
* {@inheritdoc}
49-
*/
50-
public function handleRequest(RequestInterface $request, callable $next, callable $first)
49+
protected function doHandleRequest(RequestInterface $request, callable $next, callable $first)
5150
{
5251
$profile = new Profile(get_class($this->plugin));
5352

Collector/StackPlugin.php

+3-4
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
*/
1818
class StackPlugin implements Plugin
1919
{
20+
use Plugin\VersionBridgePlugin;
21+
2022
/**
2123
* @var Collector
2224
*/
@@ -44,10 +46,7 @@ public function __construct(Collector $collector, Formatter $formatter, $client)
4446
$this->client = $client;
4547
}
4648

47-
/**
48-
* {@inheritdoc}
49-
*/
50-
public function handleRequest(RequestInterface $request, callable $next, callable $first)
49+
protected function doHandleRequest(RequestInterface $request, callable $next, callable $first)
5150
{
5251
$stack = new Stack($this->client, $this->formatter->formatRequest($request));
5352

Tests/Functional/ProfilingTest.php

+3-4
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,9 @@ private function createClient(array $plugins, $clientName = 'Acme', array $clien
122122

123123
class ExceptionThrowerPlugin implements Plugin
124124
{
125-
/**
126-
* {@inheritdoc}
127-
*/
128-
public function handleRequest(RequestInterface $request, callable $next, callable $first)
125+
use Plugin\VersionBridgePlugin;
126+
127+
protected function doHandleRequest(RequestInterface $request, callable $next, callable $first)
129128
{
130129
throw new \Exception();
131130
}

composer.json

+21-19
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,22 @@
1717
],
1818
"require": {
1919
"php": "^5.5 || ^7.0",
20-
"php-http/client-common": "^1.6 || ^2.0",
20+
"php-http/client-common": "^1.9 || ^2.0",
2121
"php-http/client-implementation": "^1.0",
22-
"php-http/cache-plugin": "^1.4",
22+
"php-http/cache-plugin": "^1.6",
2323
"php-http/discovery": "^1.0",
2424
"php-http/httplug": "^1.0 || ^2.0",
25-
"php-http/logger-plugin": "^1.0",
25+
"php-http/logger-plugin": "^1.1",
2626
"php-http/message": "^1.4",
2727
"php-http/message-factory": "^1.0.2",
28-
"php-http/stopwatch-plugin": "^1.0",
28+
"php-http/stopwatch-plugin": "^1.2",
2929
"psr/http-message": "^1.0",
30-
"symfony/config": "^2.8 || ^3.0 || ^4.0",
31-
"symfony/dependency-injection": "^2.8.3 || ^3.0.3 || ^4.0",
32-
"symfony/event-dispatcher": "^2.8 || ^3.0 || ^4.0",
33-
"symfony/http-kernel": "^2.8 || ^3.0 || ^4.0",
34-
"symfony/options-resolver": "^2.8 || ^3.0 || ^4.0",
35-
"twig/twig": "^1.18 || ^2.0"
30+
"symfony/config": "^2.8.49 || ^3.0.9 || ^3.1.10 || ^3.2.14 || ^3.3.18 || ^3.4.20 || ^4.0.15 || ^4.1.9 || ^4.2.1",
31+
"symfony/dependency-injection": "^2.8.49 || ^3.0.9 || ^3.1.10 || ^3.2.14 || ^3.3.18 || ^3.4.20 || ^4.0.15 || ^4.1.9 || ^4.2.1",
32+
"symfony/event-dispatcher": "^2.8.49 || ^3.0.9 || ^3.1.10 || ^3.2.14 || ^3.3.18 || ^3.4.20 || ^4.0.15 || ^4.1.9 || ^4.2.1",
33+
"symfony/http-kernel": "^2.8.49 || ^3.0.9 || ^3.1.10 || ^3.2.14 || ^3.3.18 || ^3.4.20 || ^4.0.15 || ^4.1.9 || ^4.2.1",
34+
"symfony/options-resolver": "^2.8.49 || ^3.0.9 || ^3.1.10 || ^3.2.14 || ^3.3.18 || ^3.4.20 || ^4.0.15 || ^4.1.9 || ^4.2.1",
35+
"twig/twig": "^1.36 || ^2.6"
3636
},
3737
"require-dev": {
3838
"guzzlehttp/psr7": "^1.0",
@@ -46,15 +46,15 @@
4646
"php-http/react-adapter": "^0.2.1",
4747
"php-http/socket-client": "^1.0",
4848
"polishsymfonycommunity/symfony-mocker-container": "^1.0",
49-
"symfony/browser-kit": "^2.8 || ^3.0 || ^4.0",
50-
"symfony/cache": "^3.1 || ^4.0",
51-
"symfony/dom-crawler": "^2.8 || ^3.0 || ^4.0",
49+
"symfony/browser-kit": "^2.8.49 || ^3.0.9 || ^3.1.10 || ^3.2.14 || ^3.3.18 || ^3.4.20 || ^4.0.15 || ^4.1.9 || ^4.2.1",
50+
"symfony/cache": "^3.1.10 || ^3.2.14 || ^3.3.18 || ^3.4.20 || ^4.0.15 || ^4.1.9 || ^4.2.1",
51+
"symfony/dom-crawler": "^2.8.49 || ^3.0.9 || ^3.1.10 || ^3.2.14 || ^3.3.18 || ^3.4.20 || ^4.0.15 || ^4.1.9 || ^4.2.1",
5252
"symfony/framework-bundle": "^2.8.1 || ^3.0.1 || ^4.0",
53-
"symfony/http-foundation": "^2.8 || ^3.0 || ^4.0",
54-
"symfony/phpunit-bridge": "^3.3 || ^4.0",
55-
"symfony/stopwatch": "^2.8 || ^3.0 || ^4.0",
56-
"symfony/twig-bundle": "^2.8 || ^3.0 || ^4.0",
57-
"symfony/web-profiler-bundle": "^2.8 || ^3.0 || ^4.0"
53+
"symfony/http-foundation": "^2.8.49 || ^3.0.9 || ^3.1.10 || ^3.2.14 || ^3.3.18 || ^3.4.20 || ^4.0.15 || ^4.1.9 || ^4.2.1",
54+
"symfony/phpunit-bridge": "^3.4 || ^4.2",
55+
"symfony/stopwatch": "^2.8.49 || ^3.0.9 || ^3.1.10 || ^3.2.14 || ^3.3.18 || ^3.4.20 || ^4.0.15 || ^4.1.9 || ^4.2.1",
56+
"symfony/twig-bundle": "^2.8.49 || ^3.0.9 || ^3.1.10 || ^3.2.14 || ^3.3.18 || ^3.4.20 || ^4.0.15 || ^4.1.9 || ^4.2.1",
57+
"symfony/web-profiler-bundle": "^2.8.49 || ^3.0.9 || ^3.1.10 || ^3.2.14 || ^3.3.18 || ^3.4.20 || ^4.0.15 || ^4.1.9 || ^4.2.1"
5858
},
5959
"conflict": {
6060
"php-http/guzzle6-adapter": "<1.1"
@@ -83,5 +83,7 @@
8383
"branch-alias": {
8484
"dev-master": "1.x-dev"
8585
}
86-
}
86+
},
87+
"prefer-stable": true,
88+
"minimum-stability": "dev"
8789
}

0 commit comments

Comments
 (0)