Skip to content

Commit

Permalink
[TASK] Output error message for file
Browse files Browse the repository at this point in the history
  • Loading branch information
sabbelasichon committed May 15, 2021
1 parent 037cfd4 commit c24fd2d
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/Application/FileProcessor/PhpFileProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ public function process(array $files): void

// cannot print file with errors, as print would break everything to original nodes
if ($file->hasErrors()) {
$this->printFileErrors($file);
$this->advance($file, 'printing skipped due error');
continue;
}
Expand Down Expand Up @@ -228,4 +229,19 @@ private function advance(File $file, string $phase): void
$this->symfonyStyle->progressAdvance();
}
}

private function printFileErrors(File $file): void
{
if(!$this->symfonyStyle->isVerbose()) {
return;
}

if(!$file->hasErrors()) {
return;
}

foreach ($file->getErrors() as $error) {
$this->symfonyStyle->error($error->getMessage());
}
}
}

0 comments on commit c24fd2d

Please sign in to comment.