From 622e934f222acb535a4838d254093d0f8eac3de8 Mon Sep 17 00:00:00 2001 From: soyuka Date: Sat, 17 Sep 2022 18:06:39 +0200 Subject: [PATCH] fix(symfony): upgrade command requires phpunit fixes #4950 --- .../Bundle/Command/UpgradeApiResourceCommand.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/Core/Bridge/Symfony/Bundle/Command/UpgradeApiResourceCommand.php b/src/Core/Bridge/Symfony/Bundle/Command/UpgradeApiResourceCommand.php index d7d7c12cfb8..ca9bfb8ef34 100644 --- a/src/Core/Bridge/Symfony/Bundle/Command/UpgradeApiResourceCommand.php +++ b/src/Core/Bridge/Symfony/Bundle/Command/UpgradeApiResourceCommand.php @@ -89,6 +89,12 @@ protected function execute(InputInterface $input, OutputInterface $output): int return Command::INVALID; } + if (!class_exists(NodeTraverser::class)) { + $output->writeln('Run `composer require --dev `nikic/php-parser` or install phpunit to use this command.'); + + return Command::FAILURE; + } + $subresources = $this->getSubresources(); $prettyPrinter = new Standard(); @@ -142,6 +148,12 @@ protected function execute(InputInterface $input, OutputInterface $output): int continue; } + if (!class_exists(Differ::class)) { + $output->writeln('Run `composer require --dev sebastian/diff` or install phpunit to print a diff.'); + + return Command::FAILURE; + } + $this->printDiff($oldCode, $newCode, $output); continue; }