From d8cafa1ba5a53095d09cd0f91477d5388c8d3a9b Mon Sep 17 00:00:00 2001 From: Micke Nordin Date: Mon, 11 May 2026 11:37:09 +0200 Subject: [PATCH] chore: Fix return values Use constants instead of 0/1 Also fix PHPDoc to use correct return values. Co-authored-by: Carl Schwan Signed-off-by: Micke Nordin --- core/Command/OCM/ActivateKey.php | 4 ++-- core/Command/OCM/ListKeys.php | 6 +++--- core/Command/OCM/RetireKey.php | 4 ++-- core/Command/OCM/StageKey.php | 4 ++-- .../Signature/Model/Rfc9421IncomingSignedRequest.php | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/core/Command/OCM/ActivateKey.php b/core/Command/OCM/ActivateKey.php index 090538e0024..9efc7110a24 100644 --- a/core/Command/OCM/ActivateKey.php +++ b/core/Command/OCM/ActivateKey.php @@ -33,10 +33,10 @@ class ActivateKey extends Base { $this->signatoryManager->activateStagedEd25519Key(); } catch (\RuntimeException $e) { $output->writeln('' . $e->getMessage() . ''); - return 1; + return self::FAILURE; } $output->writeln('Staged key promoted to active.'); $output->writeln('Run occ ocm:keys:retire once any in-flight signatures using the previous key have been verified.'); - return 0; + return self::SUCCESS; } } diff --git a/core/Command/OCM/ListKeys.php b/core/Command/OCM/ListKeys.php index f73a4763111..221beca5580 100644 --- a/core/Command/OCM/ListKeys.php +++ b/core/Command/OCM/ListKeys.php @@ -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('No Ed25519 keys yet; one will be generated on first OCM request.'); - 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; } } diff --git a/core/Command/OCM/RetireKey.php b/core/Command/OCM/RetireKey.php index 58db976077c..8a3c23d29c1 100644 --- a/core/Command/OCM/RetireKey.php +++ b/core/Command/OCM/RetireKey.php @@ -33,9 +33,9 @@ class RetireKey extends Base { $this->signatoryManager->retireEd25519Key(); } catch (\RuntimeException $e) { $output->writeln('' . $e->getMessage() . ''); - return 1; + return self::FAILURE; } $output->writeln('Retiring key deleted.'); - return 0; + return self::SUCCESS; } } diff --git a/core/Command/OCM/StageKey.php b/core/Command/OCM/StageKey.php index 75437f460bf..f79d09c876a 100644 --- a/core/Command/OCM/StageKey.php +++ b/core/Command/OCM/StageKey.php @@ -33,10 +33,10 @@ class StageKey extends Base { $signatory = $this->signatoryManager->stageEd25519Key(); } catch (\RuntimeException $e) { $output->writeln('' . $e->getMessage() . ''); - return 1; + return self::FAILURE; } $output->writeln('Staged new Ed25519 key: ' . $signatory->getKeyId() . ''); $output->writeln('Wait for federated peers to refresh their JWKS cache before activating.'); - return 0; + return self::SUCCESS; } } diff --git a/lib/private/Security/Signature/Model/Rfc9421IncomingSignedRequest.php b/lib/private/Security/Signature/Model/Rfc9421IncomingSignedRequest.php index 3af3f7c0f8d..7e93da4ebbf 100644 --- a/lib/private/Security/Signature/Model/Rfc9421IncomingSignedRequest.php +++ b/lib/private/Security/Signature/Model/Rfc9421IncomingSignedRequest.php @@ -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 + * @return array */ private function collectHeaders(): array { $out = [];