我的带有doxygen格式注释的PHP/HTML代码:
<!DOCTYPE html>
<?php
/** \file
* \brief php_doxygen_test.php demontrates that doxygen parses the keyword 'do' as a variable in at least some cases.
*
* php_doxygen_test.php demontrates that doxygen parses the keyword 'do' as a variable in at least some cases. This
* was discovered for a 'do ... while' loop being used to display the contents of an array.
*/
?>
<html lang="en-us">
<head>
<title>PHP-Doxygen 'do ... while' Test</title>
</head>
<body>
<p>Array displayed via 'do ... while'</p>
<pre>
<?php
$starNames = array("Proxima Centauri", "Arcturus", "Sol", "Fomalhaut", "Deneb", "Rigel", "Zeta Ophiuchi"); /**< An indexed array of star names. */
$i = 0; /**< Counter for use in do ... while test. */
do {
echo $starNames[$i] . "<br>";
$i++;
} while ($i < count($starNames));
?>
</pre>
</body>
</html>PHP代码运行良好。但是,当我在文件上运行doxygen (v1.8.5)时,它将do列为除了$starNames和$i之外的一个变量
Variables
$starNames = array("Proxima Centauri", "Arcturus", "Sol", "Fomalhaut", "Deneb", "Rigel", "Zeta Ophiuchi")
$i = 0
do在“可变文档”一节中,do列出如下:
do
Initial value:
{
echo $starNames[$i] . "<br>"在do行之前添加新行或从do循环中删除echo行并不会停止作为变量的doxygen解析do。在我的实际代码中,它也是为while和for循环这样做的。这大大降低了我的项目文档的价值!
有没有办法改变我的PHP代码,这样doxygen就不会这么做了?或者,是否有一种方法可以告诉doxygen不要将“do”作为变量记录?
我在用:
对于doxygen,我使用“优化C或PHP输出”配置设置。
我已经对这个问题做了很多次搜索,但没有发现任何东西,包括doxygen的支持档案、doxygen已知的问题和堆栈溢出。
发布于 2013-11-26 22:49:47
在解析代码时,需要函数、类、模块或名称空间,而不是全局级别的语句,如您的示例所示。
所以,要么用函数包装这些语句,要么告诉doxygen使用/** @cond */忽略它们。/** @endcond */。
https://stackoverflow.com/questions/20205078
复制相似问题