X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2Fmwdoc-filter.php;h=0cc7bde8a406ec79c27951082df662b3dad78e0c;hb=0ed0135f1475e5a5b6ed915bf7a349c695646a08;hp=c80981b56df251f6fe3d2cbb6d1748bcb5161a1b;hpb=d8cb9695c6971975692808bb7cdc991e2abda0ab;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/mwdoc-filter.php b/maintenance/mwdoc-filter.php index c80981b56d..0cc7bde8a4 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;