[ProcessCommand] print limited number of files, not to break apps

This commit is contained in:
TomasVotruba 2017-10-03 12:39:02 +02:00
parent 6d2665f00d
commit 9ff9d377c6

View File

@ -20,6 +20,11 @@ final class ProcessCommand extends Command
*/
private const ARGUMENT_SOURCE_NAME = 'source';
/**
* @var int
*/
private const MAX_FILES_TO_PRINT = 30;
/**
* @var FileProcessor
*/
@ -76,12 +81,28 @@ final class ProcessCommand extends Command
$this->reportLoadedRectors();
$this->symfonyStyle->title('Processing files');
$i = 0;
foreach ($files as $file) {
$this->symfonyStyle->writeln(sprintf(
' - %s',
$file
));
if ($i < self::MAX_FILES_TO_PRINT) {
$this->symfonyStyle->writeln(sprintf(
' - %s',
$file
));
}
if ($i === self::MAX_FILES_TO_PRINT) {
$this->symfonyStyle->newLine();
$this->symfonyStyle->writeln(sprintf(
'...and %d more.',
count($files) - self::MAX_FILES_TO_PRINT
));
$this->symfonyStyle->newLine();
}
$this->fileProcessor->processFile($file);
$i++;
}
$this->symfonyStyle->success('Rector is done!');