show file on each step

This commit is contained in:
Tomas Votruba 2018-12-20 20:18:45 +01:00
parent aeb89aa464
commit febda514f5

View File

@ -86,7 +86,6 @@ final class RectorApplication
// 1. parse files to nodes
foreach ($fileInfos as $fileInfo) {
$this->advance();
$this->tryCatchWrapper($fileInfo, function (SmartFileInfo $smartFileInfo): void {
$this->fileProcessor->parseFileInfoToLocalCache($smartFileInfo);
});
@ -94,7 +93,6 @@ final class RectorApplication
// 2. change nodes with Rectors
foreach ($fileInfos as $fileInfo) {
$this->advance();
$this->tryCatchWrapper($fileInfo, function (SmartFileInfo $smartFileInfo): void {
$this->fileProcessor->refactor($smartFileInfo);
});
@ -104,26 +102,25 @@ final class RectorApplication
foreach ($fileInfos as $fileInfo) {
$this->tryCatchWrapper($fileInfo, function (SmartFileInfo $smartFileInfo): void {
$this->processFileInfo($smartFileInfo);
if ($this->symfonyStyle->isVerbose()) {
$this->symfonyStyle->writeln($smartFileInfo->getRealPath());
} else {
$this->symfonyStyle->progressAdvance();
}
});
}
$this->symfonyStyle->newLine(2);
}
private function advance(): void
private function advance(SmartFileInfo $smartFileInfo): void
{
if ($this->symfonyStyle->isVerbose() === false) {
if ($this->symfonyStyle->isVerbose()) {
$this->symfonyStyle->writeln($smartFileInfo->getRealPath());
} else {
$this->symfonyStyle->progressAdvance();
}
}
private function tryCatchWrapper(SmartFileInfo $smartFileInfo, callable $callback): void
{
$this->advance($smartFileInfo);
try {
if (in_array($smartFileInfo, $this->notParsedFiles, true)) {
// we cannot process this file