Skip to content

Commit

Permalink
fix phpstan
Browse files Browse the repository at this point in the history
  • Loading branch information
staabm committed Jun 23, 2023
1 parent 5e76f39 commit 39fe24d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/Console/Command/ProcessCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
8 changes: 5 additions & 3 deletions src/StaticReflection/DynamicSourceLocatorDecorator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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();
}
}

0 comments on commit 39fe24d

Please sign in to comment.