Add typed client exceptions, PSR-7 constants, and shared adapter test…#1
Merged
Conversation
… contract Introduce a typed exception hierarchy for client failures (connection, DNS, TLS, proxy, protocol, invalid URI/response, adapter init/precondition) and PSR-7 constant helpers (Header, Method, ContentType). Adapters now map transport failures onto these exceptions. Tests share a single AdapterContract run against both the cURL and Swoole coroutine adapters. The test HTTP server is a deep module: Http::serve(), Http::raw(), and Http::unbound() each manage the full server lifecycle (allocate, spawn, await readiness, tear down) behind a callable, and the extension guard runs once in setUp(). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Apply Rector fixes that CI's refactor:check flagged: drop an unused private parameter and simplify control flow in the Swoole adapter, and remove a redundant string cast in the adapter test contract. Use the existing ContentType::XML constant in the README instead of a raw string and cover it in the constants test. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
CI only loaded ext-curl, so every Swoole adapter test failed its availability guard. Add swoole to shivammathur/setup-php's extensions so the Swoole suite actually runs. The partial-response-headers test sent a Content-Length header, which some libcurl versions parse and then report as CURLE_PARTIAL_FILE (a truncated body, ProtocolException) rather than a dropped connection. Drop the Content-Length so the response is unambiguously incomplete headers and maps to ConnectionException on every curl version. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Pin each GitHub Action to the immutable commit SHA of its latest release, with the version recorded in a trailing comment. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Bump swoole/ide-helper to ^6.0 (5.1.8 => 6.0.2). Other dependencies are already at their newest versions resolvable under the project's PHP >=8.4 floor; PHPUnit stays on 12 since 13 requires PHP >=8.4.1. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
… contract
Introduce a typed exception hierarchy for client failures (connection, DNS, TLS, proxy, protocol, invalid URI/response, adapter init/precondition) and PSR-7 constant helpers (Header, Method, ContentType). Adapters now map transport failures onto these exceptions.
Tests share a single AdapterContract run against both the cURL and Swoole coroutine adapters. The test HTTP server is a deep module: Http::serve(), Http::raw(), and Http::unbound() each manage the full server lifecycle (allocate, spawn, await readiness, tear down) behind a callable, and the extension guard runs once in setUp().