I\'m trying to use doxygen to parse php code into xml output. Doxygen does not parse description of class member variables.
Here is my sample php file:
Big thanks to Goran for his doxygen filter! Extending the same idea a bit, to make proper documentation of function parameters as well:
Include Zend Studio-style array-of-objects @param types in doxygen documentation:
// Change the following:
// /** @param VarType[] $pParamName Description **/
// function name(array $pParamName) {
// Into:
// /** @param array $pParamName Description **/
// function name(VarType[] $pParamName) {
$regexp = '#\@param\s+([^\s]+)\[\]\s+(\$[^\s]+)\s+([^/]+)/\s+(public|protected|private)?\s+function\s+([^\s]+)\s*\(([^)]*)array\s+\2([^)]*)\)(\s+){#s';
$replac = '@param array ${2} ${3}/ ${4} function ${5} (${6} ${1}[] ${2}${7})${8}{';
$lSource = preg_replace($regexp, $replac, $lSource);
Include int/float/double/string @param types in doxygen documentation:
// Change the following:
// /** @param (int|float|double|string) $pParamName Description **/
// function name($pParamName) {
// Into:
// /** @param (int|float|double|string) $pParamName Description **/
// function name((int|float|double|string) $pParamName) {
$regexp = '#\@param\s+(int|float|double|string)\s+(\$[^\s]+)\s+([^/]+)/\s+(public|protected|private)?\s+function\s+([^\(\s]+)\s*([^)]*)(\(|,)\s*\2([^)]*)\)(\s+){#s';
$replac = '@param ${1} ${2} ${3}/ ${4} function ${5}${6}${7}${1} ${2}${8})${9}{ '; //${6}${1} ${2}${7})${8}{';
$lSource = preg_replace($regexp, $replac, $lSource);
Both of the above regexps also naturally work with functions taking more than one argument. Also just a quick hack, which works for our code, hope it helps someone else.