Skip to content

Commit

Permalink
ExplainCommand: use constants for return codes
Browse files Browse the repository at this point in the history
  • Loading branch information
mabar committed Mar 11, 2024
1 parent 8d533fb commit fdc5636
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/Command/ExplainCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
{
$options = $this->validateOptions($input, $output);
if ($options === null) {
return 1;
return self::FAILURE;
}

$id = $options['id'];
Expand Down Expand Up @@ -182,10 +182,10 @@ private function explainExpression(
} catch (InvalidExpression $exception) {
$output->writeln("<error>{$exception->getMessage()}</error>");

return 1;
return self::FAILURE;
}

return 0;
return self::SUCCESS;
}

private function explainJobWithId(string $id, OutputInterface $output): int
Expand All @@ -196,7 +196,7 @@ private function explainJobWithId(string $id, OutputInterface $output): int
if ($jobSchedule === null) {
$output->writeln("<error>Job with id '$id' does not exist.</error>");

return 1;
return self::FAILURE;
}

$output->writeln($this->explainer->explain(
Expand All @@ -205,7 +205,7 @@ private function explainJobWithId(string $id, OutputInterface $output): int
$this->computeTimeZone($jobSchedule, $this->clock->now()->getTimezone()),
));

return 0;
return self::SUCCESS;
}

private function computeTimeZone(JobSchedule $jobSchedule, DateTimeZone $renderedTimeZone): ?DateTimeZone
Expand Down Expand Up @@ -271,7 +271,7 @@ private function explainSyntax(OutputInterface $output): int
CMD,
);

return 0;
return self::SUCCESS;
}

}

0 comments on commit fdc5636

Please sign in to comment.