2

I have two classes in PHP: Figure and Circle. Circle extends Figure. Figure has a method draw(). Circle inherits this method and overrides it.

The draw() method is commented in the parent class, but it does not have a comment in the Circle class as it shall inherit it.

/**
 * Description of Figure  
 *
 * @author admin
 */
class Figure{

    /**
     * Does something
     */
    public function draw() {

    }
}

/**
 * Description of Circle  
 *
 * @author admin
 */
class Circle extends Figure{


    public function draw() {
        //overriden method
    }
}

Doxygen says: "warning: Member draw() (function) of class Circle is not documented."

How to make Doxygen put in the inherited comment?

Shi
  • 4,178
  • 1
  • 26
  • 31
Catidew
  • 31
  • 4

1 Answers1

6

You need to tell doxygen where to take the documentation from, using @copydoc annotation.

/**
 * Description of Circle  
 *
 * @author admin
 */
class Circle extends Figure {

    /**
     * @copydoc Figure::draw()
     */
    public function draw() {
        //overriden method
    }
}

Inside the documentation block below @copydoc you can add more documentation, like for example why the method is overridden.

albert
  • 8,285
  • 3
  • 19
  • 32
Shi
  • 4,178
  • 1
  • 26
  • 31