Skip to content

Commit b6dc772

Browse files
mbrodalasoyuka
andauthored
fix(symfony): update for PHPUnit 10 (#5551)
* fix(symfony): update for PHPUnit 10 The Differ now expects a output builder as mandatory argument. Fixes #5426 * support many phpunit versions --------- Co-authored-by: Antoine Bluchet <[email protected]>
1 parent 79f5486 commit b6dc772

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Core/Bridge/Symfony/Bundle/Command/UpgradeApiResourceCommand.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
use PhpParser\Parser\Php7;
3232
use PhpParser\PrettyPrinter\Standard;
3333
use SebastianBergmann\Diff\Differ;
34+
use SebastianBergmann\Diff\Output\UnifiedDiffOutputBuilder;
3435
use Symfony\Component\Console\Attribute\AsCommand;
3536
use Symfony\Component\Console\Command\Command;
3637
use Symfony\Component\Console\Input\InputInterface;
@@ -215,7 +216,7 @@ private function getSubresources(): array
215216
private function printDiff(string $oldCode, string $newCode, OutputInterface $output): void
216217
{
217218
$consoleFormatter = new ColorConsoleDiffFormatter();
218-
$differ = new Differ();
219+
$differ = class_exists(UnifiedDiffOutputBuilder::class) ? new Differ(new UnifiedDiffOutputBuilder()) : new Differ();
219220
$diff = $differ->diff($oldCode, $newCode);
220221
$output->write($consoleFormatter->format($diff));
221222
}

0 commit comments

Comments
 (0)