From 692eb01845aed66b8bdb33e3973f7fec63c32858 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Tue, 11 Apr 2023 10:41:20 +0200 Subject: [PATCH] Deprecate Http\Client\HttpClient and allow psr/http-message v2 --- .github/workflows/ci.yml | 19 ++++++------------- .github/workflows/static.yml | 4 ++-- CHANGELOG.md | 7 ++++++- composer.json | 6 +++--- spec/Exception/HttpExceptionSpec.php | 2 ++ src/HttpClient.php | 2 ++ 6 files changed, 21 insertions(+), 19 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b480393..ef521c1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,11 +12,11 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - php: ['7.1', '7.2', '7.3', '7.4', '8.0'] + php: ['7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2'] steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Setup PHP uses: shivammathur/setup-php@v2 @@ -25,15 +25,8 @@ jobs: tools: composer:v2 coverage: none - - name: Install PHP 7 dependencies + - name: Install dependencies run: composer update --prefer-dist --no-interaction --no-progress - if: "startsWith(matrix.php, '7.')" - - - name: Install PHP 8 dependencies - run: | - composer require "phpdocumentor/reflection-docblock:^5.2@dev" --no-interaction --no-update - composer update --prefer-dist --prefer-stable --no-interaction --no-progress --ignore-platform-req=php - if: "startsWith(matrix.php, '8.')" - name: Execute tests run: composer test @@ -43,11 +36,11 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - php: ['7.1', '7.4', '8.0'] + php: ['7.1', '7.4', '8.0', '8.1', '8.2'] steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Setup PHP uses: shivammathur/setup-php@v2 @@ -70,7 +63,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Setup PHP uses: shivammathur/setup-php@v2 diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml index a8dcf9a..6a977c6 100644 --- a/.github/workflows/static.yml +++ b/.github/workflows/static.yml @@ -13,7 +13,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: PHPStan uses: docker://oskarstark/phpstan-ga @@ -26,7 +26,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: PHP-CS-Fixer uses: docker://oskarstark/php-cs-fixer-ga diff --git a/CHANGELOG.md b/CHANGELOG.md index 26483c2..cc5ec4b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,12 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). -## [Unreleased] +## [2.4.0] - Unreleased + +### Changed + +- Allow `psr/http-message` v2 in addition to v1 +- Deprecate `Http\Client\HttpClient`, use [PSR-18](https://www.php-fig.org/psr/psr-18/) instead ## [2.3.0] - 2022-02-21 diff --git a/composer.json b/composer.json index 268b27e..579e588 100644 --- a/composer.json +++ b/composer.json @@ -22,11 +22,11 @@ "php": "^7.1 || ^8.0", "php-http/promise": "^1.1", "psr/http-client": "^1.0", - "psr/http-message": "^1.0" + "psr/http-message": "^1.0 || ^2.0" }, "require-dev": { - "friends-of-phpspec/phpspec-code-coverage": "^4.1", - "phpspec/phpspec": "^5.1 || ^6.0" + "friends-of-phpspec/phpspec-code-coverage": "^4.1 || ^5.0 || ^6.0", + "phpspec/phpspec": "^5.1 || ^6.0 || ^7.0" }, "extra": { "branch-alias": { diff --git a/spec/Exception/HttpExceptionSpec.php b/spec/Exception/HttpExceptionSpec.php index 3658f56..20eb58e 100644 --- a/spec/Exception/HttpExceptionSpec.php +++ b/spec/Exception/HttpExceptionSpec.php @@ -10,6 +10,8 @@ class HttpExceptionSpec extends ObjectBehavior { function let(RequestInterface $request, ResponseInterface $response) { + $response->getStatusCode()->willReturn(500); + $this->beConstructedWith('message', $request, $response); } diff --git a/src/HttpClient.php b/src/HttpClient.php index 4442bd0..22b94aa 100644 --- a/src/HttpClient.php +++ b/src/HttpClient.php @@ -9,6 +9,8 @@ * * Provide the Httplug HttpClient interface for BC. * You should typehint Psr\Http\Client\ClientInterface in new code + * + * @deprecated since version 2.4, use Psr\Http\Client\ClientInterface instead; see https://www.php-fig.org/psr/psr-18/ */ interface HttpClient extends ClientInterface {