Repository navigation
Fix implicit nullable parameters deprecated in PHP 8.4 - #4
Merged
Merged
Conversation
ScopesMapper::__construct(Scopes $defaultScopes = null) and ItemsListResponse::__construct(..., int $total = null) are implicitly nullable, which PHP 8.4 reports as deprecated whenever the class loads. The suite never noticed: PHPUnit 9 does not fail on deprecations by default. Downstream, grinchenkoedu/registries prints the notice from inside its tests and fails its PHP 8.4 CI job on it. Both are now explicitly nullable (?Scopes, ?int) — no behaviour change. phpunit.xml sets convertDeprecationsToExceptions="true": before the fix the suite errored 15 times on PHP 8.4; after it, OK (46 tests, 297 assertions) on PHP 7.4, 8.4 and 8.5. Co-Authored-By: Claude Opus 5.5 <[email protected]>
setup-php loads php.ini-production (`ini-file: production` in the job logs), whose error_reporting leaves out E_DEPRECATED, and PHPUnit 9 only converts errors that error_reporting includes. So the guard never fired in CI: with ScopesMapper's fix reverted, the suite at CI's level (E_ALL & ~E_DEPRECATED & ~E_STRICT) gave OK (46 tests, 297 assertions). With error_reporting=-1 set in phpunit.xml it gives Errors: 15, and the fixed code stays OK (46 tests, 297 assertions). Co-Authored-By: Claude Opus 5.5 <[email protected]>
.tasks/ holds local plans and briefs, .claude/repo-profile.json one developer's machine profile, and .gku/ local review reports and notes. None of them belongs in the repository. The new lines use CRLF, like the rest of the file. Co-Authored-By: Claude Opus 5.5 <[email protected]>
ReflectionType::__toString() is deprecated on PHP 7.4 (8.0 lifted the deprecation). With the deprecation guard now active in CI, the PHP 7.4 job failed with 5 errors from ClientFactoryTest.php:96. getName() compares the class names themselves, which is what the test is about. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Tagged and released on 2026-09-27. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
What and why
ScopesMapper::__construct(Scopes $defaultScopes = null)andItemsListResponse::__construct(array $items = [], int $total = null)declare implicitly nullable parameters. PHP 8.4 reports this as deprecated every time either class loads.This library's suite never saw it, because PHPUnit 9 does not fail on deprecations by default. Downstream it does fail: grinchenkoedu/registries prints the notice from inside its tests, and its PHP 8.4 CI job fails under
failOnRisky. That is the last cause left in registries#64.How
?Scopes,?int). No behaviour change.phpunit.xmlsetsconvertDeprecationsToExceptions="true", so the next deprecation fails this CI instead of a downstream one. The file keeps its CRLF line endings; the change is one line.Testing
composer:ltsimage) gaveTests: 46, Assertions: 121, Errors: 15, all fromScopesMapper.php:15.OK (46 tests, 297 assertions).OK (46 tests, 297 assertions).src/ortests/(grep).Notes
2.0.1 — unreleasedentry. Once this is merged, tag 2.0.1 so registries can require^2.0.1when it moves to 2.0 (its Phase B, step 6).Update after review
The guard now fires in CI (
ad97ede).setup-phploads the production php.ini (ini-file: productionin the job logs), whoseerror_reportingleaves outE_DEPRECATED, and PHPUnit 9 only converts errors thaterror_reportingincludes. SoconvertDeprecationsToExceptionshad no effect in CI. With theScopesMapperfix reverted, the suite at CI's level passed:OK (46 tests, 297 assertions).phpunit.xmlnow setserror_reportingto-1. At CI's level, the unfixed code now givesErrors: 15and the fixed codeOK (46 tests, 297 assertions)..gitignore(218a24b): ignores.tasks/,.claude/repo-profile.jsonand.gku/, which are local plans and tool state. CRLF, like the rest of the file.First catch (
55ecd8a): once the guard was active, the PHP 7.4 job failed with 5 errors.ClientFactoryTestcastReflectionTypeto a string, which is deprecated on 7.4 only. It now usesgetName(). All 7 PHP jobs pass on55ecd8a.