开发者

Doxygen and Visiblity Keywords in PHP

I am finding that in PHP if I do this:

class Foo{

   /**
    * Does something cool
    * @return
    * Always returns 1
    */
      public function bar() {
        return 1;
      }
    }

doxygen wi开发者_运维百科ll not document the member function 'bar'

If I take out the 'public' keyword, it does. Is there some setting that controls this? I've looked online and see nothing about this.


It turns out I was running the wrong version of doxygen. There was already doxygen in my path, and it was pointing to 1.3x. Now everything works.


Since it's a class member, you need to comment the class as well so that doxygen knows to look within the class for member functions. Do something like this before class Foo

/**
 * @class Foo
 *
 * The foo class is awesome
 */

Here is the code I am using (exactly yours plus that comment) which generates the output on the link below.

<?php

/**
 * @class Foo
 *
 * The foo class is awesome
 */
class Foo{

   /**
    * Does something cool
    * @return
    * Always returns 1
    */
      public function bar() {
        return 1;
      }
}

?>

http://raged.microsonic.org/test/html/classFoo.html

Hope that helps, good luck!

On a side note, it is always a good idea (especially for documentation) to list your var types as the poster above suggested. I generally declare every @param and @return as some sort of variable type (since I come from a C++ background) although it is not totally necessary in PHP. In PHP you tend to have many "mixed" var types as where this could not happen in C++. Anyway good luck with your project!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜