diff --git a/src/Console/Command/UnusedCommand.php b/src/Console/Command/UnusedCommand.php index 9b662081..01e1e735 100644 --- a/src/Console/Command/UnusedCommand.php +++ b/src/Console/Command/UnusedCommand.php @@ -97,15 +97,24 @@ protected function configure(): void protected function execute(InputInterface $input, OutputInterface $output): int { + $io = new SymfonyStyle($input, $output); $composerJsonPath = $input->getArgument('composer-json'); if (!file_exists($composerJsonPath) && !is_readable($composerJsonPath)) { + $io->error( + sprintf( + 'composer.json on given path %s does not exist or is not readable.', + $composerJsonPath + ) + ); + return 1; } $composerJson = file_get_contents($composerJsonPath); if ($composerJson === false) { + $io->error('Unable to read contents from given composer.json'); return 1; } @@ -138,8 +147,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int ) ); - $io = new SymfonyStyle($input, $output); - foreach ($consumedSymbols as $symbol) { /** @var RequiredDependency $requiredDependency */ foreach ($requiredDependencyCollection as $requiredDependency) {