diff --git a/src/Exceptions/ConstantException.php b/src/Exceptions/ConstantException.php index 1303cd5..bc0e578 100644 --- a/src/Exceptions/ConstantException.php +++ b/src/Exceptions/ConstantException.php @@ -55,7 +55,7 @@ public function getErrorMessage(int $code): string private static function parseAnnotationsFromDocComment($docComment): array { - $pattern = '/@(\w+)\((\d+|[^\)]+)\)/'; + $pattern = '/@(\w+)\((".*"|[^)]+)\)/'; preg_match_all($pattern, $docComment, $matches, PREG_SET_ORDER); $parsed_annotations = []; foreach ($matches as $match) { diff --git a/src/stubs/constant.stub b/src/stubs/constant.stub index 68a6bfd..223a2f7 100644 --- a/src/stubs/constant.stub +++ b/src/stubs/constant.stub @@ -8,7 +8,7 @@ use EverForge\ThinkConstant\Constant; class {%className%} extends Constant { /** - * @Message(失败) + * @Message("失败") */ public const SERVER_ERROR = 500; }