Skip to content

Commit b0b80ef

Browse files
Support sebastian/diff 9 (#93)
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.
1 parent 00ecae2 commit b0b80ef

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

src/Console/GenerateCommand.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
use Ruudk\GraphQLCodeGenerator\GraphQL\ThrowWhenNullDirectiveSchemaExtender;
1919
use Ruudk\GraphQLCodeGenerator\Planner;
2020
use SebastianBergmann\Diff\Differ;
21-
use SebastianBergmann\Diff\Output\UnifiedDiffOutputBuilder;
21+
use SebastianBergmann\Diff\Output\StrictUnifiedDiffOutputBuilder;
2222
use Symfony\Component\Console\Attribute\AsCommand;
2323
use Symfony\Component\Console\Attribute\Option;
2424
use Symfony\Component\Console\Command\Command;
@@ -180,7 +180,10 @@ public function __invoke(
180180

181181
$errors = false;
182182

183-
$differ = new Differ(new UnifiedDiffOutputBuilder("--- Actual\n+++ Expected\n"));
183+
$differ = new Differ(new StrictUnifiedDiffOutputBuilder([
184+
'fromFile' => 'Actual',
185+
'toFile' => 'Expected',
186+
]));
184187

185188
foreach ($files as $path => $content) {
186189
if (isset($actual[$path]) && $content !== $actual[$path]) {

0 commit comments

Comments
 (0)