Skip to content
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
mpyw merged 2 commits into
masterfrom
claude/version-up
Jun 13, 2026
Merged

[Claude] Constrain to sebastian/comparator <8.2 (support 8.0/8.1, document #158 upstream fix)#7
mpyw merged 2 commits into
masterfrom
claude/version-up

Conversation

@mpyw

@mpyw mpyw commented Jun 13, 2026

Copy link
Copy Markdown
Owner

Summary

Constrain sebastian/comparator to <8.2 — the precise boundary of versions that still need this patch — and make the override work on comparator 8.0/8.1.

Background (verified)

sebastian/comparator 8.2.0 fixed the exact problem this package works around — sebastianbergmann/comparator#158. Confirmed against the upstream source:

comparator __serialize/__unserialize on ComparisonFailure needs this patch
^1^7 none
8.0, 8.1 none
>=8.2 present (the fix)

So the versions lacking the fix are exactly <8.2.

Changes

  • composer.jsonsebastian/comparator^1.0 || … || ^7.0 || >=8.0 <8.2. 8.2+ is excluded so this package never overrides the upstream-fixed ComparisonFailure (it replaces the class via exclude-from-classmap).
  • files/ComparisonFailure.phpsebastian/diff >=8 (pulled in by comparator ^8) added an emitNoLineEndEofWarning constructor argument that defaults to true, injecting \ No newline at end of file markers into the diff and breaking the expected output. Detect that argument via reflection and pass false; older diff releases keep the existing 1-argument construction.
  • README — document the upstream fix and the <8.2 boundary.

Verification (local)

Override confirmed active (loaded from files/) and the test suite passes on:

  • comparator 7.1.8 + diff 7.0 + PHPUnit 12 (1-arg builder path)
  • comparator 8.1.4 + diff 8.3 + PHPUnit 13 (reflection → emitNoLineEndEofWarning=false path)

(Supersedes the earlier attempt to add ^8.0 blanket support, which both clobbered the 8.2+ upstream fix and mis-configured the diff builder.)

🤖 This PR was automatically created by Claude

@mpyw mpyw force-pushed the claude/version-up branch from 0e379d2 to 76d6065 Compare June 13, 2026 03:55
@mpyw mpyw changed the title [Claude] Support sebastian/comparator ^8.0 [Claude] Document that sebastian/comparator >=8.2 fixes this upstream (#158) Jun 13, 2026
@mpyw mpyw force-pushed the claude/version-up branch from 76d6065 to 22be25e Compare June 13, 2026 04:15
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>
@mpyw mpyw force-pushed the claude/version-up branch from 22be25e to 80f5bce Compare June 13, 2026 04:19
@mpyw mpyw changed the title [Claude] Document that sebastian/comparator >=8.2 fixes this upstream (#158) [Claude] Constrain to sebastian/comparator <8.2 (support 8.0/8.1, document #158 upstream fix) Jun 13, 2026
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>
@mpyw mpyw merged commit 04b0481 into master Jun 13, 2026
42 checks passed
@mpyw mpyw deleted the claude/version-up branch June 13, 2026 04:30
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant