mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
chore: Fix return values
Use constants instead of 0/1 Also fix PHPDoc to use correct return values. Co-authored-by: Carl Schwan <carl@carlschwan.eu> Signed-off-by: Micke Nordin <kano@sunet.se>
This commit is contained in:
parent
166bc2c74b
commit
d8cafa1ba5
5 changed files with 10 additions and 10 deletions
|
|
@ -33,10 +33,10 @@ class ActivateKey extends Base {
|
|||
$this->signatoryManager->activateStagedEd25519Key();
|
||||
} catch (\RuntimeException $e) {
|
||||
$output->writeln('<error>' . $e->getMessage() . '</error>');
|
||||
return 1;
|
||||
return self::FAILURE;
|
||||
}
|
||||
$output->writeln('<info>Staged key promoted to active.</info>');
|
||||
$output->writeln('Run <info>occ ocm:keys:retire</info> once any in-flight signatures using the previous key have been verified.');
|
||||
return 0;
|
||||
return self::SUCCESS;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,12 +35,12 @@ class ListKeys extends Base {
|
|||
$format = $input->getOption('output');
|
||||
if ($format === self::OUTPUT_FORMAT_JSON || $format === self::OUTPUT_FORMAT_JSON_PRETTY) {
|
||||
$output->writeln(json_encode($keys, $format === self::OUTPUT_FORMAT_JSON_PRETTY ? JSON_PRETTY_PRINT : 0));
|
||||
return 0;
|
||||
return self::SUCCESS;
|
||||
}
|
||||
|
||||
if ($keys === []) {
|
||||
$output->writeln('<comment>No Ed25519 keys yet; one will be generated on first OCM request.</comment>');
|
||||
return 0;
|
||||
return self::SUCCESS;
|
||||
}
|
||||
|
||||
$table = new Table($output);
|
||||
|
|
@ -49,6 +49,6 @@ class ListKeys extends Base {
|
|||
$table->addRow([$key['poolId'], $key['slot'] ?? '-', $key['kid']]);
|
||||
}
|
||||
$table->render();
|
||||
return 0;
|
||||
return self::SUCCESS;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,9 +33,9 @@ class RetireKey extends Base {
|
|||
$this->signatoryManager->retireEd25519Key();
|
||||
} catch (\RuntimeException $e) {
|
||||
$output->writeln('<error>' . $e->getMessage() . '</error>');
|
||||
return 1;
|
||||
return self::FAILURE;
|
||||
}
|
||||
$output->writeln('<info>Retiring key deleted.</info>');
|
||||
return 0;
|
||||
return self::SUCCESS;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,10 +33,10 @@ class StageKey extends Base {
|
|||
$signatory = $this->signatoryManager->stageEd25519Key();
|
||||
} catch (\RuntimeException $e) {
|
||||
$output->writeln('<error>' . $e->getMessage() . '</error>');
|
||||
return 1;
|
||||
return self::FAILURE;
|
||||
}
|
||||
$output->writeln('Staged new Ed25519 key: <info>' . $signatory->getKeyId() . '</info>');
|
||||
$output->writeln('Wait for federated peers to refresh their JWKS cache before activating.');
|
||||
return 0;
|
||||
return self::SUCCESS;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -294,7 +294,7 @@ class Rfc9421IncomingSignedRequest extends SignedRequest implements
|
|||
* lowercased name. Derived components (`@*`) are produced inside
|
||||
* {@see SignatureBase}; we only collect plain fields here.
|
||||
*
|
||||
* @return array<string, string>
|
||||
* @return array<lowercase-string, non-empty-string>
|
||||
*/
|
||||
private function collectHeaders(): array {
|
||||
$out = [];
|
||||
|
|
|
|||
Loading…
Reference in a new issue