phpDocumentor

Jussi Pohjolainen

TAMK University of Applied Sciences » ICT

Why Document?

Installation of phpDocumentator

Generating Documentation

DocBlock comments

Example of a DocBlock comment


/**
 * Return the date of Easter.
 * 
 * Using the formula from "Formulas that are way too complicated for anyone to
 * ever understand except for me" by Irwin Nerdy, this function calculates the
 * date of Easter given a date in the Ancient Mayan Calendar, if you can also
 * guess the birthday of the author.
 *
 * @sometag value
 */

Documentable PHP Elements

About Packages

Documenting file

/**
 * Page-Level DocBlock, short description here.
 *
 * Longer file description and other paragraphs here.
 *
 * @package   mypackage
 * @author    Jussi Pohjolainen
 * @version   2008-03-24
 */

Commenting classes

/**
 * One line class description here.
 *
 * Longer class description and other paragraphs here.
 *
 * @package  my-package-name
 * @author   my-name
 * @version  2007-04-03
 */
class FooBar
{

}

Errors and warnings

Example of a file and class


/**
 * This is a file-level DocBlock.
 *
 * @package SomePackage
 */
 
/**
 * This is a not a file-level DocBlock, because it precedes a class declaration.
 *
 * @package SomePackage
 */
class Foo {}

Documenting Class Properties

Documenting Class Methods

Simple Class Method - example

/**
 *  Short description.
 *
 *  Long description.
 *
 *  @access public
 *  @param  string  $foo  description here
 *  @param  string  $bar  description here
 *  @return boolean       description here
 */
public function MyMethod ($foo, $bar)
{
   ...
   return true;
}

Style Guide in A-OT03 » General ( 1/3 )

Style Guide in A-OT03 » phpDoc Tags ( 2/3 )

Style Guide in A-OT03 » @var ( 3/3 )

Links