Repository navigation
Support PHP 8.5 and rework retries and error handling (0.1.0) - #1
Merged
Merged
Conversation
- PHP 8.2 to 8.5; PHPUnit 11 (attributes), PHPStan 2, Rector 2, current php-cs-fixer rule sets; CI matrix 8.2-8.5 - GenericRetryStrategy: 5xx and network errors are retried for idempotent methods only, 429 for every method; Retry-After is honoured; RetryClient gains a maxDuration deadline and an injectable clock; RetryTrait is removed - Client throws ClientException/ServerException on 4xx/5xx and TransportException on network failures, with status code and cause; messages never contain response bodies or query strings - Request bodies can be strings; encoders set their Content-Type and a request can bring its own encoder (FormRequestBodyEncoder) - Responses keep the raw body and decode lazily - Testing\MockClient and Clock\MockClock for consumer tests - README sections filled in, UPGRADE-0.1.md Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
paratest 7.8.0 calls a PHPUnit method that 11.5.50 does not have, so every worker crashed; psr/http-factory 1.0 and nyholm/psr7 < 1.8.2 declare implicitly nullable parameters, deprecated since PHP 8.4, which failOnDeprecation turns into failures. Co-Authored-By: Claude Opus 5.5 <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.
Summary
Makes the library installable on PHP 8.5 and fixes the retry and error handling so it is safe for non-idempotent requests. Released as 0.1.0; breaking changes are listed in UPGRADE-0.1.md.
PHP and tooling
~8.2to~8.5; CI tests the whole rangeazjezz/psland the unusedsymplify/phpstan-rulesandspatie/phpunit-snapshot-assertionsRetries
GenericRetryStrategybehind a newRetryStrategyInterface;RetryTraitremovedRetry-After(seconds or HTTP-date) is honoured; if it asks for longer thanmaxDelay, the request is not retriedRetryClientgets amaxDurationdeadline (waits included) and an injectable clock instead ofusleepmaxRetriesnow counts retries, not attemptsErrors
ClientthrowsClientException/ServerExceptionon 4xx/5xx (HTTP status as code, request and response attached) andTransportExceptionon network failures (cause chained); all implementApiExceptionInterfacethrowOnErrorStatus: falsekeeps the old behaviourBodies
array|string|null; a string is sent as-isContent-Type; a request can bring its own encoder (newFormRequestBodyEncoder)rawBody()and decode lazily; decode failures throwDecodingExceptionTesting
Testing\MockClient(queued responses, recorded requests) andClock\MockClockVerification
make tests: unit 60, integration 13, e2e 2 (real Symfony + Guzzle clients against httpbin)php:*-cli)make cs-check,make analyseandrector --dry-runare clean