We are using '@var' to document our variables and class properties,
which is unfortunately not working since '@var' is really meant to
document a function or method.
The way to fix it is to use an input filter that will rewrite our PHP
source code to pretends variables are typed. Aka something like:
/**
* A title object
* @var Title
*/
var $title;
Will be made:
/**
* A title object
* @var Title
*/
Title $title;
That is incorrect PHP code but it is properly recognized by Doxygen.
This patch as a side effect, all variables and properties will end up
being documented in addition of type hinting.
Use a hack authored by Goran Rakic at:
http://stackoverflow.com/a/
8472180/276152
Change-Id: I4ead1bd1feace44496b45ed8c55f5e52c59e7694
EXAMPLE_PATTERNS = *
EXAMPLE_RECURSIVE = NO
IMAGE_PATH =
-INPUT_FILTER =
+INPUT_FILTER = "php mwdoc-filter.php"
FILTER_PATTERNS =
FILTER_SOURCE_FILES = NO
FILTER_SOURCE_PATTERNS =
--- /dev/null
+<?php
+# Original source code by Goran Rakic
+# http://blog.goranrakic.com/
+# http://stackoverflow.com/questions/4325224
+
+# Should be filled in doxygen INPUT_FILTER as "php mwdoc-filter.php"
+
+$source = file_get_contents( $argv[1] );
+$regexp = '#\@var\s+([^\s]+)([^/]+)/\s+(var|public|protected|private)\s+(\$[^\s;=]+)#';
+$replac = '${2} */ ${3} ${1} ${4}';
+$source = preg_replace($regexp, $replac, $source);
+
+echo $source;