From ed051e288442bb9851001eb5501950c47da07d9c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Fri, 5 Aug 2022 09:31:56 +0200 Subject: [PATCH] Add parameter types to CryptoUtil --- .../install/files/lib/util/CryptoUtil.class.php | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/wcfsetup/install/files/lib/util/CryptoUtil.class.php b/wcfsetup/install/files/lib/util/CryptoUtil.class.php index 2c82d1f375..fd07dca618 100644 --- a/wcfsetup/install/files/lib/util/CryptoUtil.class.php +++ b/wcfsetup/install/files/lib/util/CryptoUtil.class.php @@ -21,10 +21,9 @@ final class CryptoUtil /** * Signs the given value with the signature secret. * - * @param string $value * @throws CryptoException */ - public static function getSignature($value): string + public static function getSignature(string $value): string { if (\mb_strlen(SIGNATURE_SECRET, '8bit') < 15) { throw new CryptoException('SIGNATURE_SECRET is too short, aborting.'); @@ -35,10 +34,8 @@ final class CryptoUtil /** * Creates a signed (signature + encoded value) string. - * - * @param string $value */ - public static function createSignedString($value): string + public static function createSignedString(string $value): string { return self::getSignature($value) . '-' . Base64::encode($value); } @@ -46,10 +43,8 @@ final class CryptoUtil /** * Returns whether the given string is a proper signed string. * (i.e. consists of a valid signature + encoded value) - * - * @param string $string */ - public static function validateSignedString($string): bool + public static function validateSignedString(string $string): bool { $parts = \explode('-', $string, 2); if (\count($parts) !== 2) { @@ -72,10 +67,9 @@ final class CryptoUtil * * - Returns null if the string is not properly signed. * - * @param string $string * @see \wcf\util\CryptoUtil::validateSignedString() */ - public static function getValueFromSignedString($string): ?string + public static function getValueFromSignedString(string $string): ?string { if (!self::validateSignedString($string)) { return null; -- 2.20.1