Skip to content
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
69317c4
ci: add tests for PHP 8.5
Chris53897 Nov 10, 2025
de2784c
Update PHP version matrix to include 8.5
Chris53897 Nov 10, 2025
e044791
ci: add tests for PHP 8.5
Chris8934 Nov 11, 2025
c58b8c6
ci: add tests for PHP 8.5
Chris8934 Nov 11, 2025
f1e2a74
ci: add tests for PHP 8.5
Chris8934 Nov 11, 2025
2cc1ccb
ci: add tests for PHP 8.5
Chris8934 Nov 11, 2025
4b12ff0
ci: add tests for PHP 8.5
Chris8934 Dec 8, 2025
5153c4f
ci: add tests for PHP 8.5
Chris8934 Dec 8, 2025
6315543
ci: add tests for PHP 8.5
Chris8934 Dec 8, 2025
899bbfd
ci: add tests for PHP 8.5
Chris8934 Dec 8, 2025
98d836a
ci: add tests for PHP 8.5
Chris8934 Dec 8, 2025
5e031c8
ci: add tests for PHP 8.5
Chris8934 Dec 8, 2025
06c5808
ci: add tests for PHP 8.5
Chris8934 Dec 9, 2025
bcd9942
ci: add tests for PHP 8.5
Chris8934 Dec 9, 2025
eb608fd
ci: add tests for PHP 8.5
Chris8934 Dec 9, 2025
297f25f
ci: add tests for PHP 8.5
Chris8934 Dec 9, 2025
f386277
ci: add tests for PHP 8.5
Chris8934 Dec 9, 2025
5f7a7c4
ci: add tests for PHP 8.5
Chris8934 Dec 9, 2025
3d7496a
ci: add tests for PHP 8.5
Chris8934 Dec 9, 2025
c4c6548
ci: add tests for PHP 8.5
Chris8934 Dec 9, 2025
c715dca
ci: add tests for PHP 8.5
Chris8934 Dec 9, 2025
ec3d2f7
ci: add tests for PHP 8.5
Chris8934 Dec 9, 2025
7034b06
ci: add tests for PHP 8.5
Chris8934 Dec 9, 2025
a0d5f0d
ci: add tests for PHP 8.5
Chris8934 Dec 9, 2025
83cac1f
ci: add tests for PHP 8.5
Chris8934 Dec 9, 2025
1001d8f
ci: add tests for PHP 8.5
Chris8934 Dec 9, 2025
6c325d8
ci: add tests for PHP 8.5
Chris8934 Dec 9, 2025
559b141
ci: add tests for PHP 8.5
Chris8934 Dec 9, 2025
4ef1cec
ci: add tests for PHP 8.5
Chris8934 Dec 9, 2025
352d8a7
ci: add tests for PHP 8.5
Chris8934 Dec 9, 2025
5d08bb3
ci: add tests for PHP 8.5
Chris8934 Dec 9, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ jobs:
runs-on: ubuntu-latest
strategy:
max-parallel: 10
fail-fast: false
matrix:
php: [ '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
php: [ '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5']

steps:
- name: Set up PHP
Expand All @@ -25,7 +26,7 @@ jobs:
tools: flex

- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v5

- name: Download dependencies
run: composer update --no-interaction --prefer-dist --optimize-autoloader --prefer-stable
Expand All @@ -48,7 +49,7 @@ jobs:
tools: flex

- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v5

- name: Download dependencies
run: composer update --no-interaction --prefer-dist --optimize-autoloader --prefer-stable --prefer-lowest
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v5

- name: PHPStan
uses: docker://oskarstark/phpstan-ga
Expand All @@ -26,18 +26,18 @@ jobs:
name: PHP-CS-Fixer
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- name: PHP-CS-Fixer
uses: docker://oskarstark/php-cs-fixer-ga
with:
args: --dry-run
args: --diff --dry-run

psalm:
name: Psalm
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v5

- name: Psalm
uses: docker://vimeo/psalm-github-actions
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"guzzlehttp/guzzle": "^7.0"
},
"require-dev": {
"phpunit/phpunit": "^8.0|^9.3",
"phpunit/phpunit": "^8.5 || ^9.0 || ^10.0 || ^11.0 || ^12.0",
"php-http/client-integration-tests": "^3.0",
"phpspec/prophecy-phpunit": "^2.0",
"php-http/message-factory": "^1.1"
Expand Down
2 changes: 2 additions & 0 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,13 @@ public static function createWithConfig(array $config): Client
return new self(self::buildClient($config));
}

#[\Override]
public function sendRequest(RequestInterface $request): ResponseInterface
{
return $this->sendAsyncRequest($request)->wait();
}

#[\Override]
public function sendAsyncRequest(RequestInterface $request)
{
$promise = $this->guzzle->sendAsync($request);
Expand Down
3 changes: 3 additions & 0 deletions src/Promise.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,19 @@ public function __construct(PromiseInterface $promise, RequestInterface $request
});
}

#[\Override]
public function then(?callable $onFulfilled = null, ?callable $onRejected = null)
{
return new static($this->promise->then($onFulfilled, $onRejected), $this->request);
}

#[\Override]
public function getState()
{
return $this->state;
}

#[\Override]
public function wait($unwrap = true)
{
$this->promise->wait(false);
Expand Down
2 changes: 1 addition & 1 deletion tests/DefaultHttpAdapterWithConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class DefaultHttpAdapterWithConfigTest extends HttpClientTest
{
protected function createHttpAdapter(): ClientInterface
{
$this->defaultHeaders['X-Test'] = 'configuration-value';
self::$defaultHeaders['X-Test'] = 'configuration-value';

return Client::createWithConfig([
'headers' => [
Expand Down
10 changes: 6 additions & 4 deletions tests/PromiseExceptionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use Http\Client\Exception\NetworkException;
use Http\Client\Exception\RequestException;
use Http\Client\Exception\TransferException;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;
Expand All @@ -24,10 +25,11 @@ final class PromiseExceptionTest extends TestCase
/**
* @dataProvider exceptionThatIsThrownForGuzzleExceptionProvider
*/
#[DataProvider('exceptionThatIsThrownForGuzzleExceptionProvider')]
public function testExceptionThatIsThrownForGuzzleException(
RequestInterface $request,
$reason,
string $adapterExceptionClass,
string $adapterExceptionClass
): void {
$guzzlePromise = new \GuzzleHttp\Promise\Promise();
$guzzlePromise->reject($reason);
Expand All @@ -36,10 +38,10 @@ public function testExceptionThatIsThrownForGuzzleException(
$promise->wait();
}

public function exceptionThatIsThrownForGuzzleExceptionProvider(): array
public static function exceptionThatIsThrownForGuzzleExceptionProvider(): array
{
$request = $this->getMockBuilder(RequestInterface::class)->getMock();
$response = $this->getMockBuilder(ResponseInterface::class)->getMock();
$request = (new PromiseExceptionTest)->getMockBuilder(RequestInterface::class)->getMock();
$response = (new PromiseExceptionTest)->getMockBuilder(ResponseInterface::class)->getMock();

return [
[$request, new GuzzleExceptions\ConnectException('foo', $request), NetworkException::class],
Expand Down
Loading