thinkphp-apidoc icon indicating copy to clipboard operation
thinkphp-apidoc copied to clipboard

代码之前带有注释会解析错误

Open qiangcxq opened this issue 2 years ago • 3 comments

image image

因为是老项目,接口文档都是慢慢补

qiangcxq avatar May 26 '22 08:05 qiangcxq

你好,由于apidoc使用基于doctrine/annotations来实现注释解析,凡是带@的注释都需要 use其解释文件,可参考文档https://hgthecode.github.io/thinkphp-apidoc/use/help/500/#%E6%B3%A8%E8%A7%A3%E9%94%99%E8%AF%AF

HGthecode avatar May 27 '22 02:05 HGthecode

后期版本会支持配置 忽略的注释配置,到时可通过该配置来解决

HGthecode avatar May 27 '22 02:05 HGthecode

apidoc.php配置文件里边加个配置 // 过滤的注解 'filter_tag' => ['@auth', '@menu', '@login'], 在vendor\hg\apidoc\src\parseApi\ParseAnnotation.php210行前边加入 $refMethod = str_replace($this->config['filter_tag'],'',$refMethod); 把需要过滤的注解给替换掉不走解析就可以了 目前不知道有什么后遗症,可以试试

m22543 avatar Jul 21 '22 14:07 m22543