为什么 phpDoc 开头序列在 `/**` 而不是只有 `/*` 中有两颗星
Why does phpDoc opening sequence have two stars in `/**` instead of just `/*`
仅需 /*
,事情看起来非常直观且机器可解析清晰
https://phpdoc.org/docs/latest/getting-started/your-first-set-of-documentation.html 应该说些什么,但没有。
你的想法?
常规 php 评论 (/* ... */
) 和 DocBlock (/** ... */
) (or PHPDoc) 之间存在差异。
PHP 将两者解释为注释,但是在使用 IDE 时 - 它们可以解析 DocBlocks 并为您提供更好的编程体验(使用类型提示和自动完成),如果您希望您可以使用它们导出完整的代码文档 (packages/classes/functions/etc)。
如果以这段代码为例:
<?php
/**
* A summary informing the user what the associated element does.
*
* A *description*, that can span multiple lines, to go _in-depth_ into the details of this element
* and to provide some background information or textual references.
*
* @param string $myArgument With a *description* of this argument, these may also
* span multiple lines.
*
* @return void
*/
function myFunction($myArgument)
{
}
你可以看到函数 myFunction
没有 return 任何东西 (@return void
),它只接受一个参数 ($myArgument
),它应该是一个字符串.
要导出完整文档,您可以使用 phpDocumentor tool。
仅需 /*
https://phpdoc.org/docs/latest/getting-started/your-first-set-of-documentation.html 应该说些什么,但没有。
你的想法?
常规 php 评论 (/* ... */
) 和 DocBlock (/** ... */
) (or PHPDoc) 之间存在差异。
PHP 将两者解释为注释,但是在使用 IDE 时 - 它们可以解析 DocBlocks 并为您提供更好的编程体验(使用类型提示和自动完成),如果您希望您可以使用它们导出完整的代码文档 (packages/classes/functions/etc)。
如果以这段代码为例:
<?php
/**
* A summary informing the user what the associated element does.
*
* A *description*, that can span multiple lines, to go _in-depth_ into the details of this element
* and to provide some background information or textual references.
*
* @param string $myArgument With a *description* of this argument, these may also
* span multiple lines.
*
* @return void
*/
function myFunction($myArgument)
{
}
你可以看到函数 myFunction
没有 return 任何东西 (@return void
),它只接受一个参数 ($myArgument
),它应该是一个字符串.
要导出完整文档,您可以使用 phpDocumentor tool。