Fix PHP 7.4 compatibility broken by \Stringable interface#1810
Merged
Fix PHP 7.4 compatibility broken by \Stringable interface#1810
Conversation
The `\Stringable` interface was added in commit 356cc4e by php-cs-fixer 3.91.2. This interface only exists in PHP 8+, breaking PHP 7.4 compatibility. This commit: - Removes explicit `\Stringable` declarations from Type, Node, and Error classes (PHP 8+ auto-recognizes __toString() methods anyway) - Changes autofix.yml to run php-cs-fixer on PHP 7.4 to prevent future recurrence Fixes #1809 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This ensures the fixer won't add PHP 8+ only interfaces like \Stringable. Uses a custom Docker image with PHP 7.4 + composer to install dependencies in an isolated volume, preventing conflicts with host PHP 8.x vendor/. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This ensures `composer fix` uses the Docker-based php-cs-fixer setup, keeping CONTRIBUTING.md instructions accurate while preventing PHP 8+ only syntax from being added. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- PHP 7.4: most files (avoids adding \Stringable) - PHP 8.0: Deprecated.php, Description.php (attributes) - PHP 8.1: PhpEnumType.php and tests (enums) Makefile is single source of truth, CI calls make php-cs-fixer. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <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.
Summary
\Stringableinterface declarations fromType,Node, andErrorclassesautofix.ymlto run php-cs-fixer on PHP 7.4 to prevent future recurrenceBackground
The
\Stringableinterface was added in commit 356cc4e by php-cs-fixer 3.91.2 update. This interface only exists in PHP 8+, breaking PHP 7.4 compatibility which is still officially supported percomposer.json.The fix simply removes the explicit interface declaration - PHP 8+ automatically recognizes classes with
__toString()methods as implementingStringableanyway.To prevent recurrence, we change the autofix workflow to run php-cs-fixer on PHP 7.4 instead of PHP 8.3. Since
\Stringabledoesn't exist in PHP 7.4, the fixer won't add it.Test plan
Resolves #1809
🤖 Generated with Claude Code