Dorokhov.codes

phpDocumentor

Run phpDocumentor:

docker run --rm -v "$(pwd):/data" "phpdoc/phpdoc:3"

DocBlock

A DocBlock is a piece of documentation in your source code that informs you what the function of a certain class, method or other Structural Element is.

<?php
/**
 * This is a DocBlock.
 */
function associatedFunction() {
    // ...
}

File-level DocBlock:

<?php
   /**
    * I belong to a file
    */

   /**
    * I belong to a class
    */
   class Car {
        // ...
   }

DocBlocks are divided into three parts. Each of these parts is optional.

  • Summary.
  • Description.
  • Tags and annotations.
<?php
/**
 * A summary informing the user what the associated element does.
 *
 * A *description* to go _in-depth_ into the details of
 * this element and to provide some background information
 * or textual references.
 *
 * @param string $some_argument This description can span multiple lines.
 *
 * @return void
 */
 function my_function($some_argument) {
    // ...
 }