Skip to content

Drop support of sebastian/diff below 5.1 - #88

Merged
janedbal merged 1 commit into
masterfrom
jn-drop-old-sebastian-diff
Oct 19, 2026
Merged

janedbal merged 1 commit into
masterfrom
jn-drop-old-sebastian-diff

Conversation

@janedbal

Copy link
Copy Markdown
Member

PatchParser called the old sebastian/diff API (getTo(), getChunks(), …) when the new API did not exist. Only sebastian/diff 4 and 5.0 need this, and PHPUnit 9 installs 4.

Changes

  • PatchParser uses only the API that sebastian/diff 5.1 to 9 share: to(), chunks(), end(), lines(), type(), content(). The method_exists() fallbacks and their PHPStan ignore are removed.
  • The dev constraint is ^5.1.1 || ^6.0 || ^7.0. CI never installed a version below 5.1, because PHPUnit 10.5 needs 5.1.1, so the fallbacks were never tested.
  • With an older version, --patch stops with you need sebastian/diff 5.1 or newer, 4.0.6 is installed instead of a fatal error. The other commands do not use sebastian/diff, so they still work with PHPUnit 9.
  • The README lists sebastian/diff 5.1+.

Relation to #87

#87 keeps the fallbacks and adds a path ignore for PatchParser with reportUnmatched: false, because sebastian/diff 6.0+ removed the old API. When #87 is merged, this PR gets a rebase that also removes that ignore. The PRs do not depend on each other, so they can merge in any order.

Testing

  • composer check passes.
  • Manual run with a real sebastian/diff 4.0.6: --patch shows the new error message.

Co-Authored-By: Claude Code

PatchParser now uses only the sebastian/diff API that 5.1 to 9 share:
to(), chunks(), end(), lines(), type() and content(). The method_exists()
fallbacks for the old API and their PHPStan ignore are removed.

CI never installed sebastian/diff below 5.1, because PHPUnit 10.5 needs
5.1.1. So the fallbacks were never tested. With an older version, --patch
now stops with a clear error instead of a fatal error. The other commands
do not use sebastian/diff and still work.

Co-Authored-By: Claude Code
@janedbal
janedbal merged commit b76127b into master Oct 19, 2026
31 checks passed
@janedbal
janedbal deleted the jn-drop-old-sebastian-diff branch October 19, 2026 15:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant