Skip to content

Add typed client exceptions, PSR-7 constants, and shared adapter test…#1

Merged
loks0n merged 5 commits into
mainfrom
client-exceptions-and-test-contract
Jun 6, 2026
Merged

Add typed client exceptions, PSR-7 constants, and shared adapter test…#1
loks0n merged 5 commits into
mainfrom
client-exceptions-and-test-contract

Conversation

@loks0n
Copy link
Copy Markdown
Contributor

@loks0n loks0n commented Jun 6, 2026

… 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().

loks0n and others added 5 commits June 6, 2026 10:00
… 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>
@loks0n loks0n merged commit f84939c into main Jun 6, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant