views:

36

answers:

2

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 will 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.

A: 

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!

RageD
Hmm, It must be some kind of parsing error. I've cleared up all the warnings. In my real source code I actually did comment the class, so that wasn't the problem. In fact, the only member function that's getting documented is the __construct() method. I changed the @return lines to one line and that didn't help either.
Aaron
Basically I can reproduce the fact that doxygen stops documenting any member functions when visiblity keywords are placed before the function keyword. Even if they are all 'public'. If I remove all keywords (public, private, protected) doxygen documents all my functions. I can leave in static for some reason. I have EXTRACT_ALL set to YES.Version of doxygen is: doxygen-1.7.1, which I built from sourceI cannot find anything online about this, nor can I find any setting that fixes this problem in the config file.
Aaron
A: 

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.

Aaron