From e5be4e97ffc41ca3b0386651a626b781a3637a85 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Fri, 6 Oct 2023 18:26:22 +0200 Subject: Update for PHP 8.2 --- inc/message.inc.php | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'inc/message.inc.php') diff --git a/inc/message.inc.php b/inc/message.inc.php index 7decc12..67f7b08 100644 --- a/inc/message.inc.php +++ b/inc/message.inc.php @@ -2,31 +2,31 @@ class Message { - private static $list = array(); - private static $alreadyDisplayed = array(); - private static $flushed = false; + private static array $list = array(); + private static array $alreadyDisplayed = array(); + private static bool $flushed = false; /** * Add error message to page. If messages have not been flushed * yet, it will be added to the queue, otherwise it will be added * in place during rendering. */ - public static function addError($id) + public static function addError(string $id): void { self::add('error', $id, func_get_args()); } - public static function addWarning($id) + public static function addWarning(string $id): void { self::add('warning', $id, func_get_args()); } - public static function addInfo($id) + public static function addInfo(string $id): void { self::add('info', $id, func_get_args()); } - public static function addSuccess($id) + public static function addSuccess(string $id): void { self::add('success', $id, func_get_args()); } @@ -35,7 +35,7 @@ class Message * Internal function that adds a message. Used by * addError/Success/Info/... above. */ - private static function add($type, $id, $params) + private static function add(string $type, string $id, array $params): void { self::$list[] = array( 'type' => $type, @@ -50,7 +50,7 @@ class Message * After calling this, any further calls to add* will be rendered in * place in the current page output. */ - public static function renderList() + public static function renderList(): void { // Non-Ajax foreach (self::$list as $item) { @@ -69,7 +69,7 @@ class Message * Get all queued messages, flushing the queue. * Useful in api/ajax mode. */ - public static function asString() + public static function asString(): string { $return = ''; foreach (self::$list as $item) { @@ -88,7 +88,7 @@ class Message * Deserialize any messages from the current HTTP request and * place them in the message queue. */ - public static function fromRequest() + public static function fromRequest(): void { $messages = is_array($_REQUEST['message']) ? $_REQUEST['message'] : array($_REQUEST['message']); foreach ($messages as $message) { @@ -102,7 +102,7 @@ class Message * Turn the current message queue into a serialized version, * suitable for appending to a GET or POST request */ - public static function toRequest() + public static function toRequest(): string { $parts = array(); foreach (array_merge(self::$list, self::$alreadyDisplayed) as $item) { -- cgit v1.2.3-55-g7522