This repository was archived by the owner on Jun 13, 2026. It is now read-only.
[Claude] Constrain to sebastian/comparator <8.2 (support 8.0/8.1, document #158 upstream fix)#7
Merged
Merged
Conversation
sebastian/comparator 8.2.0 fixed the serialization problem this package works around (sebastianbergmann/comparator#158): ComparisonFailure gained __serialize()/__unserialize() so it survives process-isolation transport even when the stack trace holds non-serializable objects (e.g. a PDO argument). comparator 8.0/8.1 still lack that fix. - composer.json: extend `sebastian/comparator` to `... || >=8.0 <8.2`. This is the precise boundary — every version *without* the upstream fix. 8.2+ is excluded so this package never overrides the upstream-fixed class (it replaces ComparisonFailure via exclude-from-classmap). - files/ComparisonFailure.php: sebastian/diff >=8 (pulled by comparator ^8) added an `emitNoLineEndEofWarning` ctor arg defaulting to true, which injects "\ No newline at end of file" markers into the diff. Detect that arg via reflection and pass false; older diff releases keep the existing 1-argument construction. Verified locally: tests pass on comparator 7.1.8 (diff 7.0) and 8.1.4 (diff 8.3). - README: document the upstream fix and the <8.2 boundary. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The default `composer require phpunit/phpunit` only ever resolves the highest comparator allowed (8.1 on PHP 8.4/8.5), so comparator 8.0 was never exercised. Add matrix entries that pin `sebastian/comparator` to `8.0.*` and `8.1.*` (PHP 8.4/8.5; comparator 8 requires PHP >= 8.4) and a guarded step that pins the version before installing PHPUnit, so the `>=8.0 <8.2` support range is actually covered by CI. Also surface sebastian/diff in the installed-versions printout. Co-Authored-By: Claude Opus 4.8 (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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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
Constrain
sebastian/comparatorto<8.2— the precise boundary of versions that still need this patch — and make the override work on comparator8.0/8.1.Background (verified)
sebastian/comparator8.2.0 fixed the exact problem this package works around — sebastianbergmann/comparator#158. Confirmed against the upstream source:__serialize/__unserializeonComparisonFailure^1–^78.0,8.1>=8.2So the versions lacking the fix are exactly
<8.2.Changes
sebastian/comparator→^1.0 || … || ^7.0 || >=8.0 <8.2.8.2+is excluded so this package never overrides the upstream-fixedComparisonFailure(it replaces the class viaexclude-from-classmap).sebastian/diff >=8(pulled in by comparator^8) added anemitNoLineEndEofWarningconstructor argument that defaults totrue, injecting\ No newline at end of filemarkers into the diff and breaking the expected output. Detect that argument via reflection and passfalse; olderdiffreleases keep the existing 1-argument construction.<8.2boundary.Verification (local)
Override confirmed active (loaded from
files/) and the test suite passes on:emitNoLineEndEofWarning=falsepath)(Supersedes the earlier attempt to add
^8.0blanket support, which both clobbered the 8.2+ upstream fix and mis-configured the diff builder.)🤖 This PR was automatically created by Claude