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 画两个图 python或R
  • ¥15 在线请求openmv与pixhawk 实现实时目标跟踪的具体通讯方法
  • ¥15 八路抢答器设计出现故障
  • ¥15 请教一下c语言的代码里有一个地方不懂
  • ¥15 opencv 无法读取视频
  • ¥15 用matlab 实现通信仿真
  • ¥15 按键修改电子时钟,C51单片机
  • ¥60 Java中实现如何实现张量类,并用于图像处理(不运用其他科学计算库和图像处理库))
  • ¥20 5037端口被adb自己占了
  • ¥15 python:excel数据写入多个对应word文档