phpDoc 支持自定义标签吗?我想使用 @untested
标记尚未测试的代码。如何做到这一点?
最佳答案
物有所值,PSR-5 (截至 2020 年 5 月仍处于草案阶段)允许自定义标签前提是您在它们前面加上项目或组织特定的名称:
In support of annotations, it is allowable to introduce a set of tags designed specifically for an individual application or subset of applications (and thus not covered by this specification).
These tags, or annotations, MUST provide a namespace by either
prefixing the tag name with a PHP-style namespace, or by prefixing the tag name with a single vendor-name followed by a hyphen.
...
Example of a tag name prefixed with a vendor name and hyphen:
@phpdoc-event transformer.transform.pre
因此假设 PSR-5 被接受,您似乎可以做类似@myproject-untested
的事情。即使 PSR-5 被接受,也不能保证 phpDoc 工具将支持定义这些自定义标签的方法。
关于php - phpDoc 中是否可以自定义标签?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38872487/