PHP 评论区中的#@+ 和#@- 是什么意思?

What do #@+ and #@- in PHP comment blocks mean?

我见过几个 PHP 文件,其中文档块的开头有一些特殊字符。 它以 /**#@+ some doc-text */ 开始,以 /**#@-*/ 结束。

这些符号是什么意思?

我发现这似乎在各种 PHP 框架(Zend、phpseclib、Magento)中使用,但找不到解释。

示例:

/**#@+
 * Constants for keys of data array. Identical to the name of the getter in snake case
 */
const ID = 'id';
const CUSTOMER_ID = 'customer_id';
const REGION = 'region';
const REGION_ID = 'region_id';
const COUNTRY_ID = 'country_id';
const STREET = 'street';
const COMPANY = 'company';
const TELEPHONE = 'telephone';
const FAX = 'fax';
const POSTCODE = 'postcode';
const CITY = 'city';
const FIRSTNAME = 'firstname';
const LASTNAME = 'lastname';
const MIDDLENAME = 'middlename';
const PREFIX = 'prefix';
const SUFFIX = 'suffix';
const VAT_ID = 'vat_id';
const DEFAULT_BILLING = 'default_billing';
const DEFAULT_SHIPPING = 'default_shipping';
/**#@-*/

它们用于 DocBlock templates (see Wikipedia)

我在 wordpress 配置模板中也遇到过这个。

这是一种减少在进行 phpdoc 注释时对相关项目维护重复注释的方法。这是 phpDocumentor 工具的一项功能,虽然有一些针对 phpdoc 的建议规范文档(这些建议未提及此功能),但实际上并没有规范。

使用这些 starting/ending 模式告诉 phpDocumentor 将此 phpdoc 注释应用于开始和结束标记之间的 所有 项。

/**#@+
 * documentation comment for "stuff"
 */
...multiple of the same thing to document...

/**#@-*/

我能找到的唯一文档位于 manual.phpdoc.org
docs.phpdoc.org 出于某种原因似乎没有提及此功能。

在 ArSeN 的回答中编辑的维基页面 link 在 2018 年 10 月被编辑以删除大部分 copy/pasted 文档。这是 link 的历史版本删除前的页面。

https://en.wikipedia.org/w/index.php?title=PHPDoc&oldid=863927054#DocBlock_Templates