From d73e771ef38d2345e0864d5bee9cb7ce08c8e59f Mon Sep 17 00:00:00 2001 From: sunxyw <31698606+sunxyw@users.noreply.github.com> Date: Wed, 23 Mar 2022 19:44:16 +0800 Subject: [PATCH] fix help generator not working with alias (#69) --- src/ZM/Utils/MessageUtil.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/ZM/Utils/MessageUtil.php b/src/ZM/Utils/MessageUtil.php index 652f09bc..33d4b87d 100644 --- a/src/ZM/Utils/MessageUtil.php +++ b/src/ZM/Utils/MessageUtil.php @@ -298,7 +298,13 @@ class MessageUtil foreach ($possible_keys as $key => $help_format) { // 如果定义了该参数,则添加到帮助信息中 if (isset($annotation->{$key}) && !empty($annotation->{$key})) { - $command_seg[] = sprintf($help_format, $annotation->{$key}); + if (is_iterable($annotation->{$key})) { + foreach ($annotation->{$key} as $item) { + $command_seg[] = sprintf($help_format, $item); + } + } else { + $command_seg[] = sprintf($help_format, $annotation->{$key}); + } } } // 第一个触发参数为主命令名