Skip to content

Commit 6debffd

Browse files
committed
Fixed scenario with zero analysed files
1 parent 2556918 commit 6debffd

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/Command/AnalyseCommand.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,13 @@ protected function execute(InputInterface $input, OutputInterface $output): int
217217
return 1;
218218
}
219219

220+
if (count($files) === 0) {
221+
$inceptionResult->getErrorOutput()->getStyle()->note('No files found to analyse.');
222+
$inceptionResult->getErrorOutput()->getStyle()->warning('This will cause a non-zero exit code in PHPStan 2.0.');
223+
224+
return $inceptionResult->handleReturn(0, null);
225+
}
226+
220227
/** @var AnalyseApplication $application */
221228
$application = $container->getByType(AnalyseApplication::class);
222229

0 commit comments

Comments
 (0)