Skip to content

Add retry logging and Symfony clock support, allow webmozart/assert 2 (0.1.1) - #2

Merged
jschaedl merged 1 commit into
mainfrom
feature/0.1.1-logging-clock
Oct 25, 2026
Merged

jschaedl merged 1 commit into
mainfrom
feature/0.1.1-logging-clock

Conversation

@jschaedl

Copy link
Copy Markdown
Owner

Summary

Three additions so the library can replace the hand-rolled HTTP clients in a Symfony app.

  • webmozart/assert 2: the constraint is now ^1.11||^2.0. Apps that lock Assert 2 (e.g. through phpdocumentor/reflection-docblock) could not install 0.1.0. No code changes were needed: the whole suite and PHPStan pass on Assert 2.5.

  • Retry logging: RetryClient takes an optional PSR-3 logger and logs at info

    • every retry: Retrying "GET items" after HTTP 503 in 1s (retry 1 of 3).
    • every retry maxDuration prevents.

    The context holds status_code, retry, max_retries, delay and max_duration. Entries never contain the query string or a body. psr/log (^1.1||^2.0||^3.0) is now a requirement.

  • Symfony clock: Clock\SymfonyClockAdapter lets RetryClient and GenericRetryStrategy use a Symfony clock, e.g. the framework's clock service, so Symfony's MockClock drives retry delays in tests. symfony/clock is suggested, not required.

Also:

  • RetryClient::request() is split up to stay under the cognitive-complexity limit; behaviour is unchanged.
  • The symfony/clock dev floor is ^6.4.13, because 6.4.0 triggers PHP 8.4+ deprecations under --prefer-lowest.
  • README sections and a new CHANGELOG.md.

Verification

  • make tests on PHP 8.5 with the highest dependencies: unit 64, integration 13, e2e 2
  • --prefer-lowest --prefer-stable on PHP 8.2 and 8.5 (Docker) with psr/log 1.1.0, webmozart/assert 1.11.0, symfony/clock 6.4.13: green
  • make cs-check, make analyse and rector --dry-run are clean

🤖 Generated with Claude Code

- RetryClient takes an optional PSR-3 logger and logs every retry, and
  every retry prevented by maxDuration, at info level; entries never
  contain the query string or a body
- Clock\SymfonyClockAdapter lets RetryClient and GenericRetryStrategy use
  a Symfony clock (and its MockClock in tests)
- webmozart/assert ^1.11||^2.0, so the library installs next to
  packages that need Assert 2
- symfony/clock dev floor ^6.4.13: 6.4.0 triggers PHP 8.4+ deprecations
  under --prefer-lowest

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jschaedl
jschaedl merged commit 913509d into main Oct 25, 2026
20 checks passed
@jschaedl
jschaedl deleted the feature/0.1.1-logging-clock branch October 25, 2026 11:53
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