diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a385b83..41651d5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 @@ -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 @@ -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 diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml index 8de2f7d..866aeaa 100644 --- a/.github/workflows/static.yml +++ b/.github/workflows/static.yml @@ -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 @@ -26,7 +26,7 @@ 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: @@ -37,7 +37,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: Psalm uses: docker://vimeo/psalm-github-actions diff --git a/composer.json b/composer.json index d0a8ace..027616f 100644 --- a/composer.json +++ b/composer.json @@ -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" diff --git a/src/Client.php b/src/Client.php index 51724a6..32ba777 100644 --- a/src/Client.php +++ b/src/Client.php @@ -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); diff --git a/src/Promise.php b/src/Promise.php index 815329d..14a8812 100644 --- a/src/Promise.php +++ b/src/Promise.php @@ -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); diff --git a/tests/PromiseExceptionTest.php b/tests/PromiseExceptionTest.php index b0d0276..f035753 100644 --- a/tests/PromiseExceptionTest.php +++ b/tests/PromiseExceptionTest.php @@ -24,10 +24,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); @@ -36,10 +37,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],