Skip to content

Commit 3e29348

Browse files
committed
Finish it off
1 parent 301a791 commit 3e29348

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

src/Console/FixCommand.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,7 @@ public function handle()
7373
$this->fixerService->fixFiles();
7474
$this->fixerService->printLegend();
7575
$this->fixerService->report($this->verbosity, $this->output);
76-
77-
$this->info('Completed');
76+
return $this->fixerService->exitStatus();
7877
}
7978

8079
protected function verbocityAndValidation()

src/Services/Fixer/Concerns/HasFixEvent.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace STS\Fixer\Services\Fixer\Concerns;
44

5+
use PhpCsFixer\Console\Command\FixCommandExitStatusCalculator;
56
use PhpCsFixer\Console\Report\FixReport\ReportSummary;
67
use Symfony\Component\Console\Output\OutputInterface;
78

@@ -41,4 +42,17 @@ public function report(int $verbosity, OutputInterface $output)
4142
$this->getErrorOutput($output)->listErrors('linting after fixing', $this->getErrorsManager()->getLintErrors());
4243
}
4344
}
45+
46+
public function exitStatus()
47+
{
48+
$exitStatusCalculator = new FixCommandExitStatusCalculator();
49+
50+
return $exitStatusCalculator->calculate(
51+
$this->configResolver->isDryRun(),
52+
\count($this->filesModified) > 0,
53+
\count($this->getErrorsManager()->getInvalidErrors()) > 0,
54+
\count($this->getErrorsManager()->getExceptionErrors()) > 0,
55+
\count($this->getErrorsManager()->getLintErrors()) > 0
56+
);
57+
}
4458
}

0 commit comments

Comments
 (0)