From 979966ef7e5bd0376c0f83ca1d24959330848982 Mon Sep 17 00:00:00 2001 From: Tobias Nyholm Date: Fri, 28 Dec 2018 10:39:35 +0100 Subject: [PATCH 1/7] Show that we support 2.0 of plugins --- composer.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index fc7748d0..e6397eba 100644 --- a/composer.json +++ b/composer.json @@ -19,13 +19,13 @@ "php": "^5.5 || ^7.0", "php-http/client-common": "^1.6 || ^2.0", "php-http/client-implementation": "^1.0", - "php-http/cache-plugin": "^1.4", + "php-http/cache-plugin": "^1.4 || ^2.0", "php-http/discovery": "^1.0", "php-http/httplug": "^1.0 || ^2.0", - "php-http/logger-plugin": "^1.0", + "php-http/logger-plugin": "^1.0 || ^2.0", "php-http/message": "^1.4", "php-http/message-factory": "^1.0.2", - "php-http/stopwatch-plugin": "^1.0", + "php-http/stopwatch-plugin": "^1.0 || ^2.0", "psr/http-message": "^1.0", "symfony/config": "^2.8 || ^3.0 || ^4.0", "symfony/dependency-injection": "^2.8.3 || ^3.0.3 || ^4.0", From a59f19abce9bf66fbe06c174368cb7360d1b8fe6 Mon Sep 17 00:00:00 2001 From: Tobias Nyholm Date: Fri, 28 Dec 2018 11:44:39 +0100 Subject: [PATCH 2/7] Use version bridge --- Collector/ProfileClient.php | 8 +++----- Collector/ProfilePlugin.php | 7 ++----- Collector/StackPlugin.php | 7 ++----- Tests/Functional/ProfilingTest.php | 7 ++----- composer.json | 8 ++++---- 5 files changed, 13 insertions(+), 24 deletions(-) diff --git a/Collector/ProfileClient.php b/Collector/ProfileClient.php index 6b414dbc..941b29e4 100644 --- a/Collector/ProfileClient.php +++ b/Collector/ProfileClient.php @@ -3,6 +3,7 @@ namespace Http\HttplugBundle\Collector; use Http\Client\Common\FlexibleHttpClient; +use Http\Client\Common\VersionBridgeClient; use Http\Client\Exception\HttpException; use Http\Client\HttpAsyncClient; use Http\Client\HttpClient; @@ -19,7 +20,7 @@ * * @internal */ -class ProfileClient implements HttpClient, HttpAsyncClient +class ProfileClient extends VersionBridgeClient implements HttpAsyncClient { /** * @var HttpClient|HttpAsyncClient @@ -114,10 +115,7 @@ public function sendAsyncRequest(RequestInterface $request) } } - /** - * {@inheritdoc} - */ - public function sendRequest(RequestInterface $request) + protected function doSendRequest(RequestInterface $request) { $stack = $this->collector->getActiveStack(); if (null === $stack) { diff --git a/Collector/ProfilePlugin.php b/Collector/ProfilePlugin.php index c18ac3ec..f8054934 100644 --- a/Collector/ProfilePlugin.php +++ b/Collector/ProfilePlugin.php @@ -15,7 +15,7 @@ * * @internal */ -class ProfilePlugin implements Plugin +class ProfilePlugin extends Plugin\VersionBridgePlugin { /** * @var Plugin @@ -44,10 +44,7 @@ public function __construct(Plugin $plugin, Collector $collector, Formatter $for $this->formatter = $formatter; } - /** - * {@inheritdoc} - */ - public function handleRequest(RequestInterface $request, callable $next, callable $first) + protected function doHandleRequest(RequestInterface $request, callable $next, callable $first) { $profile = new Profile(get_class($this->plugin)); diff --git a/Collector/StackPlugin.php b/Collector/StackPlugin.php index 5e2da321..65c16b43 100644 --- a/Collector/StackPlugin.php +++ b/Collector/StackPlugin.php @@ -15,7 +15,7 @@ * * @internal */ -class StackPlugin implements Plugin +class StackPlugin extends Plugin\VersionBridgePlugin { /** * @var Collector @@ -44,10 +44,7 @@ public function __construct(Collector $collector, Formatter $formatter, $client) $this->client = $client; } - /** - * {@inheritdoc} - */ - public function handleRequest(RequestInterface $request, callable $next, callable $first) + protected function doHandleRequest(RequestInterface $request, callable $next, callable $first) { $stack = new Stack($this->client, $this->formatter->formatRequest($request)); diff --git a/Tests/Functional/ProfilingTest.php b/Tests/Functional/ProfilingTest.php index 60f9d40b..28365d68 100644 --- a/Tests/Functional/ProfilingTest.php +++ b/Tests/Functional/ProfilingTest.php @@ -120,12 +120,9 @@ private function createClient(array $plugins, $clientName = 'Acme', array $clien } } -class ExceptionThrowerPlugin implements Plugin +class ExceptionThrowerPlugin extends Plugin\VersionBridgePlugin { - /** - * {@inheritdoc} - */ - public function handleRequest(RequestInterface $request, callable $next, callable $first) + protected function doHandleRequest(RequestInterface $request, callable $next, callable $first) { throw new \Exception(); } diff --git a/composer.json b/composer.json index e6397eba..f4d69324 100644 --- a/composer.json +++ b/composer.json @@ -17,15 +17,15 @@ ], "require": { "php": "^5.5 || ^7.0", - "php-http/client-common": "^1.6 || ^2.0", + "php-http/client-common": "^1.9 || ^2.0", "php-http/client-implementation": "^1.0", - "php-http/cache-plugin": "^1.4 || ^2.0", + "php-http/cache-plugin": "^1.6", "php-http/discovery": "^1.0", "php-http/httplug": "^1.0 || ^2.0", - "php-http/logger-plugin": "^1.0 || ^2.0", + "php-http/logger-plugin": "^1.1", "php-http/message": "^1.4", "php-http/message-factory": "^1.0.2", - "php-http/stopwatch-plugin": "^1.0 || ^2.0", + "php-http/stopwatch-plugin": "^1.2", "psr/http-message": "^1.0", "symfony/config": "^2.8 || ^3.0 || ^4.0", "symfony/dependency-injection": "^2.8.3 || ^3.0.3 || ^4.0", From 83e7a9df8a7c63fd5584dd202870a03b97da5427 Mon Sep 17 00:00:00 2001 From: Nyholm Date: Sat, 29 Dec 2018 08:50:48 +0100 Subject: [PATCH 3/7] Use Traits --- Collector/ProfileClient.php | 4 +++- Collector/ProfilePlugin.php | 4 +++- Collector/StackPlugin.php | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Collector/ProfileClient.php b/Collector/ProfileClient.php index 941b29e4..b79f2e63 100644 --- a/Collector/ProfileClient.php +++ b/Collector/ProfileClient.php @@ -20,8 +20,10 @@ * * @internal */ -class ProfileClient extends VersionBridgeClient implements HttpAsyncClient +class ProfileClient implements HttpClient, HttpAsyncClient { + use VersionBridgeClient; + /** * @var HttpClient|HttpAsyncClient */ diff --git a/Collector/ProfilePlugin.php b/Collector/ProfilePlugin.php index f8054934..b83da5f1 100644 --- a/Collector/ProfilePlugin.php +++ b/Collector/ProfilePlugin.php @@ -15,8 +15,10 @@ * * @internal */ -class ProfilePlugin extends Plugin\VersionBridgePlugin +class ProfilePlugin implements Plugin { + use Plugin\VersionBridgePlugin; + /** * @var Plugin */ diff --git a/Collector/StackPlugin.php b/Collector/StackPlugin.php index 65c16b43..0bb527d5 100644 --- a/Collector/StackPlugin.php +++ b/Collector/StackPlugin.php @@ -15,8 +15,10 @@ * * @internal */ -class StackPlugin extends Plugin\VersionBridgePlugin +class StackPlugin implements Plugin { + use Plugin\VersionBridgePlugin; + /** * @var Collector */ From 728ddb17844bfd02cef05e23a6d930848e10e117 Mon Sep 17 00:00:00 2001 From: Nyholm Date: Sat, 29 Dec 2018 12:06:14 +0100 Subject: [PATCH 4/7] better for testning unreleased stuff --- composer.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index f4d69324..146f0440 100644 --- a/composer.json +++ b/composer.json @@ -83,5 +83,7 @@ "branch-alias": { "dev-master": "1.x-dev" } - } + }, + "prefer-stable": true, + "minimum-stability": "dev" } From 14984e0e43bfca6823f0166dade28dd71e7877a2 Mon Sep 17 00:00:00 2001 From: Nyholm Date: Sat, 29 Dec 2018 15:38:53 +0100 Subject: [PATCH 5/7] Test with phpunit 6.5 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 07e21c9a..7ebc80af 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,7 +10,7 @@ cache: env: global: - TEST_COMMAND="composer test" - - SYMFONY_PHPUNIT_VERSION="6.3" + - SYMFONY_PHPUNIT_VERSION="6.5" - SYMFONY_PHPUNIT_DIR="$HOME/symfony-bridge/.phpunit" branches: From 587cba9a050e4284f4d381c5e9cf53e3a8bc9ea4 Mon Sep 17 00:00:00 2001 From: Nyholm Date: Sat, 29 Dec 2018 15:45:43 +0100 Subject: [PATCH 6/7] Bugfix --- Tests/Functional/ProfilingTest.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Tests/Functional/ProfilingTest.php b/Tests/Functional/ProfilingTest.php index 28365d68..be126957 100644 --- a/Tests/Functional/ProfilingTest.php +++ b/Tests/Functional/ProfilingTest.php @@ -120,8 +120,10 @@ private function createClient(array $plugins, $clientName = 'Acme', array $clien } } -class ExceptionThrowerPlugin extends Plugin\VersionBridgePlugin +class ExceptionThrowerPlugin implements Plugin { + use Plugin\VersionBridgePlugin; + protected function doHandleRequest(RequestInterface $request, callable $next, callable $first) { throw new \Exception(); From 35210ed217365cd37cf5907e5ee72a5bc2964b81 Mon Sep 17 00:00:00 2001 From: Nyholm Date: Sat, 29 Dec 2018 15:52:38 +0100 Subject: [PATCH 7/7] Make it easier for Composer to solve SAT --- composer.json | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/composer.json b/composer.json index 146f0440..23a028a8 100644 --- a/composer.json +++ b/composer.json @@ -27,12 +27,12 @@ "php-http/message-factory": "^1.0.2", "php-http/stopwatch-plugin": "^1.2", "psr/http-message": "^1.0", - "symfony/config": "^2.8 || ^3.0 || ^4.0", - "symfony/dependency-injection": "^2.8.3 || ^3.0.3 || ^4.0", - "symfony/event-dispatcher": "^2.8 || ^3.0 || ^4.0", - "symfony/http-kernel": "^2.8 || ^3.0 || ^4.0", - "symfony/options-resolver": "^2.8 || ^3.0 || ^4.0", - "twig/twig": "^1.18 || ^2.0" + "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", + "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", + "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", + "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", + "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", + "twig/twig": "^1.36 || ^2.6" }, "require-dev": { "guzzlehttp/psr7": "^1.0", @@ -46,15 +46,15 @@ "php-http/react-adapter": "^0.2.1", "php-http/socket-client": "^1.0", "polishsymfonycommunity/symfony-mocker-container": "^1.0", - "symfony/browser-kit": "^2.8 || ^3.0 || ^4.0", - "symfony/cache": "^3.1 || ^4.0", - "symfony/dom-crawler": "^2.8 || ^3.0 || ^4.0", + "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", + "symfony/cache": "^3.1.10 || ^3.2.14 || ^3.3.18 || ^3.4.20 || ^4.0.15 || ^4.1.9 || ^4.2.1", + "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", "symfony/framework-bundle": "^2.8.1 || ^3.0.1 || ^4.0", - "symfony/http-foundation": "^2.8 || ^3.0 || ^4.0", - "symfony/phpunit-bridge": "^3.3 || ^4.0", - "symfony/stopwatch": "^2.8 || ^3.0 || ^4.0", - "symfony/twig-bundle": "^2.8 || ^3.0 || ^4.0", - "symfony/web-profiler-bundle": "^2.8 || ^3.0 || ^4.0" + "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", + "symfony/phpunit-bridge": "^3.4 || ^4.2", + "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", + "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", + "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" }, "conflict": { "php-http/guzzle6-adapter": "<1.1"