libxml_disable_entity_loader() just in case...
[mediawiki.git] / maintenance / mwdoc-filter.php
blobc80981b56df251f6fe3d2cbb6d1748bcb5161a1b
1 <?php
2 /**
3 * Doxygen filter to show correct member variable types in documentation.
5 * Should be filled in doxygen INPUT_FILTER as "php mwdoc-filter.php"
7 * Original source code by Goran Rakic
8 * http://blog.goranrakic.com/
9 * http://stackoverflow.com/questions/4325224
11 * @file
14 if ( PHP_SAPI != 'cli' ) {
15 die( "This filter can only be run from the command line.\n" );
18 $source = file_get_contents( $argv[1] );
19 $regexp = '#\@var\s+([^\s]+)([^/]+)/\s+(var|public|protected|private)\s+(\$[^\s;=]+)#';
20 $replac = '${2} */ ${3} ${1} ${4}';
21 $source = preg_replace( $regexp, $replac, $source );
23 echo $source;