From 453a167befd98822ff8009c9e6ceddad1a59b2f1 Mon Sep 17 00:00:00 2001 From: Tobias Nyholm Date: Fri, 28 Dec 2018 11:38:55 +0100 Subject: [PATCH 1/6] Support both client-common ^1.9 and 2.x --- .travis.yml | 2 ++ composer.json | 2 +- src/CachePlugin.php | 7 ++----- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index dee74e0..ec146b9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,6 +12,8 @@ php: - 5.6 - 7.0 - 7.1 + - 7.2 + - 7.3 env: global: diff --git a/composer.json b/composer.json index d875cdb..156b95c 100644 --- a/composer.json +++ b/composer.json @@ -13,7 +13,7 @@ "require": { "php": "^5.4 || ^7.0", "psr/cache": "^1.0", - "php-http/client-common": "^1.1", + "php-http/client-common": "^1.9 || ^2.0", "php-http/message-factory": "^1.0", "symfony/options-resolver": "^2.6 || ^3.0 || ^4.0" }, diff --git a/src/CachePlugin.php b/src/CachePlugin.php index 8225b75..b52ffa2 100644 --- a/src/CachePlugin.php +++ b/src/CachePlugin.php @@ -21,7 +21,7 @@ * * @author Tobias Nyholm */ -final class CachePlugin implements Plugin +final class CachePlugin extends VersionBridgePlugin { /** * @var CacheItemPoolInterface @@ -124,10 +124,7 @@ public static function serverCache(CacheItemPoolInterface $pool, StreamFactory $ return new self($pool, $streamFactory, $config); } - /** - * {@inheritdoc} - */ - public function handleRequest(RequestInterface $request, callable $next, callable $first) + protected function doHandleRequest(RequestInterface $request, callable $next, callable $first) { $method = strtoupper($request->getMethod()); // if the request not is cachable, move to $next From 75a3d1ebd1619e7edadaa640cd8f6792d9100689 Mon Sep 17 00:00:00 2001 From: Nyholm Date: Sat, 29 Dec 2018 08:50:48 +0100 Subject: [PATCH 2/6] Use Traits --- src/CachePlugin.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/CachePlugin.php b/src/CachePlugin.php index b52ffa2..5ca9b6d 100644 --- a/src/CachePlugin.php +++ b/src/CachePlugin.php @@ -21,8 +21,10 @@ * * @author Tobias Nyholm */ -final class CachePlugin extends VersionBridgePlugin +final class CachePlugin implements Plugin { + use VersionBridgePlugin; + /** * @var CacheItemPoolInterface */ From 6f56f018f3482e59631361d54a236c1ea70be28f Mon Sep 17 00:00:00 2001 From: Nyholm Date: Sat, 29 Dec 2018 11:58:01 +0100 Subject: [PATCH 3/6] Make sure we test with both 2.0 and 1.9 of client-common --- .travis.yml | 3 +++ composer.json | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index ec146b9..7b313c4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,11 +28,14 @@ matrix: include: - php: 5.4 env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest" COVERAGE=true TEST_COMMAND="composer test-ci" + - php: 7.2 + env: DEPENDENCIES="php-http/client-common:^1.9" - php: hhvm dist: trusty before_install: - if [[ $COVERAGE != true ]]; then phpenv config-rm xdebug.ini || true; fi + - if ! [ -z "$DEPENDENCIES" ]; then composer require --no-update ${DEPENDENCIES}; fi; install: # To be removed when this issue will be resolved: https://github.com/composer/composer/issues/5355 diff --git a/composer.json b/composer.json index 156b95c..355e82a 100644 --- a/composer.json +++ b/composer.json @@ -39,5 +39,7 @@ "branch-alias": { "dev-master": "1.6-dev" } - } + }, + "prefer-stable": true, + "minimum-stability": "dev" } From d4fc5516087dd0520155219e6a12d3b48cc20696 Mon Sep 17 00:00:00 2001 From: Nyholm Date: Sat, 29 Dec 2018 12:39:37 +0100 Subject: [PATCH 4/6] Drop tests on hhvm --- .travis.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7b313c4..8f93e20 100644 --- a/.travis.yml +++ b/.travis.yml @@ -30,8 +30,6 @@ matrix: env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest" COVERAGE=true TEST_COMMAND="composer test-ci" - php: 7.2 env: DEPENDENCIES="php-http/client-common:^1.9" - - php: hhvm - dist: trusty before_install: - if [[ $COVERAGE != true ]]; then phpenv config-rm xdebug.ini || true; fi From c84322ade9af03aeb9d71d6ec83cea6a6e9cff67 Mon Sep 17 00:00:00 2001 From: Nyholm Date: Sat, 29 Dec 2018 14:21:10 +0100 Subject: [PATCH 5/6] No need to have special test for client-common:1.9 That is already tested in prefer-lowest --- .travis.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8f93e20..1082bb0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -29,16 +29,15 @@ matrix: - php: 5.4 env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest" COVERAGE=true TEST_COMMAND="composer test-ci" - php: 7.2 - env: DEPENDENCIES="php-http/client-common:^1.9" + env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest" before_install: - if [[ $COVERAGE != true ]]; then phpenv config-rm xdebug.ini || true; fi - - if ! [ -z "$DEPENDENCIES" ]; then composer require --no-update ${DEPENDENCIES}; fi; install: # To be removed when this issue will be resolved: https://github.com/composer/composer/issues/5355 - if [[ "$COMPOSER_FLAGS" == *"--prefer-lowest"* ]]; then travis_retry composer update --prefer-dist --no-interaction --prefer-stable --quiet; fi - - travis_retry composer update ${COMPOSER_FLAGS} --prefer-dist --no-interaction + - composer update ${COMPOSER_FLAGS} --prefer-dist --no-interaction script: - $TEST_COMMAND From 7bd260a5938458b3356c05e79bd0d13d054e420d Mon Sep 17 00:00:00 2001 From: Nyholm Date: Sat, 29 Dec 2018 14:43:45 +0100 Subject: [PATCH 6/6] Run test on php7.1 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 1082bb0..2c7a0b1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,7 +28,7 @@ matrix: include: - php: 5.4 env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest" COVERAGE=true TEST_COMMAND="composer test-ci" - - php: 7.2 + - php: 7.1 env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest" before_install: