php - phpDoc 中是否可以自定义标签?

标签 php phpdoc

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/

相关文章:

php - Symfony2 使用 besimple/soap-client 包使用 SOAP 服务

PHP XMLReader,获取版本和编码

php - mysqli_fetch_assoc()期望参数/调用成员函数bind_param()错误。如何获取并修复实际的mysql错误?

templates - PHP文档模板

PHPDoc:嵌套数组中的类型提示(例如 2 维)

javascript - 我无法在评论下通过 Ajax 获得评论回复而不刷新

php - 使用Elastica进行全文查询

php - 如何记录可变数量的参数

php - 如何记录需要常量的参数

php - Jenkins如何发布phpDox