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; }