diff options
Diffstat (limited to 'maintenance/mwdoc-filter.php')
-rw-r--r-- | maintenance/mwdoc-filter.php | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/maintenance/mwdoc-filter.php b/maintenance/mwdoc-filter.php index c80981b5..0cc7bde8 100644 --- a/maintenance/mwdoc-filter.php +++ b/maintenance/mwdoc-filter.php @@ -16,8 +16,33 @@ if ( PHP_SAPI != 'cli' ) { } $source = file_get_contents( $argv[1] ); -$regexp = '#\@var\s+([^\s]+)([^/]+)/\s+(var|public|protected|private)\s+(\$[^\s;=]+)#'; -$replac = '${2} */ ${3} ${1} ${4}'; +$regexp = '#' + . '\@var' + . '\s+' + // Type hint + . '([^\s]+)' + . '\s+' + // Any text or line(s) between type hint and '/' closing the comment + // (includes the star of "*/"). Descriptions containing a slash + // are not supported. Those will have to to be rewritten to have their + // description *before* the @var: + // /** + // * Description with / in it. + // * @var array + // */ + // instead of: + // /** + // * @var array Description with / in it. + // */ + . '([^/]+)' + . '/' + . '\s+' + . '(var|public|protected|private)' + . '\s+' + // Variable name + . '(\$[^\s;=]+)' + . '#'; +$replac = '${2}/ ${3} ${1} ${4}'; $source = preg_replace( $regexp, $replac, $source ); echo $source; |