From: Tim Düsterhus Date: Fri, 5 Aug 2022 07:31:56 +0000 (+0200) Subject: Add parameter types to CryptoUtil X-Git-Tag: 6.0.0_Alpha_1~1076^2~1 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=ed051e288442bb9851001eb5501950c47da07d9c;p=GitHub%2FWoltLab%2FWCF.git Add parameter types to CryptoUtil --- 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;