From 1550d9cce3e28f3d44ba3c65bf416abc66543a00 Mon Sep 17 00:00:00 2001 From: Orest Divintari Date: Mon, 3 Aug 2026 22:22:33 +0200 Subject: [PATCH] Support sebastian/diff 9 UnifiedDiffOutputBuilder was removed in sebastian/diff 9.0.0, while the constraint here already allows ^9. Installing that version makes --ensure-sync fatal with "Class UnifiedDiffOutputBuilder not found" before it compares a single file. StrictUnifiedDiffOutputBuilder renders the same header through fromFile and toFile, and both options exist in ^7, ^8 and ^9, so the constraint can stay as it is. --- src/Console/GenerateCommand.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Console/GenerateCommand.php b/src/Console/GenerateCommand.php index bc71275..d287d41 100644 --- a/src/Console/GenerateCommand.php +++ b/src/Console/GenerateCommand.php @@ -18,7 +18,7 @@ use Ruudk\GraphQLCodeGenerator\GraphQL\ThrowWhenNullDirectiveSchemaExtender; use Ruudk\GraphQLCodeGenerator\Planner; use SebastianBergmann\Diff\Differ; -use SebastianBergmann\Diff\Output\UnifiedDiffOutputBuilder; +use SebastianBergmann\Diff\Output\StrictUnifiedDiffOutputBuilder; use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Attribute\Option; use Symfony\Component\Console\Command\Command; @@ -180,7 +180,10 @@ public function __invoke( $errors = false; - $differ = new Differ(new UnifiedDiffOutputBuilder("--- Actual\n+++ Expected\n")); + $differ = new Differ(new StrictUnifiedDiffOutputBuilder([ + 'fromFile' => 'Actual', + 'toFile' => 'Expected', + ])); foreach ($files as $path => $content) { if (isset($actual[$path]) && $content !== $actual[$path]) {