Support PHP 8.0–8.5#20
Merged
Merged
Conversation
Widen the PHP requirement from `^7.4` to `^7.4 || ^8.0` so the library can be installed on PHP 8.0 through 8.5. Two changes required for PHP 8.4+ deprecation cleanliness: the constructors of `Terminal`, `DiffConsoleOutput`, and `ConsoleDiff` each took a parameter typed `T $param = null`, which PHP 8.4 deprecates as an implicit-nullable. Made the nullability explicit with the leading `?` (`?T $param = null`). The change is forward- compatible with PHP 7.4. CI matrix expanded to run `highest` resolution against PHP 7.4, 8.0, 8.1, 8.2, 8.3, 8.4, 8.5. The `lowest` (`--prefer-lowest`) matrix entry stays pinned to PHP 7.4 only -- it tests the floor of each dependency, which lives at PHP 7.4 (e.g. symfony/console 3.4 and mockery 1.3 don't run on PHP 8.x, even though composer would otherwise happily install them under `--prefer-lowest` because their composer.json declares no upper PHP bound). Verified locally on PHP 7.4 (Docker) and PHP 8.5 (host): phpcs clean, 112 PHPUnit tests pass under both. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR broadens the package’s declared PHP support to include PHP 8.x and updates constructor signatures to avoid PHP 8.4 implicit-nullable deprecations.
Changes:
- Widened Composer PHP requirement from PHP 7.4 only to PHP 7.4 or PHP 8.x.
- Added explicit nullable type declarations for constructor parameters that default to
null. - Expanded CI to run highest-dependency tests across PHP 7.4–8.5, while keeping lowest-dependency testing on PHP 7.4.
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
composer.json |
Widens the package PHP requirement. |
composer.lock |
Updates lockfile metadata for the widened PHP platform constraint. |
.github/workflows/ci.yml |
Expands CI PHP matrix and keeps lowest dependency job on PHP 7.4. |
src/Terminal/Terminal.php |
Makes nullable constructor parameters explicit. |
src/DiffConsoleOutput.php |
Makes nullable constructor parameters explicit. |
src/Diff/ConsoleDiff.php |
Makes nullable constructor parameter explicit. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Copilot review on PR #20 noted that composer.json's `config.platform.php = 7.4` propagates into the CI jobs, so even the PHP 8.x matrix entries were resolving dependencies as if running on PHP 7.4 -- they were validating "7.4-compatible deps happen to run on 8.x", not "what an 8.x user would install". Add a step before `ramsey/composer-install` that runs `composer config platform.php ${{ matrix.php }}`, overriding the pin per matrix entry. The pin stays at 7.4 in composer.json itself for local-dev lock determinism. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This was referenced May 28, 2026
Closed
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
Widens the PHP requirement from
^7.4to^7.4 || ^8.0so the library can be installed on PHP 8.0 through 8.5.Changes
composer.jsonphp:^7.4→^7.4 || ^8.0src/Terminal/Terminal.php,src/DiffConsoleOutput.php,src/Diff/ConsoleDiff.php?to nullable constructor parameters (?T $param = nullinstead ofT $param = null).github/workflows/ci.ymlhighestruns on PHP 7.4, 8.0, 8.1, 8.2, 8.3, 8.4, 8.5;loweststays pinned to PHP 7.4 onlysymfony/console 3.4andmockery 1.3don't run on PHP 8.x). Running--prefer-loweston PHP 8 would happily install those — composer doesn't reject them since their composer.json has no upper PHP bound — but they'd fail at runtime. Restrictinglowestto 7.4 tests what we actually care aboutcomposer.lockVerification
Verified locally on PHP 7.4 (Docker
graze/php-alpine:7.4-test) and PHP 8.5 (host):phpcsclean, 112 PHPUnit tests pass under both.🤖 Generated with Claude Code