X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2Fmwdoc-filter.php;h=0cc7bde8a406ec79c27951082df662b3dad78e0c;hb=0ed0135f1475e5a5b6ed915bf7a349c695646a08;hp=6eeb48d38c15bc98fcc35f9691c636786bf85909;hpb=ec9a1c263eaa9d0bdacc9b243f65088af268317e;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/mwdoc-filter.php b/maintenance/mwdoc-filter.php index 6eeb48d38c..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}'; -$source = preg_replace($regexp, $replac, $source); +$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;