Skip to content

Commit d7f99f7

Browse files
Runner class should know when stop (moves catch FailOnFirstViolationException) (#483)
1 parent 9be0982 commit d7f99f7

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

src/CLI/Command/Check.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
use Arkitect\CLI\Progress\ProgressBarProgress;
1111
use Arkitect\CLI\Runner;
1212
use Arkitect\CLI\TargetPhpVersion;
13-
use Arkitect\Exceptions\FailOnFirstViolationException;
1413
use Arkitect\Rules\ParsingErrors;
1514
use Arkitect\Rules\Violations;
1615
use Symfony\Component\Console\Command\Command;
@@ -150,10 +149,8 @@ protected function execute(InputInterface $input, OutputInterface $output): int
150149
$this->readRules($config, $rulesFilename);
151150

152151
$runner = new Runner($stopOnFailure);
153-
try {
154-
$runner->run($config, $progress, $targetPhpVersion, $onlyErrors);
155-
} catch (FailOnFirstViolationException $e) {
156-
}
152+
$runner->run($config, $progress, $targetPhpVersion, $onlyErrors);
153+
157154
$violations = $runner->getViolations();
158155
$violations->sort();
159156

src/CLI/Runner.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,11 @@ public function run(Config $config, Progress $progress, TargetPhpVersion $target
4141
$progress->startFileSetAnalysis($classSetRule->getClassSet());
4242
}
4343

44-
$this->check($classSetRule, $progress, $fileParser, $this->violations, $this->parsingErrors, $onlyErrors);
44+
try {
45+
$this->check($classSetRule, $progress, $fileParser, $this->violations, $this->parsingErrors, $onlyErrors);
46+
} catch (FailOnFirstViolationException $e) {
47+
return;
48+
}
4549

4650
if (!$onlyErrors) {
4751
$progress->endFileSetAnalysis($classSetRule->getClassSet());

0 commit comments

Comments
 (0)