From e2af4512e0e0360b1b4053adb0f1c88fb29b2779 Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Mon, 2 Jun 2025 22:33:04 +0900 Subject: [PATCH] Fix missing or incorrect doc comments, type declarations, etc. --- common/functions.php | 6 +++--- common/js/common.js | 1 + common/legacy.php | 30 ++++++++++++++++++++++++++---- 3 files changed, 30 insertions(+), 7 deletions(-) diff --git a/common/functions.php b/common/functions.php index 7ddb59b59..72b3e9e5b 100644 --- a/common/functions.php +++ b/common/functions.php @@ -11,7 +11,7 @@ * * @param string $key * @param string $value (optional) - * @return mixed + * @return string|array|null */ function config(string $key, $value = null) { @@ -256,7 +256,7 @@ function escape_dqstr(string $str): string * @param string $escape_char The escape character (default: backslash) * @return array */ -function explode_with_escape(string $delimiter, string $str, $limit = 0, $escape_char = '\\'): array +function explode_with_escape(string $delimiter, string $str, int $limit = 0, string $escape_char = '\\'): array { if ($limit < 1) $limit = 0; $str = (string)$str; @@ -417,7 +417,7 @@ function base64_decode_urlsafe(string $str): string /** * This function shortens a number using common suffixes. * - * @param int $number The number to shorten + * @param int|float $number The number to shorten * @param int $significant_digits The number of significant digits to retain * @return string */ diff --git a/common/js/common.js b/common/js/common.js index e4c9602f4..4c30996d7 100644 --- a/common/js/common.js +++ b/common/js/common.js @@ -279,6 +279,7 @@ Rhymix.redirectToUrl = function(url) { * @param string url * @param string target * @param string features + * @return void */ Rhymix.openWindow = function(url, target, features) { diff --git a/common/legacy.php b/common/legacy.php index f236ae67b..d1499de9d 100644 --- a/common/legacy.php +++ b/common/legacy.php @@ -232,6 +232,7 @@ function getNextSequence(): int /** * Set Sequence number to session * + * @deprecated * @param int $seq sequence number * @return void */ @@ -248,6 +249,7 @@ function setUserSequence($seq): void /** * Check Sequence number grant * + * @deprecated * @param int $seq sequence number * @return bool */ @@ -313,6 +315,7 @@ function getNotEncodedUrl(): string /** * Get a encoded url. If url is encoded, not encode. Otherwise html encode the url. * + * @deprecated * @see getUrl() * @return string */ @@ -386,6 +389,7 @@ function getNotEncodedFullUrl(): string * getSiteUrl() returns the URL by transforming the given argument value of domain * The first argument should consist of domain("http://" not included) and path * + * @deprecated * @return string */ function getSiteUrl(): string @@ -408,6 +412,7 @@ function getSiteUrl(): string * getSiteUrl() returns the not encoded URL by transforming the given argument value of domain * The first argument should consist of domain("http://" not included) and path * + * @deprecated * @return string */ function getNotEncodedSiteUrl(): string @@ -429,6 +434,7 @@ function getNotEncodedSiteUrl(): string /** * Return the value adding request uri to the getSiteUrl() To get the full url * + * @deprecated * @return string */ function getFullSiteUrl(): string @@ -468,6 +474,7 @@ function getCurrentPageUrl($escape = true): string /** * Return if domain of the virtual site is url type or id type * + * @deprecated * @param string $domain * @return bool */ @@ -540,6 +547,7 @@ function cut_str($string, $cut_size = 0, $tail = '...'): string /** * Convert XE legacy time zone format into UTC offset. * + * @deprecated * @param string $time_zone Time zone in '+0900' format * @return int */ @@ -551,6 +559,7 @@ function get_time_zone_offset($timezone): int /** * Get the offset between the current user's time zone and Rhymix's internal time zone. * + * @param ?int $timestamp (optional) * @return int */ function zgap($timestamp = null): int @@ -771,6 +780,7 @@ function getMonthName(int $month, bool $short = true): string /** * Returns encoded value of given email address for email scraping * + * @deprecated * @param string $email The email * @return string */ @@ -804,6 +814,7 @@ function debugPrint($value, ...$values): void /** * Delete the second object vars from the first argument * + * @deprecated * @param object $target_obj An original object * @param object $del_obj Object vars to delete from the original object * @return object @@ -826,6 +837,7 @@ function delObjectVars($target_obj, $del_obj): object /** * Delete variables that are commonly submitted but don't need to be saved. * + * @deprecated * @param array|object $vars * @return array|object */ @@ -871,6 +883,7 @@ function getNumberingPath($no, int $size = 3): string /** * Sanitize HTML content. * + * @deprecated * @param string $content Target content * @return string */ @@ -882,6 +895,7 @@ function removeHackTag($content): string /** * Get whether utf8 or not given string * + * @deprecated * @param string $string * @param bool $return_convert If set, returns converted string * @param bool $urldecode @@ -909,17 +923,18 @@ function detectUTF8($string, $return_convert = FALSE, $urldecode = TRUE) /** * Get is current user crawler * - * @param string $agent if set, use this value instead HTTP_USER_AGENT + * @param ?string $user_agent if set, use this value instead HTTP_USER_AGENT * @return bool */ -function isCrawler($agent = null): bool +function isCrawler($user_agent = null): bool { - return Rhymix\Framework\UA::isRobot($agent); + return Rhymix\Framework\UA::isRobot($user_agent); } /** * Remove embed media for admin * + * @deprecated * @param string $content * @param int $writer_member_srl * @return void @@ -960,6 +975,9 @@ function stripEmbedTagForAdmin(&$content, $writer_member_srl): void /** * Check for CSRF attacks * + * Use Rhymix\Framework\Security::checkCSRF() instead. + * + * @deprecated * @return bool */ function checkCSRF(): bool @@ -969,6 +987,8 @@ function checkCSRF(): bool /** * menu exposure check by isShow column + * + * @deprecated * @param array $menu * @return void */ @@ -994,6 +1014,7 @@ function recurciveExposureCheck(&$menu): void /** * Alias to hex2rgb() * + * @deprecated * @param string $hexstr * @return array */ @@ -1101,7 +1122,7 @@ if(!function_exists('mb_strlen')) */ if(!function_exists('mb_strpos')) { - function mb_strpos($haystack, $needle, $offset, $charset = null) + function mb_strpos($haystack, $needle, $offset = 0, $charset = null) { if(function_exists('iconv_strpos')) { @@ -1239,6 +1260,7 @@ function reload($isOpener = FALSE): void * @param string $errstr * @param string $file * @param int $line + * @param array $context * @return void */ function handleError($errno, $errstr, $file, $line, $context): void