From 0581d265bfbdc3ed0827072daf70893953417256 Mon Sep 17 00:00:00 2001 From: Demin Yin Date: Mon, 11 Dec 2023 11:58:32 -0800 Subject: [PATCH] improvements on class SwooleLibrary --- src/functions.php | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/functions.php b/src/functions.php index 628b503..a29be44 100644 --- a/src/functions.php +++ b/src/functions.php @@ -32,25 +32,31 @@ function _array(array $array = []): Swoole\ArrayObject class SwooleLibrary { - public static $options = []; + /** + * @var array + */ + public static array $options = []; } -function swoole_library_set_options(array $options) +/** + * @param array $options + */ +function swoole_library_set_options(array $options): void { SwooleLibrary::$options = $options; } -function swoole_library_get_options() +function swoole_library_get_options(): array { return SwooleLibrary::$options; } -function swoole_library_set_option(string $key, $value) +function swoole_library_set_option(string $key, mixed $value): void { SwooleLibrary::$options[$key] = $value; } -function swoole_library_get_option(string $key) +function swoole_library_get_option(string $key): mixed { return SwooleLibrary::$options[$key] ?? null; }