From c66e081eb9dfbf15a1260d851d41b002ede2654c Mon Sep 17 00:00:00 2001 From: Alessandro Lai Date: Wed, 31 Oct 2018 12:00:16 +0100 Subject: [PATCH 01/17] Allow HTTPlug 2.0 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 4695c4c..1ef2b71 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ ], "require": { "php": "^5.4 || ^7.0", - "php-http/httplug": "^1.1", + "php-http/httplug": "^1.1|^2.0", "php-http/message-factory": "^1.0", "php-http/message": "^1.6", "symfony/options-resolver": "^2.6 || ^3.0 || ^4.0" From 35720b00b7dad8e6647f49e1020a52e911632051 Mon Sep 17 00:00:00 2001 From: Alessandro Lai Date: Wed, 31 Oct 2018 12:06:23 +0100 Subject: [PATCH 02/17] Use the official syntax [skip CI] --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 1ef2b71..74c80d9 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ ], "require": { "php": "^5.4 || ^7.0", - "php-http/httplug": "^1.1|^2.0", + "php-http/httplug": "^1.1 || ^2.0", "php-http/message-factory": "^1.0", "php-http/message": "^1.6", "symfony/options-resolver": "^2.6 || ^3.0 || ^4.0" From d7116bfb61777f46504d09655879006b61c10885 Mon Sep 17 00:00:00 2001 From: Alessandro Lai Date: Wed, 31 Oct 2018 12:32:46 +0100 Subject: [PATCH 03/17] Bump to a future major version; allow only HTTPlug 2 --- .travis.yml | 6 ------ composer.json | 8 ++++---- src/HttpMethodsClient.php | 2 +- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6af5f34..7136777 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,9 +1,6 @@ language: php - sudo: false -dist: trusty - cache: directories: - $HOME/.composer/cache/files @@ -23,9 +20,6 @@ matrix: env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest" DEPENDENCIES="doctrine/instantiator:^1.1" # Test the latest stable release - - php: 5.4 - - php: 5.5 - - php: 5.6 - php: 7.0 - php: 7.1 - php: 7.2 diff --git a/composer.json b/composer.json index 74c80d9..0ba6124 100644 --- a/composer.json +++ b/composer.json @@ -11,14 +11,14 @@ } ], "require": { - "php": "^5.4 || ^7.0", - "php-http/httplug": "^1.1 || ^2.0", + "php": "^7.0", + "php-http/httplug": "^2.0", "php-http/message-factory": "^1.0", "php-http/message": "^1.6", "symfony/options-resolver": "^2.6 || ^3.0 || ^4.0" }, "require-dev": { - "phpspec/phpspec": "^2.5 || ^3.4 || ^4.2", + "phpspec/phpspec": "^4.2", "guzzlehttp/psr7": "^1.4" }, "suggest": { @@ -37,7 +37,7 @@ }, "extra": { "branch-alias": { - "dev-master": "1.8-dev" + "dev-master": "2.0-dev" } } } diff --git a/src/HttpMethodsClient.php b/src/HttpMethodsClient.php index 58804fc..0ec1e14 100644 --- a/src/HttpMethodsClient.php +++ b/src/HttpMethodsClient.php @@ -198,7 +198,7 @@ public function send($method, $uri, array $headers = [], $body = null) * * {@inheritdoc} */ - public function sendRequest(RequestInterface $request) + public function sendRequest(RequestInterface $request): ResponseInterface { return $this->httpClient->sendRequest($request); } From 5dd4d9fc5b40814a1b822f75115f6ef9ad39fb48 Mon Sep 17 00:00:00 2001 From: Alessandro Lai Date: Wed, 31 Oct 2018 12:41:30 +0100 Subject: [PATCH 04/17] Fix constraint collision in build --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 7136777..f0cafd1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,7 +23,7 @@ matrix: - php: 7.0 - php: 7.1 - php: 7.2 - env: COVERAGE=true TEST_COMMAND="composer test-ci" DEPENDENCIES="henrikbjorn/phpspec-code-coverage:^1.0" + env: COVERAGE=true TEST_COMMAND="composer test-ci" DEPENDENCIES="henrikbjorn/phpspec-code-coverage:^3.0" # Test LTS versions - php: 7.1 From d99e7aab8295b19e751ada0a83a1343b69dbcc5f Mon Sep 17 00:00:00 2001 From: Alessandro Lai Date: Wed, 31 Oct 2018 12:41:43 +0100 Subject: [PATCH 05/17] Fix all remaining client signatures --- spec/HttpClientPool/LeastUsedClientPoolSpec.php | 4 ---- src/BatchClient.php | 3 ++- src/HttpAsyncClientEmulator.php | 3 ++- src/HttpClientDecorator.php | 3 ++- src/HttpClientEmulator.php | 3 ++- src/HttpClientPool.php | 3 ++- src/HttpClientPoolItem.php | 3 ++- src/HttpClientRouter.php | 3 ++- src/PluginClient.php | 3 ++- 9 files changed, 16 insertions(+), 12 deletions(-) diff --git a/spec/HttpClientPool/LeastUsedClientPoolSpec.php b/spec/HttpClientPool/LeastUsedClientPoolSpec.php index a976c31..82855d9 100644 --- a/spec/HttpClientPool/LeastUsedClientPoolSpec.php +++ b/spec/HttpClientPool/LeastUsedClientPoolSpec.php @@ -72,10 +72,6 @@ public function it_reenable_client(HttpClient $client, RequestInterface $request public function it_uses_the_lowest_request_client(HttpClientPoolItem $client1, HttpClientPoolItem $client2, RequestInterface $request, ResponseInterface $response) { - if (extension_loaded('xdebug')) { - throw new SkippingException('This test fail when xdebug is enable on PHP < 7'); - } - $this->addHttpClient($client1); $this->addHttpClient($client2); diff --git a/src/BatchClient.php b/src/BatchClient.php index 2036355..2a39904 100644 --- a/src/BatchClient.php +++ b/src/BatchClient.php @@ -6,6 +6,7 @@ use Http\Client\HttpClient; use Http\Client\Common\Exception\BatchException; use Psr\Http\Message\RequestInterface; +use Psr\Http\Message\ResponseInterface; /** * BatchClient allow to sends multiple request and retrieve a Batch Result. @@ -32,7 +33,7 @@ public function __construct(HttpClient $client) /** * {@inheritdoc} */ - public function sendRequest(RequestInterface $request) + public function sendRequest(RequestInterface $request): ResponseInterface { return $this->client->sendRequest($request); } diff --git a/src/HttpAsyncClientEmulator.php b/src/HttpAsyncClientEmulator.php index c0ba354..ce16f84 100644 --- a/src/HttpAsyncClientEmulator.php +++ b/src/HttpAsyncClientEmulator.php @@ -5,6 +5,7 @@ use Http\Client\Exception; use Http\Client\Promise; use Psr\Http\Message\RequestInterface; +use Psr\Http\Message\ResponseInterface; /** * Emulates an HTTP Async Client in an HTTP Client. @@ -18,7 +19,7 @@ trait HttpAsyncClientEmulator * * @see HttpClient::sendRequest */ - abstract public function sendRequest(RequestInterface $request); + abstract public function sendRequest(RequestInterface $request): ResponseInterface; /** * {@inheritdoc} diff --git a/src/HttpClientDecorator.php b/src/HttpClientDecorator.php index a33d5ef..da5a1bb 100644 --- a/src/HttpClientDecorator.php +++ b/src/HttpClientDecorator.php @@ -4,6 +4,7 @@ use Http\Client\HttpClient; use Psr\Http\Message\RequestInterface; +use Psr\Http\Message\ResponseInterface; /** * Decorates an HTTP Client. @@ -22,7 +23,7 @@ trait HttpClientDecorator * * @see HttpClient::sendRequest */ - public function sendRequest(RequestInterface $request) + public function sendRequest(RequestInterface $request): ResponseInterface { return $this->httpClient->sendRequest($request); } diff --git a/src/HttpClientEmulator.php b/src/HttpClientEmulator.php index dbec1ab..8e6472a 100644 --- a/src/HttpClientEmulator.php +++ b/src/HttpClientEmulator.php @@ -3,6 +3,7 @@ namespace Http\Client\Common; use Psr\Http\Message\RequestInterface; +use Psr\Http\Message\ResponseInterface; /** * Emulates an HTTP Client in an HTTP Async Client. @@ -16,7 +17,7 @@ trait HttpClientEmulator * * @see HttpClient::sendRequest */ - public function sendRequest(RequestInterface $request) + public function sendRequest(RequestInterface $request): ResponseInterface { $promise = $this->sendAsyncRequest($request); diff --git a/src/HttpClientPool.php b/src/HttpClientPool.php index 7ac292c..6f4597f 100644 --- a/src/HttpClientPool.php +++ b/src/HttpClientPool.php @@ -6,6 +6,7 @@ use Http\Client\HttpAsyncClient; use Http\Client\HttpClient; use Psr\Http\Message\RequestInterface; +use Psr\Http\Message\ResponseInterface; /** * A http client pool allows to send requests on a pool of different http client using a specific strategy (least used, @@ -52,7 +53,7 @@ public function sendAsyncRequest(RequestInterface $request) /** * {@inheritdoc} */ - public function sendRequest(RequestInterface $request) + public function sendRequest(RequestInterface $request): ResponseInterface { return $this->chooseHttpClient()->sendRequest($request); } diff --git a/src/HttpClientPoolItem.php b/src/HttpClientPoolItem.php index 09cd6dd..a46ee2f 100644 --- a/src/HttpClientPoolItem.php +++ b/src/HttpClientPoolItem.php @@ -6,6 +6,7 @@ use Http\Client\HttpClient; use Psr\Http\Message\RequestInterface; use Http\Client\Exception; +use Psr\Http\Message\ResponseInterface; /** * A HttpClientPoolItem represent a HttpClient inside a Pool. @@ -50,7 +51,7 @@ public function __construct($client, $reenableAfter = null) /** * {@inheritdoc} */ - public function sendRequest(RequestInterface $request) + public function sendRequest(RequestInterface $request): ResponseInterface { if ($this->isDisabled()) { throw new Exception\RequestException('Cannot send the request as this client has been disabled', $request); diff --git a/src/HttpClientRouter.php b/src/HttpClientRouter.php index 9f72133..fa32c56 100644 --- a/src/HttpClientRouter.php +++ b/src/HttpClientRouter.php @@ -7,6 +7,7 @@ use Http\Client\HttpClient; use Http\Message\RequestMatcher; use Psr\Http\Message\RequestInterface; +use Psr\Http\Message\ResponseInterface; /** * Route a request to a specific client in the stack based using a RequestMatcher. @@ -23,7 +24,7 @@ final class HttpClientRouter implements HttpClient, HttpAsyncClient /** * {@inheritdoc} */ - public function sendRequest(RequestInterface $request) + public function sendRequest(RequestInterface $request): ResponseInterface { $client = $this->chooseHttpClient($request); diff --git a/src/PluginClient.php b/src/PluginClient.php index 93aea8f..7413152 100644 --- a/src/PluginClient.php +++ b/src/PluginClient.php @@ -9,6 +9,7 @@ use Http\Client\Promise\HttpFulfilledPromise; use Http\Client\Promise\HttpRejectedPromise; use Psr\Http\Message\RequestInterface; +use Psr\Http\Message\ResponseInterface; use Symfony\Component\OptionsResolver\OptionsResolver; /** @@ -67,7 +68,7 @@ public function __construct($client, array $plugins = [], array $options = []) /** * {@inheritdoc} */ - public function sendRequest(RequestInterface $request) + public function sendRequest(RequestInterface $request): ResponseInterface { // If we don't have an http client, use the async call if (!($this->client instanceof HttpClient)) { From af093a3b1689ffb3bad914bc74d095fafe37a13c Mon Sep 17 00:00:00 2001 From: Alessandro Lai Date: Wed, 31 Oct 2018 12:45:50 +0100 Subject: [PATCH 06/17] Fix branch alias after PR retarget [skip CI] --- composer.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 0ba6124..0392bdc 100644 --- a/composer.json +++ b/composer.json @@ -37,7 +37,8 @@ }, "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-2.x": "2.x-dev", + "dev-master": "1.8-dev" } } } From 36d79a763f27cf1f460e509a6e6da44b480534a8 Mon Sep 17 00:00:00 2001 From: Alessandro Lai Date: Wed, 31 Oct 2018 12:58:58 +0100 Subject: [PATCH 07/17] Re-allow PHPSpec 3 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 0392bdc..71bcb0b 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,7 @@ "symfony/options-resolver": "^2.6 || ^3.0 || ^4.0" }, "require-dev": { - "phpspec/phpspec": "^4.2", + "phpspec/phpspec": "^3.4 || ^4.2", "guzzlehttp/psr7": "^1.4" }, "suggest": { From a8e1cb580632021bf128788f7e019868b96ac552 Mon Sep 17 00:00:00 2001 From: Alessandro Lai Date: Wed, 31 Oct 2018 14:30:38 +0100 Subject: [PATCH 08/17] Add more jobs to the CI matrix --- .travis.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index f0cafd1..6f4ad2e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,6 +22,7 @@ matrix: # Test the latest stable release - php: 7.0 - php: 7.1 + - php: 7.2 - php: 7.2 env: COVERAGE=true TEST_COMMAND="composer test-ci" DEPENDENCIES="henrikbjorn/phpspec-code-coverage:^3.0" @@ -38,9 +39,9 @@ matrix: env: STABILITY="dev" allow_failures: - # Latest dev is allowed to fail. + - php: 7.3 - env: STABILITY="dev" - + before_install: - if [[ $COVERAGE != true ]]; then phpenv config-rm xdebug.ini || true; fi - if ! [ -z "$STABILITY" ]; then composer config minimum-stability ${STABILITY}; fi; From fae20830452a73924979b74d5a8528cd7a913b5c Mon Sep 17 00:00:00 2001 From: Alessandro Lai Date: Wed, 31 Oct 2018 14:39:33 +0100 Subject: [PATCH 09/17] Fix build for 7.3 --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 6f4ad2e..1b4768d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -40,6 +40,7 @@ matrix: allow_failures: - php: 7.3 + sudo: required - env: STABILITY="dev" before_install: From 8fc310c9d0229447fd0e7060347fdcf82208a4a0 Mon Sep 17 00:00:00 2001 From: Alessandro Lai Date: Wed, 31 Oct 2018 14:59:43 +0100 Subject: [PATCH 10/17] Try to lock lower bound of deps to sebastian/comparator 2.0 --- composer.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/composer.json b/composer.json index 71bcb0b..a067f9f 100644 --- a/composer.json +++ b/composer.json @@ -19,8 +19,12 @@ }, "require-dev": { "phpspec/phpspec": "^3.4 || ^4.2", + "phpspec/prophecy": "^1.7", "guzzlehttp/psr7": "^1.4" }, + "conflict": { + "sebastian/comparator": "<2" + }, "suggest": { "php-http/logger-plugin": "PSR-3 Logger plugin", "php-http/cache-plugin": "PSR-6 Cache plugin", From a131600c0cab2a90f9e6b434bab4ef199ae3a2af Mon Sep 17 00:00:00 2001 From: Alessandro Lai Date: Wed, 31 Oct 2018 17:57:33 +0100 Subject: [PATCH 11/17] Require at least doctrine/instantiator 1.0.5 because of doctrine/instantiator#20 --- composer.json | 1 + 1 file changed, 1 insertion(+) diff --git a/composer.json b/composer.json index a067f9f..e0da866 100644 --- a/composer.json +++ b/composer.json @@ -23,6 +23,7 @@ "guzzlehttp/psr7": "^1.4" }, "conflict": { + "doctrine/instantiator": "<1.0.5", "sebastian/comparator": "<2" }, "suggest": { From 22c357328cecc48581203d5cac44a203716f3a9f Mon Sep 17 00:00:00 2001 From: Alessandro Lai Date: Wed, 31 Oct 2018 18:10:16 +0100 Subject: [PATCH 12/17] Require at least phpspec/prophecy 1.8 due to phpspec/prophecy#412 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index e0da866..97a894b 100644 --- a/composer.json +++ b/composer.json @@ -19,7 +19,7 @@ }, "require-dev": { "phpspec/phpspec": "^3.4 || ^4.2", - "phpspec/prophecy": "^1.7", + "phpspec/prophecy": "^1.8", "guzzlehttp/psr7": "^1.4" }, "conflict": { From 92721480f860349bf19669d8e7ff0580037b4a51 Mon Sep 17 00:00:00 2001 From: Alessandro Lai Date: Wed, 31 Oct 2018 18:14:46 +0100 Subject: [PATCH 13/17] Run --prefer-lowest on lowest PHP version (7.0) --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1b4768d..36af57b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,8 +16,8 @@ branches: matrix: fast_finish: true include: - - php: 7.1 - env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest" DEPENDENCIES="doctrine/instantiator:^1.1" + - php: 7.0 + env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest" # Test the latest stable release - php: 7.0 From e54ceb7aef4fb4cd65113852d3563f00ddbebd1d Mon Sep 17 00:00:00 2001 From: Alessandro Lai Date: Wed, 31 Oct 2018 18:17:13 +0100 Subject: [PATCH 14/17] Use leanphp/phpspec-code-coverage as a maintained fork --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 36af57b..0c9a55f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,7 +24,7 @@ matrix: - php: 7.1 - php: 7.2 - php: 7.2 - env: COVERAGE=true TEST_COMMAND="composer test-ci" DEPENDENCIES="henrikbjorn/phpspec-code-coverage:^3.0" + env: COVERAGE=true TEST_COMMAND="composer test-ci" DEPENDENCIES="leanphp/phpspec-code-coverage" # Test LTS versions - php: 7.1 From 8f65a3c1c76d1f1a07315c1cb062aa11cce994a0 Mon Sep 17 00:00:00 2001 From: Alessandro Lai Date: Wed, 31 Oct 2018 18:22:56 +0100 Subject: [PATCH 15/17] Fix coverage extension load --- phpspec.ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpspec.ci.yml b/phpspec.ci.yml index 0838ef5..d8e1383 100644 --- a/phpspec.ci.yml +++ b/phpspec.ci.yml @@ -4,7 +4,7 @@ suites: psr4_prefix: Http\Client\Common formatter.name: pretty extensions: - - PhpSpec\Extension\CodeCoverageExtension + LeanPHP\PhpSpec\CodeCoverage\CodeCoverageExtension: ~ code_coverage: format: clover output: build/coverage.xml From 6e5c694a5260c24d809085c51222ce75d6025ff7 Mon Sep 17 00:00:00 2001 From: Alessandro Lai Date: Wed, 31 Oct 2018 18:34:18 +0100 Subject: [PATCH 16/17] Convert require into conflict where not needed --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 97a894b..78a6226 100644 --- a/composer.json +++ b/composer.json @@ -19,11 +19,11 @@ }, "require-dev": { "phpspec/phpspec": "^3.4 || ^4.2", - "phpspec/prophecy": "^1.8", "guzzlehttp/psr7": "^1.4" }, "conflict": { "doctrine/instantiator": "<1.0.5", + "phpspec/prophecy": "<1.8", "sebastian/comparator": "<2" }, "suggest": { From 6ff43deec474be0be7b453484a4f975511cba329 Mon Sep 17 00:00:00 2001 From: Alessandro Lai Date: Tue, 6 Nov 2018 10:34:25 +0100 Subject: [PATCH 17/17] Move restrictions from conflict to require-dev --- composer.json | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/composer.json b/composer.json index 78a6226..fc3d1c1 100644 --- a/composer.json +++ b/composer.json @@ -18,13 +18,11 @@ "symfony/options-resolver": "^2.6 || ^3.0 || ^4.0" }, "require-dev": { + "doctrine/instantiator": ">=1.0.5", + "guzzlehttp/psr7": "^1.4", "phpspec/phpspec": "^3.4 || ^4.2", - "guzzlehttp/psr7": "^1.4" - }, - "conflict": { - "doctrine/instantiator": "<1.0.5", - "phpspec/prophecy": "<1.8", - "sebastian/comparator": "<2" + "phpspec/prophecy": ">=1.8", + "sebastian/comparator": ">=2" }, "suggest": { "php-http/logger-plugin": "PSR-3 Logger plugin",