douyi5822 2015-02-16 15:14
浏览 85
已采纳

PHP和Doxygen具有多个属性声明

I finally got doxygen to work with php and PHPDoc styled comments (I'm removing '@package' with filter since it breaks up doxygen) though there's one thing I would love to have and are not able to figure out how.

In PHP I'm writing multiple property declaration in a class like this:

class Foo
{
private
    /// the blue color
    $blue,
    /// the red color
    $red,
    /// the yellow color
    $yellow;

public
    /// the orange color
    $orange,
    /// black (no color)
    $black;

public function bar() {}
}

If I'm now generating the docs, only the first property is shown as private Attribute while all other properties are simply referenced as Data Fields. So doxygen obviously doesn't parse the accesors of every property after the first one.

Is it possible to make this commentation style compatible to doxygen ?

P.S: I thought about applying a filter which converts it in doxygen-parsable code style. Though this would only be a fix I'm currently working on it.

  • 写回答

1条回答 默认 最新

  • dongzouqie4220 2015-04-23 17:01
    关注

    I wrote this filter, that works for the example you provided. I think I should also work for more complex examples.

    // Get the input
    $source = file_get_contents($argv[1]);
    
    $count = 0;
    
    do {
        $source = preg_replace('#(private|public|protected)(\s*[^$]*)(\$[^,;]+),#',
                               "$2 $1 $3;
    $1 ", $source, -1, $count);
    } while($count > 0);
    
    // Output
    echo $source;
    

    You can find this and other filters at my GitHub repository doxygen-php-filters.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 metadata提取的PDF元数据,如何转换为一个Excel
  • ¥15 关于arduino编程toCharArray()函数的使用
  • ¥100 vc++混合CEF采用CLR方式编译报错
  • ¥15 coze 的插件输入飞书多维表格 app_token 后一直显示错误,如何解决?
  • ¥15 vite+vue3+plyr播放本地public文件夹下视频无法加载
  • ¥15 c#逐行读取txt文本,但是每一行里面数据之间空格数量不同
  • ¥50 如何openEuler 22.03上安装配置drbd
  • ¥20 ING91680C BLE5.3 芯片怎么实现串口收发数据
  • ¥15 无线连接树莓派,无法执行update,如何解决?(相关搜索:软件下载)
  • ¥15 Windows11, backspace, enter, space键失灵