From d0cedde7c0d581dcd2099243e30aba610b68c28c Mon Sep 17 00:00:00 2001 From: joyqi Date: Thu, 19 Aug 2021 16:56:59 +0800 Subject: [PATCH] change build target --- .github/workflows/Typecho-dev-Ci.yml | 2 +- var/Typecho/Common.php | 20 +++++++++----------- var/Widget/Options.php | 2 +- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/.github/workflows/Typecho-dev-Ci.yml b/.github/workflows/Typecho-dev-Ci.yml index 4291a589..072df14f 100644 --- a/.github/workflows/Typecho-dev-Ci.yml +++ b/.github/workflows/Typecho-dev-Ci.yml @@ -47,5 +47,5 @@ jobs: - name: Upload a Build Artifact uses: actions/upload-artifact@v2 with: - name: typecho_build + name: typecho path: ./build/ diff --git a/var/Typecho/Common.php b/var/Typecho/Common.php index 42111ac1..81395b77 100644 --- a/var/Typecho/Common.php +++ b/var/Typecho/Common.php @@ -14,18 +14,16 @@ define('__TYPECHO_MB_SUPPORTED__', function_exists('mb_get_info') && function_ex /** * I18n function * - * @param ...$args 需要翻译的文字 + * @param string $string 需要翻译的文字 + * @param mixed ...$args 参数 * * @return string */ -function _t(...$args) +function _t(string $string, ...$args): string { - [$string] = $args; - - if (count($args) <= 1) { + if (empty($args)) { return Typecho_I18n::translate($string); } else { - array_shift($args); return vsprintf(Typecho_I18n::translate($string), $args); } } @@ -33,12 +31,12 @@ function _t(...$args) /** * I18n function, translate and echo * - * @param ...$args 需要翻译的文字 - * - * @return void + * @param string $string 需要翻译的文字 + * @param mixed ...$args 参数 */ -function _e(...$args) +function _e(string $string, ...$args) { + array_unshift($args, $string); echo call_user_func_array('_t', $args); } @@ -51,7 +49,7 @@ function _e(...$args) * * @return string */ -function _n($single, $plural, $number) +function _n(string $single, string $plural, int $number): string { return str_replace('%d', $number, Typecho_I18n::ngettext($single, $plural, $number)); } diff --git a/var/Widget/Options.php b/var/Widget/Options.php index b1e38a55..effa4e2b 100644 --- a/var/Widget/Options.php +++ b/var/Widget/Options.php @@ -52,7 +52,7 @@ class Widget_Options extends Typecho_Widget */ public function __construct($request, $response, $params = null) { - parent::__construct($request, $response, null); + parent::__construct($request, $response); if (!empty($params)) { // 使用参数初始化而不使用数据库