Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: php-http/client-common
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 2.7.1
Choose a base ref
...
head repository: php-http/client-common
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 2.x
Choose a head ref
  • 19 commits
  • 40 files changed
  • 5 contributors

Commits on Jan 4, 2024

  1. update with latest cs fixer

    dbu committed Jan 4, 2024
    Copy the full SHA
    ce4e409 View commit details
  2. Merge pull request #233 from php-http/fix-static-ci

    Fix static ci
    dbu authored Jan 4, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    74da2cd View commit details

Commits on Jan 13, 2024

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    e93af13 View commit details

Commits on Jan 15, 2024

  1. Merge pull request #236 from qkdreyer/patch-1

    chore: fix random client pool phpdoc
    dbu authored Jan 15, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    76015e9 View commit details

Commits on Jan 21, 2024

  1. Copy the full SHA
    bd6df90 View commit details
  2. chore: add testruns for php 8.3

    bump github actions "actions/checkout" version 3 => 4
    Chris8934 committed Jan 21, 2024
    Copy the full SHA
    1c59445 View commit details

Commits on Jan 22, 2024

  1. Merge pull request #238 from Chris53897/fix/namespace-in-tests

    test: fix namespace for RedirectPluginTest
    dbu authored Jan 22, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    4b3a306 View commit details
  2. Merge pull request #240 from Chris53897/feature/add-testruns-for-php-83

    chore: add testruns for php 8.3
    dbu authored Jan 22, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    a7640b6 View commit details

Commits on Jan 23, 2024

  1. chore: bump github actions "OskarStark/phpstan-ga" version 0.x => 1.1…

    …3.0 (#241)
    
    * chore: bump github action "OskarStark/phpstan-ga"
    
    ---------
    
    Co-authored-by: Christopher Georg <[email protected]>
    Chris53897 and Chris8934 authored Jan 23, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    7831968 View commit details
  2. chore: add testrun for symfony 7 (#237)

    * add testrun for symfony 7
    * fix symfony flex setup
    ---------
    
    Co-authored-by: Christopher Georg <[email protected]>
    Chris53897 and Chris8934 authored Jan 23, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    f61eca2 View commit details

Commits on Jan 26, 2024

  1. Copy the full SHA
    28ac139 View commit details
  2. Copy the full SHA
    d34b90c View commit details
  3. Copy the full SHA
    dd6c781 View commit details

Commits on Jan 29, 2024

  1. Merge pull request #246 from Chris53897/feature/fix-php-doc-2

    chore: fix phpDoc for return values createValueKeys()
    dbu authored Jan 29, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    15020a0 View commit details
  2. Merge pull request #245 from Chris53897/feature/fix-php-doc

    chore: fix phpDoc for return values
    dbu authored Jan 29, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    d930a40 View commit details

Commits on Sep 23, 2024

  1. adjust to latest cs fixer

    dbu committed Sep 23, 2024
    Copy the full SHA
    b25792f View commit details
  2. Merge pull request #248 from php-http/cs-fix

    adjust to latest cs fixer
    dbu authored Sep 23, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    5bd058b View commit details
  3. Test on PHP 8.4

    * Add 8.4 to matrix
    eiriksm authored Sep 23, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    83263d4 View commit details

Commits on Sep 24, 2024

  1. prepare release

    dbu committed Sep 24, 2024
    Copy the full SHA
    0cfe985 View commit details
Showing with 48 additions and 158 deletions.
  1. +6 −3 .github/workflows/static.yml
  2. +20 −25 .github/workflows/tests.yml
  3. +5 −0 CHANGELOG.md
  4. +1 −10 src/Deferred.php
  5. +1 −1 src/Exception/HttpClientNoMatchException.php
  6. +0 −2 src/HttpAsyncClientDecorator.php
  7. +0 −4 src/HttpAsyncClientEmulator.php
  8. +0 −2 src/HttpClientDecorator.php
  9. +0 −4 src/HttpClientEmulator.php
  10. +0 −6 src/HttpClientPool/HttpClientPool.php
  11. +1 −7 src/HttpClientPool/HttpClientPoolItem.php
  12. +0 −3 src/HttpClientPool/LeastUsedClientPool.php
  13. +1 −4 src/HttpClientPool/RandomClientPool.php
  14. +0 −3 src/HttpClientPool/RoundRobinClientPool.php
  15. +0 −8 src/HttpClientRouter.php
  16. +1 −1 src/HttpMethodsClient.php
  17. +0 −3 src/Plugin/AddHostPlugin.php
  18. +0 −3 src/Plugin/AuthenticationPlugin.php
  19. +1 −4 src/Plugin/BaseUriPlugin.php
  20. +0 −3 src/Plugin/ContentLengthPlugin.php
  21. +0 −3 src/Plugin/ContentTypePlugin.php
  22. +1 −4 src/Plugin/CookiePlugin.php
  23. +0 −3 src/Plugin/DecoderPlugin.php
  24. +0 −3 src/Plugin/ErrorPlugin.php
  25. +0 −3 src/Plugin/HeaderAppendPlugin.php
  26. +0 −3 src/Plugin/HeaderDefaultsPlugin.php
  27. +0 −3 src/Plugin/HeaderRemovePlugin.php
  28. +0 −3 src/Plugin/HeaderSetPlugin.php
  29. +0 −3 src/Plugin/HistoryPlugin.php
  30. +0 −3 src/Plugin/QueryDefaultsPlugin.php
  31. +2 −5 src/Plugin/RedirectPlugin.php
  32. +1 −4 src/Plugin/RequestMatcherPlugin.php
  33. +0 −3 src/Plugin/RequestSeekableBodyPlugin.php
  34. +0 −3 src/Plugin/ResponseSeekableBodyPlugin.php
  35. +0 −3 src/Plugin/RetryPlugin.php
  36. +0 −6 src/PluginClient.php
  37. +1 −1 src/PluginClientBuilder.php
  38. +1 −1 tests/HttpMethodsClientTest.php
  39. +2 −2 tests/Plugin/RedirectPluginTest.php
  40. +3 −3 tests/PluginClientTest.php
9 changes: 6 additions & 3 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
@@ -13,10 +13,13 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Remove phpspec
run: composer remove --dev friends-of-phpspec/phpspec-code-coverage phpspec/phpspec

- name: PHPStan
uses: OskarStark/phpstan-ga@0.12.32
uses: docker://oskarstark/phpstan-ga
env:
REQUIRE_DEV: false
with:
@@ -28,7 +31,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: PHP-CS-Fixer
uses: docker://oskarstark/php-cs-fixer-ga
45 changes: 20 additions & 25 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -12,11 +12,11 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php: ['7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2']
php: ['7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4']

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
@@ -25,11 +25,9 @@ jobs:
tools: composer:v2
coverage: none

- name: Require PHPSpec 7.1 dependencies
run: |
composer require "phpspec/phpspec:^7.1@dev" --no-interaction --no-update
composer update --prefer-dist --no-interaction --no-progress --ignore-platform-req=php
if: "matrix.php == '8.1'"
- name: Emulate PHP 8.3
run: composer config platform.php 8.3.999
if: matrix.php == '8.4'

- name: Install PHP dependencies
run: composer update --prefer-dist --no-interaction --no-progress
@@ -42,11 +40,11 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php: ['7.1', '7.4', '8.2']
php: ['7.1', '7.4', '8.2', '8.3']

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
@@ -56,9 +54,7 @@ jobs:
coverage: none

- name: Install dependencies
run: |
composer require "sebastian/comparator:^3.0.2" --no-interaction --no-update
composer update --prefer-dist --prefer-stable --prefer-lowest --no-interaction --no-progress
run: composer update --prefer-dist --prefer-stable --prefer-lowest --no-interaction --no-progress

- name: Execute tests
run: composer test
@@ -69,16 +65,18 @@ jobs:
strategy:
matrix:
include:
- symfony: '4'
- symfony: '4.4.*'
php-version: '7.1'
- symfony: '5'
- symfony: '5.4.*'
php-version: '7.4'
- symfony: '6'
- symfony: '6.4.*'
php-version: '8.2'
- symfony: '7.0.*'
php-version: '8.2'

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
@@ -87,16 +85,13 @@ jobs:
tools: composer:v2
coverage: none

- name: Pin old packages
run: composer require "phpspec/phpspec:^2.5.8" --no-interaction --no-update
if: "matrix.symfony == '2'"

- name: Install dependencies
env:
SYMFONY_REQUIRE: ${{ matrix.symfony }}
run: |
composer config --no-plugins allow-plugins.symfony/flex true
composer require --no-update --no-interaction --no-progress symfony/flex
composer config extra.symfony.require ${{ matrix.symfony}}
composer update --prefer-dist --no-interaction --prefer-stable --prefer-lowest --no-progress
composer global config --no-plugins allow-plugins.symfony/flex true
composer global require --no-progress --no-scripts --no-plugins symfony/flex
composer update --prefer-dist --no-interaction --prefer-stable --no-progress
- name: Execute tests
run: composer test
@@ -107,7 +102,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Change Log

## 2.7.2 - 2024-09-24

- Updated code to not raise warnings for nullable parameters in PHP 8.4.
- Cleaned up PHPDoc comments.

## 2.7.1 - 2023-11-30

- Allow installation with Symfony 7.
11 changes: 1 addition & 10 deletions src/Deferred.php
Original file line number Diff line number Diff line change
@@ -51,10 +51,7 @@ public function __construct(callable $waitCallback)
$this->onRejectedCallbacks = [];
}

/**
* {@inheritdoc}
*/
public function then(callable $onFulfilled = null, callable $onRejected = null): Promise
public function then(?callable $onFulfilled = null, ?callable $onRejected = null): Promise
{
$deferred = new self($this->waitCallback);

@@ -86,9 +83,6 @@ public function then(callable $onFulfilled = null, callable $onRejected = null):
return $deferred;
}

/**
* {@inheritdoc}
*/
public function getState(): string
{
return $this->state;
@@ -128,9 +122,6 @@ public function reject(ClientExceptionInterface $exception): void
}
}

/**
* {@inheritdoc}
*/
public function wait($unwrap = true)
{
if (Promise::PENDING === $this->state) {
2 changes: 1 addition & 1 deletion src/Exception/HttpClientNoMatchException.php
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@ final class HttpClientNoMatchException extends TransferException
*/
private $request;

public function __construct(string $message, RequestInterface $request, \Exception $previous = null)
public function __construct(string $message, RequestInterface $request, ?\Exception $previous = null)
{
$this->request = $request;

2 changes: 0 additions & 2 deletions src/HttpAsyncClientDecorator.php
Original file line number Diff line number Diff line change
@@ -20,8 +20,6 @@ trait HttpAsyncClientDecorator
protected $httpAsyncClient;

/**
* {@inheritdoc}
*
* @see HttpAsyncClient::sendAsyncRequest
*/
public function sendAsyncRequest(RequestInterface $request)
4 changes: 0 additions & 4 deletions src/HttpAsyncClientEmulator.php
Original file line number Diff line number Diff line change
@@ -17,15 +17,11 @@
trait HttpAsyncClientEmulator
{
/**
* {@inheritdoc}
*
* @see HttpClient::sendRequest
*/
abstract public function sendRequest(RequestInterface $request): ResponseInterface;

/**
* {@inheritdoc}
*
* @see HttpAsyncClient::sendAsyncRequest
*/
public function sendAsyncRequest(RequestInterface $request)
2 changes: 0 additions & 2 deletions src/HttpClientDecorator.php
Original file line number Diff line number Diff line change
@@ -21,8 +21,6 @@ trait HttpClientDecorator
protected $httpClient;

/**
* {@inheritdoc}
*
* @see ClientInterface::sendRequest
*/
public function sendRequest(RequestInterface $request): ResponseInterface
4 changes: 0 additions & 4 deletions src/HttpClientEmulator.php
Original file line number Diff line number Diff line change
@@ -15,8 +15,6 @@
trait HttpClientEmulator
{
/**
* {@inheritdoc}
*
* @see HttpClient::sendRequest
*/
public function sendRequest(RequestInterface $request): ResponseInterface
@@ -27,8 +25,6 @@ public function sendRequest(RequestInterface $request): ResponseInterface
}

/**
* {@inheritdoc}
*
* @see HttpAsyncClient::sendAsyncRequest
*/
abstract public function sendAsyncRequest(RequestInterface $request);
6 changes: 0 additions & 6 deletions src/HttpClientPool/HttpClientPool.php
Original file line number Diff line number Diff line change
@@ -52,17 +52,11 @@ public function addHttpClient($client): void
*/
abstract protected function chooseHttpClient(): HttpClientPoolItem;

/**
* {@inheritdoc}
*/
public function sendAsyncRequest(RequestInterface $request)
{
return $this->chooseHttpClient()->sendAsyncRequest($request);
}

/**
* {@inheritdoc}
*/
public function sendRequest(RequestInterface $request): ResponseInterface
{
return $this->chooseHttpClient()->sendRequest($request);
8 changes: 1 addition & 7 deletions src/HttpClientPool/HttpClientPoolItem.php
Original file line number Diff line number Diff line change
@@ -57,7 +57,7 @@ class HttpClientPoolItem implements HttpClient, HttpAsyncClient
* @param ClientInterface|HttpAsyncClient $client
* @param int|null $reenableAfter Number of seconds until this client is enabled again after an error
*/
public function __construct($client, int $reenableAfter = null)
public function __construct($client, ?int $reenableAfter = null)
{
if (!$client instanceof ClientInterface && !$client instanceof HttpAsyncClient) {
throw new \TypeError(
@@ -69,9 +69,6 @@ public function __construct($client, int $reenableAfter = null)
$this->reenableAfter = $reenableAfter;
}

/**
* {@inheritdoc}
*/
public function sendRequest(RequestInterface $request): ResponseInterface
{
if ($this->isDisabled()) {
@@ -92,9 +89,6 @@ public function sendRequest(RequestInterface $request): ResponseInterface
return $response;
}

/**
* {@inheritdoc}
*/
public function sendAsyncRequest(RequestInterface $request)
{
if ($this->isDisabled()) {
3 changes: 0 additions & 3 deletions src/HttpClientPool/LeastUsedClientPool.php
Original file line number Diff line number Diff line change
@@ -15,9 +15,6 @@
*/
final class LeastUsedClientPool extends HttpClientPool
{
/**
* {@inheritdoc}
*/
protected function chooseHttpClient(): HttpClientPoolItem
{
$clientPool = array_filter($this->clientPool, function (HttpClientPoolItem $clientPoolItem) {
5 changes: 1 addition & 4 deletions src/HttpClientPool/RandomClientPool.php
Original file line number Diff line number Diff line change
@@ -7,15 +7,12 @@
use Http\Client\Common\Exception\HttpClientNotFoundException;

/**
* RoundRobinClientPool will choose the next client in the pool.
* RandomClientPool will choose a random enabled client in the pool.
*
* @author Joel Wurtz <joel.wurtz@gmail.com>
*/
final class RandomClientPool extends HttpClientPool
{
/**
* {@inheritdoc}
*/
protected function chooseHttpClient(): HttpClientPoolItem
{
$clientPool = array_filter($this->clientPool, function (HttpClientPoolItem $clientPoolItem) {
3 changes: 0 additions & 3 deletions src/HttpClientPool/RoundRobinClientPool.php
Original file line number Diff line number Diff line change
@@ -13,9 +13,6 @@
*/
final class RoundRobinClientPool extends HttpClientPool
{
/**
* {@inheritdoc}
*/
protected function chooseHttpClient(): HttpClientPoolItem
{
$last = current($this->clientPool);
8 changes: 0 additions & 8 deletions src/HttpClientRouter.php
Original file line number Diff line number Diff line change
@@ -12,8 +12,6 @@
use Psr\Http\Message\ResponseInterface;

/**
* {@inheritdoc}
*
* @author Joel Wurtz <joel.wurtz@gmail.com>
*/
final class HttpClientRouter implements HttpClientRouterInterface
@@ -23,17 +21,11 @@ final class HttpClientRouter implements HttpClientRouterInterface
*/
private $clients = [];

/**
* {@inheritdoc}
*/
public function sendRequest(RequestInterface $request): ResponseInterface
{
return $this->chooseHttpClient($request)->sendRequest($request);
}

/**
* {@inheritdoc}
*/
public function sendAsyncRequest(RequestInterface $request)
{
return $this->chooseHttpClient($request)->sendAsyncRequest($request);
2 changes: 1 addition & 1 deletion src/HttpMethodsClient.php
Original file line number Diff line number Diff line change
@@ -33,7 +33,7 @@ final class HttpMethodsClient implements HttpMethodsClientInterface
/**
* @param RequestFactory|RequestFactoryInterface $requestFactory
*/
public function __construct(ClientInterface $httpClient, $requestFactory, StreamFactoryInterface $streamFactory = null)
public function __construct(ClientInterface $httpClient, $requestFactory, ?StreamFactoryInterface $streamFactory = null)
{
if (!$requestFactory instanceof RequestFactory && !$requestFactory instanceof RequestFactoryInterface) {
throw new \TypeError(
3 changes: 0 additions & 3 deletions src/Plugin/AddHostPlugin.php
Original file line number Diff line number Diff line change
@@ -48,9 +48,6 @@ public function __construct(UriInterface $host, array $config = [])
$this->replace = $options['replace'];
}

/**
* {@inheritdoc}
*/
public function handleRequest(RequestInterface $request, callable $next, callable $first): Promise
{
if ($this->replace || '' === $request->getUri()->getHost()) {
3 changes: 0 additions & 3 deletions src/Plugin/AuthenticationPlugin.php
Original file line number Diff line number Diff line change
@@ -26,9 +26,6 @@ public function __construct(Authentication $authentication)
$this->authentication = $authentication;
}

/**
* {@inheritdoc}
*/
public function handleRequest(RequestInterface $request, callable $next, callable $first): Promise
{
$request = $this->authentication->authenticate($request);
5 changes: 1 addition & 4 deletions src/Plugin/BaseUriPlugin.php
Original file line number Diff line number Diff line change
@@ -24,7 +24,7 @@ final class BaseUriPlugin implements Plugin
/**
* @var AddPathPlugin|null
*/
private $addPathPlugin = null;
private $addPathPlugin;

/**
* @param UriInterface $uri Has to contain a host name and can have a path
@@ -39,9 +39,6 @@ public function __construct(UriInterface $uri, array $hostConfig = [])
}
}

/**
* {@inheritdoc}
*/
public function handleRequest(RequestInterface $request, callable $next, callable $first): Promise
{
$addHostNext = function (RequestInterface $request) use ($next, $first) {
Loading