Skip to content

Fix PHP 8.4+ deprecations, test on PHP 8.5 - #6

Merged
tommey merged 2 commits into
masterfrom
feature/php-8.4-explicit-nullable
Sep 28, 2026
Merged

tommey merged 2 commits into
masterfrom
feature/php-8.4-explicit-nullable

Conversation

@tommey

@tommey tommey commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

Makes the package free of deprecations on PHP 8.4 and 8.5, and keeps it that way.

Fix

UnexpectedResponseException::__construct() declared Throwable $previous = null. PHP 8.4 deprecated implicitly nullable parameters, so every client generated by api-client-generator raised an E_DEPRECATED on PHP 8.4+:

  • 2.1.0–2.3.0: on the first non-2xx response or undecodable body in each process
  • 2.0.0: on the first request of each process, because ResponseExceptionFactory loads the exception classes

The parameter is now ?Throwable $previous = null. The meaning and signature stay the same, and the ? syntax has worked since PHP 7.1 (this package requires ^7.4 || ^8.0). This is the only change in src/, so it qualifies as a patch release: 2.3.1, with a CHANGELOG entry.

Test tooling

  • PHPUnit 9.5.26 → 9.6.37 (lock only; ^9.5 is unchanged). 9.5.26 raises the same PHP 8.4+ deprecation inside PHPUnit itself, so the suite could not run deprecation-free on 8.5. The lock was resolved against PHP 7.4, so the 7.4/8.0/8.1 jobs still install from it.
  • convertDeprecationsToExceptions="true", so any future deprecation fails the build instead of being hidden.
  • New CI job: Tests on PHP 8.5.

Verification

  • PHP 8.5.10 lint of src/ and test/: the deprecation shows before the change and nothing shows after.
  • The suite passes on PHP 7.4, 8.1 and 8.5 with deprecations turned into exceptions (20 tests, 48 assertions), including an 8.5 run with pcov coverage enabled.
  • Runtime check of clients generated by api-client-generator 11.2.2 (targets 7.4, 8.1 and 8.3) on PHP 8.5: this package was the only source of deprecations, and there are none with this change.

🤖 Generated with Claude Code

tommey and others added 2 commits September 28, 2026 10:49
…tion

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PHPUnit 9.5.26 itself raises PHP 8.4+ implicit nullable deprecations,
so the suite could not run deprecation-free on PHP 8.5. The lock is
resolved against PHP 7.4 so every CI job still installs from it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@tommey
tommey merged commit eb57473 into master Sep 28, 2026
8 checks passed
@tommey
tommey deleted the feature/php-8.4-explicit-nullable branch September 28, 2026 09:26
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