fix(meta): correct the Requires PHP floor to 7.4 and enforce it with PHPCompatibility - #28
Merged
Merged
Conversation
…PHPCompatibility plugin.php declared `Requires PHP: 7.0`, but general.php declares `ucsccomms_enqueue_admin_styles(): void` — a return type added in 7.1. On 7.0 that is a parse error, so the plugin fatalled on activation on the very version it advertised. `: void` is the only above-7.0 construct in the codebase, making the true floor 7.1. Nothing enforced the claim: no `require` php constraint, no config.platform.php, and the PHPCompatibilityWP block in .phpcs.xml.dist has been commented out since the ruleset was written. Sets the header to 7.4, adds phpcompatibility/phpcompatibility-wp to require-dev, and switches on the ruleset block with testVersion 7.4-. 7.4 over 8.1 is the conservative choice: safely true of the current code, widest install compatibility. Both are past EOL as of August 2026, so neither is an endorsement — the header states where the plugin parses and runs, not what to host on. `composer run lint` still exits 0; the new standard produced zero findings. Mutation-checked that the sniff actually fires: at testVersion 7.0- it reports NewReturnTypeDeclarations.voidFound on general.php:25, exactly the described bug. The floor is a runtime constraint, independent of the test toolchain — PHPUnit ^12.5 needs 8.3+ and CI runs 8.3/8.4, but PHPCompatibility proves 7.4 statically with no 7.4 runtime involved. Closes #25 Co-Authored-By: Claude Opus 5 (1M context) <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.
Closes #25.
The bug
plugin.phpdeclaredRequires PHP: 7.0, butlib/functions/general.phpdeclares:: voidis PHP 7.1+. On 7.0 that's a parse error, so the plugin fatalled on activation on the exact version it advertised. I checked the rest of the codebase —: voidis the only construct above 7.0 in all 204 lines, so the true floor was 7.1.Nothing enforced the claim either: no
requirephp constraint incomposer.json, noconfig.platform.php,"platform": {}in the lock, and thePHPCompatibilityWPblock in.phpcs.xml.distcommented out since the ruleset was first written.Changes
plugin.php—Requires PHP: 7.0→7.4.composer.json— addedphpcompatibility/phpcompatibility-wp: ^2.1torequire-dev..phpcs.xml.dist— replaced the commented-out block with a live one:7.4-form also catches constructs removed in later PHP, not just ones too new for the floor.composer.lock— refreshed (3 new dev packages; content hash updated so CI'scomposer installstays valid).Why 7.4 and not 8.1
Deliberate, per the issue's prompt to decide rather than default. 7.4 is the conservative claim: safely true of the current code, and it keeps the widest install compatibility. Worth noting both options are past EOL as of August 2026 — 7.4 since Nov 2022, 8.1 since Dec 2025 — so neither is an endorsement. The header states where the plugin parses and runs, not what anyone should be hosting on. Raising it later is a one-line change now that the sniff enforces it.
Verification
composer run lintexits 0 — the new standard produced zero findings against the plugin code.A clean run could equally mean the sniff silently isn't loading, so I mutation-checked it. Temporarily setting
testVersionto7.0-:That is precisely the bug this issue describes, so the enforcement is real and the floor is now machine-proven on every PR.
Runtime floor vs. test toolchain
Kept separate, as the issue asks. PHPUnit ^12.5 needs PHP 8.3+ and CI runs it on 8.3/8.4 — that doesn't weaken the 7.4 claim, because PHPCompatibility proves the floor statically, with no 7.4 runtime anywhere. No downgrade to PHPUnit 9.6.
Docs
CLAUDE.md— the Known quirks entry recording the contradiction is removed. Added a note under Commands → PHP thatRequires PHPandtestVersionare now a pair that must be changed together, since nothing else enforces the floor.ROADMAP.md— a "Resolved after the audit" record with cause, fix, and the 7.4 rationale.Acceptance criteria
Requires PHPmatches the actual minimum the code parses and runs on.PHPCompatibilityWPactive with a matchingtestVersion.composer run lintexits 0.🤖 Generated with Claude Code