Skip to content

Commit

Permalink
fix(symfony): update for PHPUnit 10 (#5551)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
mbrodala and soyuka authored Apr 20, 2023
1 parent 79f5486 commit b6dc772
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
use PhpParser\Parser\Php7;
use PhpParser\PrettyPrinter\Standard;
use SebastianBergmann\Diff\Differ;
use SebastianBergmann\Diff\Output\UnifiedDiffOutputBuilder;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
Expand Down Expand Up @@ -215,7 +216,7 @@ private function getSubresources(): array
private function printDiff(string $oldCode, string $newCode, OutputInterface $output): void
{
$consoleFormatter = new ColorConsoleDiffFormatter();
$differ = new Differ();
$differ = class_exists(UnifiedDiffOutputBuilder::class) ? new Differ(new UnifiedDiffOutputBuilder()) : new Differ();
$diff = $differ->diff($oldCode, $newCode);
$output->write($consoleFormatter->format($diff));
}
Expand Down

0 comments on commit b6dc772

Please sign in to comment.