Make occ command return an integer as return code

As of release 4.4, `symfony/console` requires commands to return
integers: https://github.com/symfony/console/commit/cdef5a4

Signed-off-by: Jonas Meurer <jonas@freesources.org>
This commit is contained in:
Jonas Meurer 2021-07-27 10:13:06 +02:00
Родитель 95159cbf25
Коммит 6190837414
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 5262E7FF491049FE
1 изменённых файлов: 9 добавлений и 3 удалений

Просмотреть файл

@ -47,7 +47,7 @@ class ResetDocument extends Command {
$this->sessionMapper = $sessionMapper;
}
protected function configure() {
protected function configure(): void {
$this
->setName('text:reset')
->setDescription('Reset a text document')
@ -68,15 +68,17 @@ class ResetDocument extends Command {
/**
* @param InputInterface $input
* @param OutputInterface $output
* @return void
* @return int
*/
protected function execute(InputInterface $input, OutputInterface $output) {
protected function execute(InputInterface $input, OutputInterface $output): int {
$fileId = $input->getArgument('file-id');
$fullReset = $input->getOption('full');
if ($fullReset) {
$output->writeln('Full document reset');
$this->documentService->resetDocument($fileId, true);
return 0;
} else {
$output->writeln('Trying to restore to last saved version');
$document = $this->documentMapper->find($fileId);
@ -86,9 +88,13 @@ class ResetDocument extends Command {
$this->documentMapper->update($document);
$this->sessionMapper->deleteByDocumentId($fileId);
$output->writeln('Reverted document to the last saved version');
return 0;
} else {
$output->writeln('Failed revert changes that are newer than the last saved version');
}
return 1;
}
}
}