我在这里找到了这个答案:http://blog.jetbrains.com/webide/2013/02/phpdoc_and_code_templates/
希望对你有帮助
PhpDoc 模板
PhpDoc 模板位于 Settings |文件模板 |包括。目前有 PHP 类文档注释、PHP 函数文档注释和 PHP 字段文档注释三个模板。这些中的任何一个都可以通过#parse 指令包含到其他模板中。比如我们可以修改原来的类模板(Templates | PHP Class),在生成类的时候也包含类PHP Doc:
<?php
#parse("PHP File Header.php")
...
#parse("PHP Class Doc Comment")
class ${NAME} {
}
在以下情况下使用相同的模板:
我们在类、函数(方法)或类字段前输入 /** 并按 Enter 后会生成一个新的 PHP Doc 注释。
我们调用代码 |生成 | PHPDoc 阻止或使用 Add PHP Doc 快速修复来检查 Missing PHP Doc。
下面是可以在 PHP Doc 模板中使用的变量列表:
${NAME}
The element (class, function, field) name.
${NAMESPACE}
The name of the namespace the element belongs to without any leading or trailing backslashes, for example Core\Widgets. The variable value is empty if the element doesn’t belong to any namespace. A check like `#if (${NAMESPACE})` ... is possible.
${CLASS_NAME}
Contains a class name for class methods and fields. Will be empty for functions that do not belong to any class.
${TYPE_HINT}
For functions (methods), contains the return type of the function (method). For fields, evaluates to the field’s type if it can be found, for example, from a default value. Will be empty if the type cannot be retrieved from the code.
${STATIC}
Takes the value of “static” if the function or field is static, otherwise, an empty string. We can use this variable with the condition `#if (${STATIC})` ... to generate something specific for static class members.
${CARET}
Marks the position where the editor caret should be placed after the comment is added. Note: Works only if the comment is added after we type “/**” and hit Enter. Should be placed inside the comment, not on the first line /** or on the last line */. In all other cases the caret marker will be ignored.
${PARAM_DOC}
A generated PHP Doc fragment containing function (method) parameters in the form: “* @param type $name“. For example, if the function signature is foo ($x, $y), it will evaluate to:
覆盖/实现方法的代码模板
以下模板可以在设置 | 下找到文件模板 |代码:PHP 实现的方法体和 PHP 覆盖的方法体。考虑到在大多数情况下,我们需要对父方法进行简单调用或只需要我们自己的注释(可能是 TODO 的某些版本),因此参数很少:
${NAME}
Method name.
${PARAM_LIST}
A comma-separated list of parameters. For example, if the original method signature is foo(Bar $bar, $y), the variable will take the value “$bar, $x” which can be used in a call to the parent method as `${NAME}(${PARAM_LIST})`”
${RETURN}
Either “return” or an empty string.
美元符号变量:${DS}
解决了将美元符号 $ 放在模板中的任何位置的问题。实际上,美元符号在 PHP 和 Velocity 模板引擎中都使用,负责幕后的代码生成。因此,每当我们需要美元符号时,只需使用 ${DS} 作为它的等价物。例如,如果我们要生成$this->foo(),则需要放入${DS}this->foo()。这可能看起来并不完美,但保证不会发生冲突。