Doxygen不记录php代码里面如果标签 [英] Doxygen not documenting php code inside if tags
问题描述
我使用doxygen,但它不会记录我的一些类。所有这些类都以下列方式调用:
I am using doxygen, but it doesn't document some of my classes. All these classes are called in the following way:
<?php
if(!class_exists('a')){
class a{
function b(){
print 'c';
}
}
}
?>
我假设它与if(!class_exists('a'))让doxygen仍然记录这个?
I assume it has to do with if(!class_exists('a')), how can i let doxygen still document this?
推荐答案
Doxygen有许多问题记录php代码。其中许多可以使用 input_filter
更正。
Doxygen has many issues documenting php code. And many of them can be corrected by using an input_filter
.
使用以下代码作为过滤器
Use the following code as filter
<?php
$source = file_get_contents($argv[1]);
$regexp = '#(<\?php[\s]+)(if\(!class_exists\([^\)]+\)\)\{)([\s\S]*)(\})([\s]*\?>)#';
$replace = '$1 $3 $5';
$source = preg_replace($regexp, $replace, $source);
echo $source;
?>
并输入
/path/to/php php_var_filter.php
$ c> INPUT_FILTER 设置。
into the INPUT_FILTER
setting.
注意:这样可以修复很多doxygen问题。如果某些东西不起作用,这是由于c(或c ++)代码到php代码(最喜欢)之间的区别。你可以使用input_filter更改你的php代码看起来更像c代码。这将解决许多问题。
Notice: This way you can fix many doxygen issues. If something does not work, it is beacause of a difference between c (or c++) code to php code (most likly). You can use the input_filter to change your php code to look more like c code. This will fix many problems.
编辑
也许你还想考虑自动加载功能。我认为这是一个更好的方法来获得 if(!class_exists(..))
-result。
Edit
Maybe you also want to think about an autoload function. I think this is a better way to get the if(!class_exists(..))
-result.
编辑
我只是注意到我已经回答了类似的问题不同。您也可以使用此回答。
您可以找到一些更多输入过滤器,以改善 GitHub 上的doxygen的php支持。
You can find some more input filters to improve doxygen's php support on GitHub.
这篇关于Doxygen不记录php代码里面如果标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!