diff --git a/src/Console/Command/ProcessCommand.php b/src/Console/Command/ProcessCommand.php index 06c816ddfb7..e03d96d23e0 100644 --- a/src/Console/Command/ProcessCommand.php +++ b/src/Console/Command/ProcessCommand.php @@ -71,7 +71,8 @@ protected function execute(InputInterface $input, OutputInterface $output): int $paths = $configuration->getPaths(); // 1. add files and directories to static locator - if ($this->dynamicSourceLocatorDecorator->addPaths($paths) === false) { + $this->dynamicSourceLocatorDecorator->addPaths($paths); + if ($this->dynamicSourceLocatorDecorator->isPathsEmpty()) { $this->rectorOutputStyle->error("The given paths do not match any files"); return ExitCode::FAILURE; } diff --git a/src/StaticReflection/DynamicSourceLocatorDecorator.php b/src/StaticReflection/DynamicSourceLocatorDecorator.php index 767abb4be7f..0d71749c082 100644 --- a/src/StaticReflection/DynamicSourceLocatorDecorator.php +++ b/src/StaticReflection/DynamicSourceLocatorDecorator.php @@ -24,10 +24,10 @@ public function __construct( /** * @param string[] $paths */ - public function addPaths(array $paths): bool + public function addPaths(array $paths): void { if ($paths === []) { - return false; + return; } $files = $this->fileAndDirectoryFilter->filterFiles($paths); @@ -38,7 +38,9 @@ public function addPaths(array $paths): bool $filesInDirectory = $this->phpFilesFinder->findInPaths([$directory]); $this->dynamicSourceLocatorProvider->addFilesByDirectory($directory, $filesInDirectory); } + } - return !$this->dynamicSourceLocatorProvider->isPathsEmpty(); + public function isPathsEmpty(): bool { + return $this->dynamicSourceLocatorProvider->isPathsEmpty(); } }