From 7f9fd639012d0232e84970463eaf37baab48f9f2 Mon Sep 17 00:00:00 2001 From: umherirrender Date: Tue, 22 Apr 2014 01:38:39 +0200 Subject: [PATCH] Fixed some @params documentation (includes/parser) Swapped some "$var type" to "type $var" or added missing types before the $var. Changed some other types to match the more common spelling. Makes beginning of some text in captial. Also added some missing @param. Change-Id: I49f8f48b521878de7abd9cc40efdeff6cf9a37e0 --- includes/parser/CacheTime.php | 16 +- includes/parser/CoreParserFunctions.php | 102 ++++---- includes/parser/CoreTagHooks.php | 14 +- includes/parser/DateFormatter.php | 14 +- includes/parser/LinkHolderArray.php | 27 ++- includes/parser/Parser.php | 307 ++++++++++++------------ includes/parser/ParserCache.php | 16 +- includes/parser/ParserOptions.php | 29 +-- includes/parser/ParserOutput.php | 46 ++-- includes/parser/Parser_DiffTest.php | 2 +- includes/parser/Preprocessor.php | 13 +- includes/parser/Preprocessor_DOM.php | 49 ++-- includes/parser/Preprocessor_Hash.php | 70 +++--- includes/parser/StripState.php | 40 +-- includes/parser/Tidy.php | 28 +-- 15 files changed, 406 insertions(+), 367 deletions(-) diff --git a/includes/parser/CacheTime.php b/includes/parser/CacheTime.php index dfe3c800b5..464bacdb8e 100644 --- a/includes/parser/CacheTime.php +++ b/includes/parser/CacheTime.php @@ -53,7 +53,7 @@ class CacheTime { } /** - * @param $com bool + * @param bool $com * @return bool */ function setContainsOldMagic( $com ) { @@ -63,7 +63,7 @@ class CacheTime { /** * setCacheTime() sets the timestamp expressing when the page has been rendered. * This does not control expiry, see updateCacheExpiry() for that! - * @param $t string + * @param string $t * @return string */ function setCacheTime( $t ) { @@ -80,7 +80,7 @@ class CacheTime { /** * @since 1.23 - * @param $id int Revision id + * @param int $id Revision id */ function setCacheRevisionId( $id ) { $this->mCacheRevisionId = $id; @@ -94,7 +94,7 @@ class CacheTime { * or equal to the smallest number that was provided as an argument to * updateCacheExpiry(). * - * @param $seconds number + * @param int $seconds */ function updateCacheExpiry( $seconds ) { $seconds = (int)$seconds; @@ -156,8 +156,8 @@ class CacheTime { * per-article cache invalidation timestamps, or if it comes from * an incompatible older version. * - * @param string $touched the affected article's last touched timestamp - * @return Boolean + * @param string $touched The affected article's last touched timestamp + * @return bool */ public function expired( $touched ) { global $wgCacheEpoch; @@ -178,8 +178,8 @@ class CacheTime { * deployed. Someday that should probably be changed. * * @since 1.23 - * @param int $id the affected article's current revision id - * @return Boolean + * @param int $id The affected article's current revision id + * @return bool */ public function isDifferentRevision( $id ) { $cached = $this->getCacheRevisionId(); diff --git a/includes/parser/CoreParserFunctions.php b/includes/parser/CoreParserFunctions.php index 02f2438e8a..65c3e1dbac 100644 --- a/includes/parser/CoreParserFunctions.php +++ b/includes/parser/CoreParserFunctions.php @@ -27,7 +27,7 @@ */ class CoreParserFunctions { /** - * @param $parser Parser + * @param Parser $parser * @return void */ static function register( $parser ) { @@ -76,7 +76,7 @@ class CoreParserFunctions { } /** - * @param $parser Parser + * @param Parser $parser * @param string $part1 * @return array */ @@ -144,7 +144,7 @@ class CoreParserFunctions { * Or to encode a value for the HTTP "path", spaces are encoded as '%20'. * For links to "wiki"s, or similar software, spaces are encoded as '_', * - * @param $parser Parser object + * @param Parser $parser * @param string $s The text to encode. * @param string $arg (optional): The type of encoding. * @return string @@ -186,7 +186,7 @@ class CoreParserFunctions { } /** - * @param $parser Parser + * @param Parser $parser * @param string $s * @return */ @@ -196,7 +196,7 @@ class CoreParserFunctions { } /** - * @param $parser Parser + * @param Parser $parser * @param string $s * @return */ @@ -265,7 +265,7 @@ class CoreParserFunctions { } /** - * @param $parser Parser + * @param Parser $parser * @param string $num * @param string $arg * @return string @@ -282,7 +282,7 @@ class CoreParserFunctions { } /** - * @param $parser Parser + * @param Parser $parser * @param string $case * @param string $word * @return @@ -293,8 +293,8 @@ class CoreParserFunctions { } /** - * @param $parser Parser - * @param $username string + * @param Parser $parser + * @param string $username * @return */ static function gender( $parser, $username ) { @@ -335,7 +335,7 @@ class CoreParserFunctions { } /** - * @param $parser Parser + * @param Parser $parser * @param string $text * @return */ @@ -350,9 +350,9 @@ class CoreParserFunctions { * Override the title of the page when viewed, provided we've been given a * title which will normalise to the canonical title * - * @param $parser Parser: parent parser - * @param string $text desired title text - * @return String + * @param Parser $parser Parent parser + * @param string $text Desired title text + * @return string */ static function displaytitle( $parser, $text = '' ) { global $wgRestrictDisplayTitle; @@ -408,9 +408,9 @@ class CoreParserFunctions { /** * Matches the given value against the value of given magic word * - * @param string $magicword magic word key - * @param mixed $value value to match - * @return boolean true on successful match + * @param string $magicword Magic word key + * @param string $value Value to match + * @return bool True on successful match */ private static function matchAgainstMagicword( $magicword, $value ) { $value = trim( strval( $value ) ); @@ -521,7 +521,7 @@ class CoreParserFunctions { /** * Functions to get and normalize pagenames, corresponding to the magic words * of the same names - * @return String + * @return string */ static function pagename( $parser, $title = null ) { $t = Title::newFromText( $title ); @@ -690,9 +690,9 @@ class CoreParserFunctions { * Return the size of the given page, or 0 if it's nonexistent. This is an * expensive parser function and can't be called too many times per page. * - * @param $parser Parser - * @param $page String Name of page to check (Default: empty string) - * @param $raw String Should number be human readable with commas or just number + * @param Parser $parser + * @param string $page Name of page to check (Default: empty string) + * @param string $raw Should number be human readable with commas or just number * @return string */ static function pagesize( $parser, $page = '', $raw = null ) { @@ -736,10 +736,10 @@ class CoreParserFunctions { /** * Gives language names. - * @param $parser Parser - * @param string $code Language code (of which to get name) - * @param string $inLanguage Language code (in which to get name) - * @return String + * @param Parser $parser + * @param string $code Language code (of which to get name) + * @param string $inLanguage Language code (in which to get name) + * @return string */ static function language( $parser, $code = '', $inLanguage = '' ) { $code = strtolower( $code ); @@ -750,6 +750,11 @@ class CoreParserFunctions { /** * Unicode-safe str_pad with the restriction that $length is forced to be <= 500 + * @param Parser $parser + * @param string $string + * @param int $length + * @param string $padding + * @param int $direction * @return string */ static function pad( $parser, $string, $length, $padding = '0', $direction = STR_PAD_RIGHT ) { @@ -787,8 +792,8 @@ class CoreParserFunctions { } /** - * @param $parser Parser - * @param $text + * @param Parser $parser + * @param string $text * @return string */ static function anchorencode( $parser, $text ) { @@ -813,7 +818,7 @@ class CoreParserFunctions { } /** - * @param $parser Parser + * @param Parser $parser * @param string $text The sortkey to use * @param string $uarg Either "noreplace" or "noerror" (in en) * both suppress errors, and noreplace does nothing if @@ -888,6 +893,9 @@ class CoreParserFunctions { /** * Parser function to extension tag adaptor + * @param Parser $parser + * @param PPFrame $frame + * @param array $args * @return string */ public static function tagObj( $parser, $frame, $args ) { @@ -938,8 +946,8 @@ class CoreParserFunctions { * For a given title, which is equal to the current parser title, * the revision object from the parser is used, when that is the current one * - * @param $parser Parser - * @param $title Title + * @param Parser $parser + * @param Title $title * @return Revision * @since 1.23 */ @@ -985,8 +993,8 @@ class CoreParserFunctions { /** * Get the pageid of a specified page - * @param $parser Parser - * @param $title string Title to get the pageid from + * @param Parser $parser + * @param string $title Title to get the pageid from * @since 1.23 */ public static function pageid( $parser, $title = null ) { @@ -1029,8 +1037,8 @@ class CoreParserFunctions { /** * Get the id from the last revision of a specified page. - * @param $parser Parser - * @param $title string Title to get the id from + * @param Parser $parser + * @param string $title Title to get the id from * @since 1.23 */ public static function revisionid( $parser, $title = null ) { @@ -1045,8 +1053,8 @@ class CoreParserFunctions { /** * Get the day from the last revision of a specified page. - * @param $parser Parser - * @param $title string Title to get the day from + * @param Parser $parser + * @param string $title Title to get the day from * @since 1.23 */ public static function revisionday( $parser, $title = null ) { @@ -1061,8 +1069,8 @@ class CoreParserFunctions { /** * Get the day with leading zeros from the last revision of a specified page. - * @param $parser Parser - * @param $title string Title to get the day from + * @param Parser $parser + * @param string $title Title to get the day from * @since 1.23 */ public static function revisionday2( $parser, $title = null ) { @@ -1077,8 +1085,8 @@ class CoreParserFunctions { /** * Get the month with leading zeros from the last revision of a specified page. - * @param $parser Parser - * @param $title string Title to get the month from + * @param Parser $parser + * @param string $title Title to get the month from * @since 1.23 */ public static function revisionmonth( $parser, $title = null ) { @@ -1093,8 +1101,8 @@ class CoreParserFunctions { /** * Get the month from the last revision of a specified page. - * @param $parser Parser - * @param $title string Title to get the month from + * @param Parser $parser + * @param string $title Title to get the month from * @since 1.23 */ public static function revisionmonth1( $parser, $title = null ) { @@ -1109,8 +1117,8 @@ class CoreParserFunctions { /** * Get the year from the last revision of a specified page. - * @param $parser Parser - * @param $title string Title to get the year from + * @param Parser $parser + * @param string $title Title to get the year from * @since 1.23 */ public static function revisionyear( $parser, $title = null ) { @@ -1125,8 +1133,8 @@ class CoreParserFunctions { /** * Get the timestamp from the last revision of a specified page. - * @param $parser Parser - * @param $title string Title to get the timestamp from + * @param Parser $parser + * @param string $title Title to get the timestamp from * @since 1.23 */ public static function revisiontimestamp( $parser, $title = null ) { @@ -1141,8 +1149,8 @@ class CoreParserFunctions { /** * Get the user from the last revision of a specified page. - * @param $parser Parser - * @param $title string Title to get the user from + * @param Parser $parser + * @param string $title Title to get the user from * @since 1.23 */ public static function revisionuser( $parser, $title = null ) { diff --git a/includes/parser/CoreTagHooks.php b/includes/parser/CoreTagHooks.php index cbc060a926..01ad97c3bd 100644 --- a/includes/parser/CoreTagHooks.php +++ b/includes/parser/CoreTagHooks.php @@ -27,7 +27,7 @@ */ class CoreTagHooks { /** - * @param $parser Parser + * @param Parser $parser * @return void */ static function register( $parser ) { @@ -69,9 +69,9 @@ class CoreTagHooks { * * Uses undocumented extended tag hook return values, introduced in r61913. * - * @param $content string - * @param $attributes array - * @param $parser Parser + * @param string $content + * @param array $attributes + * @param Parser $parser * @throws MWException * @return array */ @@ -91,9 +91,9 @@ class CoreTagHooks { * * Uses undocumented extended tag hook return values, introduced in r61913. * - * @param $content string - * @param $attributes array - * @param $parser Parser + * @param string $content + * @param array $attributes + * @param Parser $parser * @return array */ static function nowiki( $content, $attributes, $parser ) { diff --git a/includes/parser/DateFormatter.php b/includes/parser/DateFormatter.php index d10841f4f8..3ddc9d4764 100644 --- a/includes/parser/DateFormatter.php +++ b/includes/parser/DateFormatter.php @@ -49,7 +49,7 @@ class DateFormatter { const LAST = 8; /** - * @param $lang Language In which language to format the date + * @param Language $lang In which language to format the date */ function __construct( Language $lang ) { $this->lang = $lang; @@ -120,7 +120,7 @@ class DateFormatter { /** * Get a DateFormatter object * - * @param $lang Language|string|null In which language to format the date + * @param Language|string|null $lang In which language to format the date * Defaults to the site content language * @return DateFormatter object */ @@ -142,7 +142,7 @@ class DateFormatter { /** * @param string $preference User preference * @param string $text Text to reformat - * @param array $options can contain 'linked' and/or 'match-whole' + * @param array $options Array can contain 'linked' and/or 'match-whole' * * @return string */ @@ -193,7 +193,7 @@ class DateFormatter { } /** - * @param $matches + * @param array $matches * @return string */ function replace( $matches ) { @@ -215,8 +215,8 @@ class DateFormatter { } /** - * @param $bits array - * @param $link bool + * @param array $bits + * @param bool $link * @return string */ function formatDate( $bits, $link = true ) { @@ -326,7 +326,7 @@ class DateFormatter { /** * Makes an ISO month, e.g. 02, from a month name - * @param string $monthName month name + * @param string $monthName Month name * @return string ISO month name */ function makeIsoMonth( $monthName ) { diff --git a/includes/parser/LinkHolderArray.php b/includes/parser/LinkHolderArray.php index 0e7c76f4ce..2f95af2eed 100644 --- a/includes/parser/LinkHolderArray.php +++ b/includes/parser/LinkHolderArray.php @@ -49,8 +49,8 @@ class LinkHolderArray { * serializing at present. * * Compact the titles, only serialize the text form. - * @return array - */ + * @return array + */ function __sleep() { foreach ( $this->internals as &$nsLinks ) { foreach ( $nsLinks as &$entry ) { @@ -88,7 +88,7 @@ class LinkHolderArray { /** * Merge another LinkHolderArray into this one - * @param $other LinkHolderArray + * @param LinkHolderArray $other */ function merge( $other ) { foreach ( $other->internals as $ns => $entries ) { @@ -110,9 +110,9 @@ class LinkHolderArray { * converted for use in the destination link holder. The resulting array of * strings will be returned. * - * @param $other LinkHolderArray - * @param array $texts of strings - * @return Array + * @param LinkHolderArray $other + * @param array $texts Array of strings + * @return array */ function mergeForeign( $other, $texts ) { $this->tempIdOffset = $idOffset = $this->parent->nextLinkID(); @@ -208,8 +208,8 @@ class LinkHolderArray { * parsing of interwiki links, and secondly to allow all existence checks and * article length checks (for stub links) to be bundled into a single query. * - * @param $nt Title - * @param $text String + * @param Title $nt + * @param string $text * @param array $query [optional] * @param string $trail [optional] * @param string $prefix [optional] @@ -253,7 +253,7 @@ class LinkHolderArray { /** * Replace link placeholders with actual links, in the buffer * - * @return array of link CSS classes, indexed by PDBK. + * @return array Array of link CSS classes, indexed by PDBK. */ function replace( &$text ) { wfProfileIn( __METHOD__ ); @@ -267,6 +267,7 @@ class LinkHolderArray { /** * Replace internal links + * @param string $text */ protected function replaceInternal( &$text ) { if ( !$this->internals ) { @@ -418,6 +419,7 @@ class LinkHolderArray { /** * Replace interwiki links + * @param string $text */ protected function replaceInterwiki( &$text ) { if ( empty( $this->interwikis ) ) { @@ -443,6 +445,7 @@ class LinkHolderArray { /** * Modify $this->internals and $colours according to language variant linking rules + * @param array $colours */ protected function doVariants( &$colours ) { global $wgContLang; @@ -606,8 +609,8 @@ class LinkHolderArray { * Replace link placeholders with plain text of links * (not HTML-formatted). * - * @param $text String - * @return String + * @param string $text + * @return string */ function replaceText( $text ) { wfProfileIn( __METHOD__ ); @@ -624,7 +627,7 @@ class LinkHolderArray { /** * Callback for replaceText() * - * @param $matches Array + * @param array $matches * @return string * @private */ diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index 68188843c5..7423006788 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -205,7 +205,7 @@ class Parser { var $mUniqPrefix; /** - * @var Array with the language name of each language link (i.e. the + * @var array Array with the language name of each language link (i.e. the * interwiki prefix) in the key, value arbitrary. Used to avoid sending * duplicate language links to the ParserOutput. */ @@ -214,7 +214,7 @@ class Parser { /** * Constructor * - * @param $conf array + * @param array $conf */ public function __construct( $conf = array() ) { $this->mConf = $conf; @@ -346,12 +346,12 @@ class Parser { * Do not call this function recursively. * * @param string $text text we want to parse - * @param $title Title object - * @param $options ParserOptions - * @param $linestart boolean - * @param $clearState boolean - * @param int $revid number to pass in {{REVISIONID}} - * @return ParserOutput a ParserOutput + * @param Title $title + * @param ParserOptions $options + * @param bool $linestart + * @param bool $clearState + * @param int $revid Number to pass in {{REVISIONID}} + * @return ParserOutput A ParserOutput */ public function parse( $text, Title $title, ParserOptions $options, $linestart = true, $clearState = true, $revid = null ) { /** @@ -590,7 +590,7 @@ class Parser { * * If $frame is not provided, then template variables (e.g., {{{1}}}) within $text are not expanded * - * @param string $text text extension wants to have parsed + * @param string $text Text extension wants to have parsed * @param PPFrame $frame The frame to use for expanding any template variables * * @return string @@ -607,6 +607,10 @@ class Parser { /** * Expand templates and variables in the text, producing valid, static wikitext. * Also removes comments. + * @param string $text + * @param Title $title + * @param ParserOptions $options + * @param int|null $revid * @return mixed|string */ function preprocess( $text, Title $title = null, ParserOptions $options, $revid = null ) { @@ -627,7 +631,7 @@ class Parser { * Recursive parser entry point that can be called from an extension tag * hook. * - * @param string $text text to be expanded + * @param string $text Text to be expanded * @param PPFrame $frame The frame to use for expanding any template variables * @return string * @since 1.19 @@ -647,11 +651,11 @@ class Parser { * transclusion, comments, templates, arguments, tags hooks and parser * functions are untouched. * - * @param $text String - * @param $title Title - * @param $options ParserOptions - * @param $params Array - * @return String + * @param string $text + * @param Title $title + * @param ParserOptions $options + * @param array $params + * @return string */ public function getPreloadText( $text, Title $title, ParserOptions $options, $params = array() ) { $msg = new RawMessage( $text ); @@ -689,7 +693,7 @@ class Parser { /** * Accessor for mUniqPrefix. * - * @return String + * @return string */ public function uniqPrefix() { if ( !isset( $this->mUniqPrefix ) ) { @@ -707,7 +711,7 @@ class Parser { /** * Set the context title * - * @param $t Title + * @param Title $t */ function setTitle( $t ) { if ( !$t ) { @@ -726,7 +730,7 @@ class Parser { /** * Accessor for the Title object * - * @return Title object + * @return Title */ function getTitle() { return $this->mTitle; @@ -735,8 +739,8 @@ class Parser { /** * Accessor/mutator for the Title object * - * @param $x Title object or null to just get the current one - * @return Title object + * @param Title $x Title object or null to just get the current one + * @return Title */ function Title( $x = null ) { return wfSetVar( $this->mTitle, $x ); @@ -745,7 +749,7 @@ class Parser { /** * Set the output type * - * @param int $ot new value + * @param int $ot New value */ function setOutputType( $ot ) { $this->mOutputType = $ot; @@ -762,7 +766,7 @@ class Parser { * Accessor/mutator for the output type * * @param int|null $x New value or null to just get the current one - * @return Integer + * @return int */ function OutputType( $x = null ) { return wfSetVar( $this->mOutputType, $x ); @@ -771,7 +775,7 @@ class Parser { /** * Get the ParserOutput object * - * @return ParserOutput object + * @return ParserOutput */ function getOutput() { return $this->mOutput; @@ -789,7 +793,7 @@ class Parser { /** * Accessor/mutator for the ParserOptions object * - * @param $x ParserOptions New value or null to just get the current one + * @param ParserOptions $x New value or null to just get the current one * @return ParserOptions Current ParserOptions object */ function Options( $x = null ) { @@ -804,7 +808,7 @@ class Parser { } /** - * @param $id int + * @param int $id */ function setLinkID( $id ) { $this->mLinkID = $id; @@ -843,6 +847,7 @@ class Parser { /** * Get the language object for language conversion + * @return Language|null */ function getConverterLanguage() { return $this->getTargetLanguage(); @@ -852,7 +857,7 @@ class Parser { * Get a User object either from $this->mUser, if set, or from the * ParserOptions object otherwise * - * @return User object + * @return User */ function getUser() { if ( !is_null( $this->mUser ) ) { @@ -864,7 +869,7 @@ class Parser { /** * Get a preprocessor object * - * @return Preprocessor instance + * @return Preprocessor */ function getPreprocessor() { if ( !isset( $this->mPreprocessor ) ) { @@ -970,7 +975,7 @@ class Parser { * Returns the unique tag which must be inserted into the stripped text * The tag will be replaced with the original text in unstrip() * - * @param $text string + * @param string $text * * @return string */ @@ -985,6 +990,7 @@ class Parser { * parse the wiki syntax used to render tables * * @private + * @param string $text * @return string */ function doTableStuff( $text ) { @@ -1183,9 +1189,9 @@ class Parser { * * @private * - * @param $text string - * @param $isMain bool - * @param $frame bool + * @param string $text + * @param bool $isMain + * @param bool $frame * * @return string */ @@ -1253,7 +1259,7 @@ class Parser { * DML * @private * - * @param $text string + * @param string $text * * @return string */ @@ -1279,7 +1285,7 @@ class Parser { /** * @throws MWException - * @param $m array + * @param array $m * @return HTML|string */ function magicLinkCallback( $m ) { @@ -1330,7 +1336,7 @@ class Parser { /** * Make a free external link, given a user-supplied URL * - * @param $url string + * @param string $url * * @return string HTML * @private @@ -1386,7 +1392,7 @@ class Parser { * * @private * - * @param $text string + * @param string $text * * @return string */ @@ -1404,7 +1410,7 @@ class Parser { * Replace single quotes with HTML markup * @private * - * @param $text string + * @param string $text * * @return string the altered text */ @@ -1423,7 +1429,7 @@ class Parser { /** * Helper function for doAllQuotes() * - * @param $text string + * @param string $text * * @return string */ @@ -1612,7 +1618,7 @@ class Parser { * * @private * - * @param $text string + * @param string $text * * @throws MWException * @return string @@ -1693,10 +1699,10 @@ class Parser { * Get the rel attribute for a particular external link. * * @since 1.21 - * @param string|bool $url optional URL, to extract the domain from for rel => + * @param string|bool $url Optional URL, to extract the domain from for rel => * nofollow if appropriate - * @param $title Title optional Title, for wgNoFollowNsExceptions lookups - * @return string|null rel attribute for $url + * @param Title $title Optional Title, for wgNoFollowNsExceptions lookups + * @return string|null Rel attribute for $url */ public static function getExternalLinkRel( $url = false, $title = null ) { global $wgNoFollowLinks, $wgNoFollowNsExceptions, $wgNoFollowDomainExceptions; @@ -1715,9 +1721,9 @@ class Parser { * (depending on configuration, namespace, and the URL's domain) and/or a * target attribute (depending on configuration). * - * @param string|bool $url optional URL, to extract the domain from for rel => + * @param string|bool $url Optional URL, to extract the domain from for rel => * nofollow if appropriate - * @return Array associative array of HTML attributes + * @return array Associative array of HTML attributes */ function getExternalLinkAttribs( $url = false ) { $attribs = array(); @@ -1732,8 +1738,8 @@ class Parser { /** * Replace unusual URL escape codes with their equivalent characters * - * @param $url String - * @return String + * @param string $url + * @return string * * @todo This can merge genuinely required bits in the path or query string, * breaking legit URLs. A proper fix would treat the various parts of @@ -1749,7 +1755,7 @@ class Parser { * Callback function used in replaceUnusualEscapes(). * Replaces unusual URL escape codes with their equivalent character * - * @param $matches array + * @param array $matches * * @return string */ @@ -1771,7 +1777,7 @@ class Parser { * option, through the exception, or through the on-wiki whitelist * @private * - * $param $url string + * $param string $url * * @return string */ @@ -1834,7 +1840,7 @@ class Parser { /** * Process [[ ]] wikilinks (RIL) - * @param $s + * @param string $s * @throws MWException * @return LinkHolderArray * @@ -2214,7 +2220,7 @@ class Parser { /** * Return true if subpage links should be expanded on this page. - * @return Boolean + * @return bool */ function areSubpagesAllowed() { # Some namespaces don't allow subpages @@ -2254,8 +2260,8 @@ class Parser { * of both arguments, starting at the beginning of both. * @private * - * @param $st1 string - * @param $st2 string + * @param string $st1 + * @param string $st2 * * @return int */ @@ -2279,7 +2285,7 @@ class Parser { * element appropriate to the prefix character passed into them. * @private * - * @param $char string + * @param string $char * * @return string */ @@ -2304,7 +2310,7 @@ class Parser { /** * TODO: document - * @param $char String + * @param string $char * @private * * @return string @@ -2330,7 +2336,7 @@ class Parser { /** * TODO: document - * @param $char String + * @param string $char * @private * * @return string @@ -2550,11 +2556,11 @@ class Parser { * Split up a string on ':', ignoring any occurrences inside tags * to prevent illegal overlapping. * - * @param string $str the string to split - * @param &$before String set to everything before the ':' - * @param &$after String set to everything after the ':' + * @param string $str The string to split + * @param string &$before Set to everything before the ':' + * @param string &$after Set to everything after the ':' * @throws MWException - * @return String the position of the ':', or false if none found + * @return string The position of the ':', or false if none found */ function findColonNoLinks( $str, &$before, &$after ) { wfProfileIn( __METHOD__ ); @@ -2718,8 +2724,8 @@ class Parser { * * @private * - * @param $index integer - * @param bool|\PPFrame $frame + * @param int $index + * @param bool|PPFrame $frame * * @throws MWException * @return string @@ -3098,7 +3104,7 @@ class Parser { /** * Return a three-element array: leading whitespace, string contents, trailing whitespace * - * @param $s string + * @param string $s * * @return array */ @@ -3125,11 +3131,11 @@ class Parser { * self::OT_PREPROCESS: templates but not extension tags * self::OT_HTML: all templates and extension tags * - * @param string $text the text to transform - * @param $frame PPFrame Object describing the arguments passed to the template. + * @param string $text The text to transform + * @param PPFrame $frame Object describing the arguments passed to the template. * Arguments may also be provided as an associative array, as was the usual case before MW1.12. * Providing arguments this way may be useful for extensions wishing to perform variable replacement explicitly. - * @param $argsOnly Boolean only do argument (triple-brace) expansion, not double-brace expansion + * @param bool $argsOnly Only do argument (triple-brace) expansion, not double-brace expansion * @private * * @return string @@ -3159,7 +3165,7 @@ class Parser { /** * Clean up argument array - refactored in 1.9 so parserfunctions can use it, too. * - * @param $args array + * @param array $args * * @return array */ @@ -3189,7 +3195,7 @@ class Parser { * Warn the user when a parser limitation is reached * Will warn at most once the user per limitation type * - * @param string $limitationType should be one of: + * @param string $limitationType Should be one of: * 'expensive-parserfunction' (corresponding messages: * 'expensive-parserfunction-warning', * 'expensive-parserfunction-category') @@ -3555,9 +3561,9 @@ class Parser { * nowiki: bool, wiki markup in $text should be escaped * * @since 1.21 - * @param $frame PPFrame The current frame, contains template arguments - * @param $function string Function name - * @param $args array Arguments to the function + * @param PPFrame $frame The current frame, contains template arguments + * @param string $function Function name + * @param array $args Arguments to the function * @return array */ public function callParserFunction( $frame, $function, array $args = array() ) { @@ -3660,7 +3666,7 @@ class Parser { * Get the semi-parsed DOM representation of a template with a given title, * and its redirect destination title. Cached. * - * @param $title Title + * @param Title $title * * @return array */ @@ -3699,7 +3705,7 @@ class Parser { /** * Fetch the unparsed text of a template and register a reference to it. * @param Title $title - * @return Array ( string or false, Title ) + * @return array ( string or false, Title ) */ function fetchTemplateAndTitle( $title ) { $templateCb = $this->mOptions->getTemplateCallback(); # Defaults to Parser::statelessFetchTemplate() @@ -3722,7 +3728,7 @@ class Parser { /** * Fetch the unparsed text of a template and register a reference to it. * @param Title $title - * @return mixed string or false + * @return string|bool */ function fetchTemplate( $title ) { $rv = $this->fetchTemplateAndTitle( $title ); @@ -3832,7 +3838,7 @@ class Parser { * If 'broken' is a key in $options then the file will appear as a broken thumbnail. * @param Title $title * @param array $options Array of options to RepoGroup::findFile - * @return Array ( File or false, Title of file ) + * @return array ( File or false, Title of file ) */ function fetchFileAndTitle( $title, $options = array() ) { $file = $this->fetchFileNoRegister( $title, $options ); @@ -3857,7 +3863,7 @@ class Parser { * * @param Title $title * @param array $options Array of options to RepoGroup::findFile - * @return File or false + * @return File|bool */ protected function fetchFileNoRegister( $title, $options = array() ) { if ( isset( $options['broken'] ) ) { @@ -3873,8 +3879,8 @@ class Parser { /** * Transclude an interwiki link. * - * @param $title Title - * @param $action + * @param Title $title + * @param string $action * * @return string */ @@ -3894,8 +3900,8 @@ class Parser { } /** - * @param $url string - * @return Mixed|String + * @param string $url + * @return mixed|string */ function fetchScaryTemplateMaybeFromCache( $url ) { global $wgTranscludeCacheExpiry; @@ -3930,8 +3936,8 @@ class Parser { * Triple brace replacement -- used for template arguments * @private * - * @param $piece array - * @param $frame PPFrame + * @param array $piece + * @param PPFrame $frame * * @return array */ @@ -3985,7 +3991,7 @@ class Parser { * attributes Optional associative array of parsed attributes * inner Contents of extension element * noClose Original text did not have a close tag - * @param $frame PPFrame + * @param PPFrame $frame * * @throws MWException * @return string @@ -4071,7 +4077,7 @@ class Parser { * * @param string $type The type of expansion * @param int $size The size of the text - * @return bool false if this inclusion would take it over the maximum, true otherwise + * @return bool False if this inclusion would take it over the maximum, true otherwise */ function incrementIncludeSize( $type, $size ) { if ( $this->mIncludeSizes[$type] + $size > $this->mOptions->getMaxIncludeSize() ) { @@ -4085,7 +4091,7 @@ class Parser { /** * Increment the expensive function count * - * @return bool false if the limit has been exceeded + * @return bool False if the limit has been exceeded */ function incrementExpensiveFunctionCount() { $this->mExpensiveFunctionCount++; @@ -4096,7 +4102,7 @@ class Parser { * Strip double-underscore items like __NOGALLERY__ and __NOTOC__ * Fills $this->mDoubleUnderscores, returns the modified text * - * @param $text string + * @param string $text * * @return string */ @@ -4198,9 +4204,9 @@ class Parser { * It loops through all headlines, collects the necessary data, then splits up the * string and re-inserts the newly formatted headlines. * - * @param $text String - * @param string $origText original, untouched wikitext - * @param $isMain Boolean + * @param string $text + * @param string $origText Original, untouched wikitext + * @param bool $isMain * @return mixed|string * @private */ @@ -4607,8 +4613,8 @@ class Parser { /** * Pre-save transform helper function * - * @param $text string - * @param $user User + * @param string $text + * @param User $user * * @return string */ @@ -4690,10 +4696,10 @@ class Parser { * Do not reuse this parser instance after calling getUserSig(), * as it may have changed if it's the $wgParser. * - * @param $user User - * @param string|bool $nickname nickname to use or false to use user's default nickname - * @param $fancySig Boolean|null whether the nicknname is the complete signature - * or null to use default value + * @param User $user + * @param string|bool $nickname Nickname to use or false to use user's default nickname + * @param bool|null $fancySig whether the nicknname is the complete signature + * or null to use default value * @return string */ function getUserSig( &$user, $nickname = false, $fancySig = null ) { @@ -4741,8 +4747,8 @@ class Parser { /** * Check that the user's signature contains no bad XML * - * @param $text String - * @return mixed An expanded string, or false if invalid. + * @param string $text + * @return string|bool An expanded string, or false if invalid. */ function validateSig( $text ) { return Xml::isWellFormedXmlFragment( $text ) ? $text : false; @@ -4803,20 +4809,20 @@ class Parser { * Set up some variables which are usually set up in parse() * so that an external function can call some class members with confidence * - * @param $title Title|null - * @param $options ParserOptions - * @param $outputType - * @param $clearState bool + * @param Title|null $title + * @param ParserOptions $options + * @param int $outputType + * @param bool $clearState */ public function startExternalParse( Title $title = null, ParserOptions $options, $outputType, $clearState = true ) { $this->startParse( $title, $options, $outputType, $clearState ); } /** - * @param $title Title|null - * @param $options ParserOptions - * @param $outputType - * @param $clearState bool + * @param Title|null $title + * @param ParserOptions $options + * @param int $outputType + * @param bool $clearState */ private function startParse( Title $title = null, ParserOptions $options, $outputType, $clearState = true ) { $this->setTitle( $title ); @@ -5011,7 +5017,7 @@ class Parser { /** * Get all registered function hook identifiers * - * @return Array + * @return array */ function getFunctionHooks() { return array_keys( $this->mFunctionHooks ); @@ -5021,9 +5027,9 @@ class Parser { * Create a tag function, e.g. "some stuff". * Unlike tag hooks, tag functions are parsed at preprocessor level. * Unlike parser functions, their content is not preprocessed. - * @param $tag - * @param $callback - * @param $flags + * @param string $tag + * @param callable $callback + * @param int $flags * @throws MWException * @return null */ @@ -5048,10 +5054,10 @@ class Parser { * Replace "" link placeholders with actual links, in the buffer * Placeholders created in Skin::makeLinkObj() * - * @param $text string - * @param $options int + * @param string $text + * @param int $options * - * @return array of link CSS classes, indexed by PDBK. + * @return array Array of link CSS classes, indexed by PDBK. */ function replaceLinkHolders( &$text, $options = 0 ) { return $this->mLinkHolders->replace( $text ); @@ -5061,8 +5067,8 @@ class Parser { * Replace "" link placeholders with plain text of links * (not HTML-formatted). * - * @param $text String - * @return String + * @param string $text + * @return string */ function replaceLinkHoldersText( $text ) { return $this->mLinkHolders->replaceText( $text ); @@ -5238,7 +5244,7 @@ class Parser { } /** - * @param $handler + * @param string $handler * @return array */ function getImageParams( $handler ) { @@ -5284,9 +5290,9 @@ class Parser { /** * Parse image options text and use it to make an image * - * @param $title Title - * @param $options String - * @param $holders LinkHolderArray|bool + * @param Title $title + * @param string $options + * @param LinkHolderArray|bool $holders * @return string HTML */ function makeImage( $title, $options, $holders = false ) { @@ -5501,9 +5507,9 @@ class Parser { } /** - * @param $caption - * @param $holders LinkHolderArray - * @return mixed|String + * @param string $caption + * @param LinkHolderArray $holders + * @return mixed|string */ protected function stripAltText( $caption, $holders ) { # Strip bad stuff out of the title (tooltip). We can't just use @@ -5542,9 +5548,9 @@ class Parser { * Callback from the Sanitizer for expanding items found in HTML attribute * values, so they can be safely tested and escaped. * - * @param $text String - * @param $frame PPFrame - * @return String + * @param string $text + * @param PPFrame $frame + * @return string */ function attributeStripCallback( &$text, $frame = false ) { $text = $this->replaceVariables( $text, $frame ); @@ -5567,7 +5573,7 @@ class Parser { * Transparent tag hooks are like regular XML-style tag hooks, except they * operate late in the transformation sequence, on HTML instead of wikitext. * - * @param $text string + * @param string $text * * @return string */ @@ -5597,7 +5603,7 @@ class Parser { * External callers should use the getSection and replaceSection methods. * * @param string $text Page wikitext - * @param string $section a section identifier string of the form: + * @param string $section A section identifier string of the form: * " - - ... -
" * * Currently the only recognised flag is "T", which means the target section number @@ -5735,10 +5741,10 @@ class Parser { * * If a section contains subsections, these are also returned. * - * @param string $text text to look in - * @param string $section section identifier - * @param string $deftext default to return if section is not found - * @return string text of the requested section + * @param string $text Text to look in + * @param string $section Section identifier + * @param string $deftext Default to return if section is not found + * @return string Text of the requested section */ public function getSection( $text, $section, $deftext = '' ) { return $this->extractSections( $text, $section, "get", $deftext ); @@ -5770,7 +5776,7 @@ class Parser { /** * Get the revision object for $this->mRevisionId * - * @return Revision|null either a Revision object or null + * @return Revision|null Either a Revision object or null * @since 1.23 (public since 1.23) */ public function getRevisionObject() { @@ -5788,6 +5794,7 @@ class Parser { /** * Get the timestamp associated with the current revision, adjusted for * the default server-local timestamp + * @return string */ function getRevisionTimestamp() { if ( is_null( $this->mRevisionTimestamp ) ) { @@ -5834,7 +5841,7 @@ class Parser { /** * Get the size of the revision * - * @return int|null revision size + * @return int|null Revision size */ function getRevisionSize() { if ( is_null( $this->mRevisionSize ) ) { @@ -5884,7 +5891,7 @@ class Parser { * Accessor for $mDefaultSort * Unlike getDefaultSort(), will return false if none is set * - * @return string or false + * @return string|bool */ public function getCustomDefaultSort() { return $this->mDefaultSort; @@ -5895,7 +5902,7 @@ class Parser { * presumably extracted from a heading, for example "Header" from * "== Header ==". * - * @param $text string + * @param string $text * * @return string */ @@ -5931,7 +5938,7 @@ class Parser { * to create valid section anchors by mimicing the output of the * parser when headings are parsed. * - * @param string $text text string to be stripped of wikitext + * @param string $text Text string to be stripped of wikitext * for use in a Section anchor * @return string Filtered text string */ @@ -5957,10 +5964,10 @@ class Parser { /** * strip/replaceVariables/unstrip for preprocessor regression testing * - * @param $text string - * @param $title Title - * @param $options ParserOptions - * @param $outputType int + * @param string $text + * @param Title $title + * @param ParserOptions $options + * @param int $outputType * * @return string */ @@ -5974,9 +5981,9 @@ class Parser { } /** - * @param $text string - * @param $title Title - * @param $options ParserOptions + * @param string $text + * @param Title $title + * @param ParserOptions $options * @return string */ function testPst( $text, Title $title, ParserOptions $options ) { @@ -5984,9 +5991,9 @@ class Parser { } /** - * @param $text - * @param $title Title - * @param $options ParserOptions + * @param string $text + * @param Title $title + * @param ParserOptions $options * @return string */ function testPreprocess( $text, Title $title, ParserOptions $options ) { @@ -6004,8 +6011,8 @@ class Parser { * two strings will be replaced with the value returned by the callback in * each case. * - * @param $s string - * @param $callback + * @param string $s + * @param callable $callback * * @return string */ @@ -6036,7 +6043,7 @@ class Parser { /** * Remove any strip markers found in the given text. * - * @param $text Input string + * @param string $text Input string * @return string */ function killMarkers( $text ) { @@ -6055,7 +6062,7 @@ class Parser { * unserializeHalfParsedText(). The text can then be safely incorporated into * the return value of a parser hook. * - * @param $text string + * @param string $text * * @return array */ @@ -6084,7 +6091,7 @@ class Parser { * * @param array $data Serialized data * @throws MWException - * @return String + * @return string */ function unserializeHalfParsedText( $data ) { if ( !isset( $data['version'] ) || $data['version'] != self::HALF_PARSED_VERSION ) { @@ -6107,7 +6114,7 @@ class Parser { * serializeHalfParsedText(), is compatible with the current version of the * parser. * - * @param $data Array + * @param array $data * * @return bool */ @@ -6118,7 +6125,7 @@ class Parser { /** * Parsed a width param of imagelink like 300px or 200x300px * - * @param $value String + * @param string $value * * @return array * @since 1.20 diff --git a/includes/parser/ParserCache.php b/includes/parser/ParserCache.php index ff74f2a5e5..e374361812 100644 --- a/includes/parser/ParserCache.php +++ b/includes/parser/ParserCache.php @@ -45,7 +45,7 @@ class ParserCache { * Setup a cache pathway with a given back-end storage mechanism. * May be a memcached client or a BagOStuff derivative. * - * @param $memCached Object + * @param MWMemcached $memCached * @throws MWException */ protected function __construct( $memCached ) { @@ -56,8 +56,8 @@ class ParserCache { } /** - * @param $article Article - * @param $hash string + * @param Article $article + * @param string $hash * @return mixed|string */ protected function getParserOutputKey( $article, $hash ) { @@ -72,7 +72,7 @@ class ParserCache { } /** - * @param $article Article + * @param Article $article * @return mixed|string */ protected function getOptionsKey( $article ) { @@ -90,8 +90,8 @@ class ParserCache { * English preferences. That's why we take into account *all* user * options. (r70809 CR) * - * @param $article Article - * @param $popts ParserOptions + * @param Article $article + * @param ParserOptions $popts * @return string */ function getETag( $article, $popts ) { @@ -102,8 +102,8 @@ class ParserCache { /** * Retrieve the ParserOutput from ParserCache, even if it's outdated. - * @param $article Article - * @param $popts ParserOptions + * @param Article $article + * @param ParserOptions $popts * @return ParserOutput|bool False on failure */ public function getDirty( $article, $popts ) { diff --git a/includes/parser/ParserOptions.php b/includes/parser/ParserOptions.php index 21403b494f..7c84b6734b 100644 --- a/includes/parser/ParserOptions.php +++ b/includes/parser/ParserOptions.php @@ -275,7 +275,7 @@ class ParserOptions { * * {{int: }} uses this which used to produce inconsistent link tables (bug 14404). * - * @return Language object + * @return Language * @since 1.19 */ function getUserLangObj() { @@ -286,7 +286,7 @@ class ParserOptions { /** * Same as getUserLangObj() but returns a string instead. * - * @return String Language code + * @return string Language code * @since 1.17 */ function getUserLang() { @@ -344,8 +344,8 @@ class ParserOptions { /** * Constructor - * @param $user User object - * @param $lang Language object + * @param User $user + * @param Language $lang */ function __construct( $user = null, $lang = null ) { if ( $user === null ) { @@ -370,8 +370,8 @@ class ParserOptions { * Get a ParserOptions object from a given user. * Language will be taken from $wgLang. * - * @param $user User object - * @return ParserOptions object + * @param User $user + * @return ParserOptions */ public static function newFromUser( $user ) { return new ParserOptions( $user ); @@ -380,9 +380,9 @@ class ParserOptions { /** * Get a ParserOptions object from a given user and language * - * @param $user User object - * @param $lang Language object - * @return ParserOptions object + * @param User $user + * @param Language $lang + * @return ParserOptions */ public static function newFromUserAndLang( User $user, Language $lang ) { return new ParserOptions( $user, $lang ); @@ -391,8 +391,8 @@ class ParserOptions { /** * Get a ParserOptions object from a IContextSource object * - * @param $context IContextSource object - * @return ParserOptions object + * @param IContextSource $context + * @return ParserOptions */ public static function newFromContext( IContextSource $context ) { return new ParserOptions( $context->getUser(), $context->getLanguage() ); @@ -401,8 +401,8 @@ class ParserOptions { /** * Get user options * - * @param $user User object - * @param $lang Language object + * @param User $user + * @param Language $lang */ private function initialiseFromUser( $user, $lang ) { global $wgInterwikiMagic, $wgAllowExternalImages, @@ -441,6 +441,7 @@ class ParserOptions { /** * Registers a callback for tracking which ParserOptions which are used. * This is a private API with the parser. + * @param callable $callback */ function registerWatcher( $callback ) { $this->onAccessCallback = $callback; @@ -448,7 +449,7 @@ class ParserOptions { /** * Called when an option is accessed. - * @param string $optionName name of the option + * @param string $optionName Name of the option */ public function optionUsed( $optionName ) { if ( $this->onAccessCallback ) { diff --git a/includes/parser/ParserOutput.php b/includes/parser/ParserOutput.php index d1e3e580fc..49e810cef8 100644 --- a/includes/parser/ParserOutput.php +++ b/includes/parser/ParserOutput.php @@ -96,7 +96,7 @@ class ParserOutput extends CacheTime { /** * callback used by getText to replace editsection tokens * @private - * @param $m + * @param array $m * @throws MWException * @return mixed */ @@ -181,8 +181,8 @@ class ParserOutput extends CacheTime { /** * Checks, if a url is pointing to the own server * - * @param string $internal the server to check against - * @param string $url the url to check + * @param string $internal The server to check against + * @param string $url The url to check * @return bool */ static function isLinkInternal( $internal, $url ) { @@ -212,8 +212,8 @@ class ParserOutput extends CacheTime { /** * Record a local or interwiki inline link for saving in future link tables. * - * @param $title Title object - * @param $id Mixed: optional known page_id so we can skip the lookup + * @param Title $title + * @param int|null $id Optional known page_id so we can skip the lookup */ function addLink( Title $title, $id = null ) { if ( $title->isExternal() ) { @@ -247,7 +247,7 @@ class ParserOutput extends CacheTime { * Register a file dependency for this output * @param string $name Title dbKey * @param string $timestamp MW timestamp of file creation (or false if non-existing) - * @param string $sha1 base 36 SHA-1 of file (or false if non-existing) + * @param string $sha1 Base 36 SHA-1 of file (or false if non-existing) * @return void */ function addImage( $name, $timestamp = null, $sha1 = null ) { @@ -259,9 +259,9 @@ class ParserOutput extends CacheTime { /** * Register a template dependency for this output - * @param $title Title - * @param $page_id - * @param $rev_id + * @param Title $title + * @param int $page_id + * @param int $rev_id * @return void */ function addTemplate( $title, $page_id, $rev_id ) { @@ -278,7 +278,7 @@ class ParserOutput extends CacheTime { } /** - * @param $title Title object, must be an interwiki link + * @param Title $title Title object, must be an interwiki link * @throws MWException if given invalid input */ function addInterwikiLink( $title ) { @@ -296,6 +296,8 @@ class ParserOutput extends CacheTime { * Add some text to the "". * If $tag is set, the section with that tag will only be included once * in a given page. + * @param string $section + * @param string|bool $tag */ function addHeadItem( $section, $tag = false ) { if ( $tag !== false ) { @@ -324,8 +326,8 @@ class ParserOutput extends CacheTime { /** * Add one or more variables to be set in mw.config in JavaScript. * - * @param $keys {String|Array} Key or array of key/value pairs. - * @param $value {Mixed} [optional] Value of the configuration variable. + * @param string|array $keys Key or array of key/value pairs. + * @param mixed $value [optional] Value of the configuration variable. * @since 1.23 */ public function addJsConfigVars( $keys, $value = null ) { @@ -342,7 +344,7 @@ class ParserOutput extends CacheTime { /** * Copy items from the OutputPage object into this one * - * @param $out OutputPage object + * @param OutputPage $out */ public function addOutputPageMetadata( OutputPage $out ) { $this->addModules( $out->getModules() ); @@ -369,7 +371,7 @@ class ParserOutput extends CacheTime { /** * Get the title to be used for display * - * @return String + * @return string */ public function getDisplayTitle() { $t = $this->getTitleText(); @@ -465,7 +467,7 @@ class ParserOutput extends CacheTime { /** * Returns the options from its ParserOptions which have been taken * into account to produce this output or false if not available. - * @return mixed Array + * @return array */ public function getUsedOptions() { if ( !isset( $this->mAccessedOptions ) ) { @@ -482,6 +484,7 @@ class ParserOutput extends CacheTime { * @see ParserCache::save * @see ParserOptions::addExtraKey * @see ParserOptions::optionsHash + * @param string $option */ public function recordOption( $option ) { $this->mAccessedOptions[$option] = true; @@ -511,11 +514,11 @@ class ParserOutput extends CacheTime { * * @since 1.20 * - * @param $title Title The title of the page we're updating. If not given, a title object will be created - * based on $this->getTitleText() - * @param $recursive Boolean: queue jobs for recursive updates? + * @param Title $title The title of the page we're updating. If not given, a title object will + * be created based on $this->getTitleText() + * @param bool $recursive Queue jobs for recursive updates? * - * @return Array. An array of instances of DataUpdate + * @return array An array of instances of DataUpdate */ public function getSecondaryDataUpdates( Title $title = null, $recursive = true ) { if ( is_null( $title ) ) { @@ -562,11 +565,10 @@ class ParserOutput extends CacheTime { * @since 1.21 * * @param string $key The key for accessing the data. Extensions should take care to avoid - * conflicts in naming keys. It is suggested to use the extension's name as a - * prefix. + * conflicts in naming keys. It is suggested to use the extension's name as a prefix. * * @param mixed $value The value to set. Setting a value to null is equivalent to removing - * the value. + * the value. */ public function setExtensionData( $key, $value ) { if ( $value === null ) { diff --git a/includes/parser/Parser_DiffTest.php b/includes/parser/Parser_DiffTest.php index aeae234ace..920b6f6621 100644 --- a/includes/parser/Parser_DiffTest.php +++ b/includes/parser/Parser_DiffTest.php @@ -128,7 +128,7 @@ class Parser_DiffTest } /** - * @param $parser Parser + * @param Parser $parser * @return bool */ function onClearState( &$parser ) { diff --git a/includes/parser/Preprocessor.php b/includes/parser/Preprocessor.php index aeacd2e108..4cd5694e08 100644 --- a/includes/parser/Preprocessor.php +++ b/includes/parser/Preprocessor.php @@ -28,7 +28,7 @@ interface Preprocessor { /** * Create a new preprocessor object based on an initialised Parser object * - * @param $parser Parser + * @param Parser $parser */ function __construct( $parser ); @@ -42,7 +42,7 @@ interface Preprocessor { /** * Create a new custom frame for programmatic use of parameter replacement as used in some extensions * - * @param $args array + * @param array $args * * @return PPFrame */ @@ -51,15 +51,15 @@ interface Preprocessor { /** * Create a new custom node for programmatic use of parameter replacement as used in some extensions * - * @param $values + * @param array $values */ function newPartNodeArray( $values ); /** * Preprocess text to a PPNode * - * @param $text - * @param $flags + * @param string $text + * @param int $flags * * @return PPNode */ @@ -148,8 +148,7 @@ interface PPFrame { /** * Returns true if the infinite loop check is OK, false if a loop is detected * - * @param $title - * + * @param Title $title * @return bool */ function loopCheck( $title ); diff --git a/includes/parser/Preprocessor_DOM.php b/includes/parser/Preprocessor_DOM.php index 0e7d42ab05..df3cbeb76e 100644 --- a/includes/parser/Preprocessor_DOM.php +++ b/includes/parser/Preprocessor_DOM.php @@ -56,7 +56,7 @@ class Preprocessor_DOM implements Preprocessor { } /** - * @param $args array + * @param array $args * @return PPCustomFrame_DOM */ function newCustomFrame( $args ) { @@ -64,7 +64,7 @@ class Preprocessor_DOM implements Preprocessor { } /** - * @param $values + * @param array $values * @return PPNode_DOM */ function newPartNodeArray( $values ) { @@ -109,10 +109,10 @@ class Preprocessor_DOM implements Preprocessor { * Preprocess some wikitext and return the document tree. * This is the ghost of Parser::replace_variables(). * - * @param string $text the text to parse - * @param $flags Integer: bitwise combination of: - * Parser::PTD_FOR_INCLUSION Handle "" and "" as if the text is being - * included. Default is to assume a direct page view. + * @param string $text The text to parse + * @param int $flags Bitwise combination of: + * Parser::PTD_FOR_INCLUSION Handle "" and "" as if the text is being + * included. Default is to assume a direct page view. * * The generated DOM tree must depend only on the input text and the flags. * The DOM tree must be the same in OT_HTML and OT_WIKI mode, to avoid a regression of bug 4899. @@ -201,8 +201,8 @@ class Preprocessor_DOM implements Preprocessor { } /** - * @param $text string - * @param $flags int + * @param string $text + * @param int $flags * @return string */ function preprocessToXml( $text, $flags = 0 ) { @@ -947,7 +947,7 @@ class PPFrame_DOM implements PPFrame { /** * Construct a new preprocessor frame. - * @param $preprocessor Preprocessor The parent preprocessor + * @param Preprocessor $preprocessor The parent preprocessor */ function __construct( $preprocessor ) { $this->preprocessor = $preprocessor; @@ -962,6 +962,9 @@ class PPFrame_DOM implements PPFrame { * Create a new child frame * $args is optionally a multi-root PPNode or array containing the template arguments * + * @param bool|array $args + * @param Title|bool $title + * @param int $indexOffset * @return PPTemplateFrame_DOM */ function newChild( $args = false, $title = false, $indexOffset = 0 ) { @@ -1004,8 +1007,8 @@ class PPFrame_DOM implements PPFrame { /** * @throws MWException - * @param $root - * @param $flags int + * @param string|PPNode_DOM|DOMDocument $root + * @param int $flags * @return string */ function expand( $root, $flags = 0 ) { @@ -1228,8 +1231,8 @@ class PPFrame_DOM implements PPFrame { } /** - * @param $sep - * @param $flags + * @param string $sep + * @param int $flags * @return string */ function implodeWithFlags( $sep, $flags /*, ... */ ) { @@ -1260,6 +1263,7 @@ class PPFrame_DOM implements PPFrame { * Implode with no flags specified * This previously called implodeWithFlags but has now been inlined to reduce stack depth * + * @param string $sep * @return string */ function implode( $sep /*, ... */ ) { @@ -1290,6 +1294,7 @@ class PPFrame_DOM implements PPFrame { * Makes an object that, when expand()ed, will be the same as one obtained * with implode() * + * @param string $sep * @return array */ function virtualImplode( $sep /*, ... */ ) { @@ -1318,6 +1323,9 @@ class PPFrame_DOM implements PPFrame { /** * Virtual implode with brackets + * @param string $start + * @param string $sep + * @param string $end * @return array */ function virtualBracketedImplode( $start, $sep, $end /*, ... */ ) { @@ -1394,6 +1402,7 @@ class PPFrame_DOM implements PPFrame { /** * Returns true if the infinite loop check is OK, false if a loop is detected * + * @param Title $title * @return bool */ function loopCheck( $title ) { @@ -1433,11 +1442,11 @@ class PPTemplateFrame_DOM extends PPFrame_DOM { var $numberedExpansionCache, $namedExpansionCache; /** - * @param $preprocessor - * @param $parent PPFrame_DOM - * @param $numberedArgs array - * @param $namedArgs array - * @param $title Title + * @param Preprocessor $preprocessor + * @param PPFrame_DOM $parent + * @param array $numberedArgs + * @param array $namedArgs + * @param Title $title */ function __construct( $preprocessor, $parent = false, $numberedArgs = array(), $namedArgs = array(), $title = false ) { parent::__construct( $preprocessor ); @@ -1656,7 +1665,7 @@ class PPNode_DOM implements PPNode { } /** - * @param $type + * @param string $type * * @return bool|PPNode_DOM */ @@ -1676,7 +1685,7 @@ class PPNode_DOM implements PPNode { } /** - * @param $i + * @param int $i * @return bool|PPNode_DOM */ function item( $i ) { diff --git a/includes/parser/Preprocessor_Hash.php b/includes/parser/Preprocessor_Hash.php index d6edb21426..aebb98e5b8 100644 --- a/includes/parser/Preprocessor_Hash.php +++ b/includes/parser/Preprocessor_Hash.php @@ -47,7 +47,7 @@ class Preprocessor_Hash implements Preprocessor { } /** - * @param $args array + * @param array $args * @return PPCustomFrame_Hash */ function newCustomFrame( $args ) { @@ -55,7 +55,7 @@ class Preprocessor_Hash implements Preprocessor { } /** - * @param $values array + * @param array $values * @return PPNode_Hash_Array */ function newPartNodeArray( $values ) { @@ -89,10 +89,10 @@ class Preprocessor_Hash implements Preprocessor { * Preprocess some wikitext and return the document tree. * This is the ghost of Parser::replace_variables(). * - * @param string $text the text to parse - * @param $flags Integer: bitwise combination of: - * Parser::PTD_FOR_INCLUSION Handle "" and "" as if the text is being - * included. Default is to assume a direct page view. + * @param string $text The text to parse + * @param int $flags Bitwise combination of: + * Parser::PTD_FOR_INCLUSION Handle "" and "" as if the text is being + * included. Default is to assume a direct page view. * * The generated DOM tree must depend only on the input text and the flags. * The DOM tree must be the same in OT_HTML and OT_WIKI mode, to avoid a regression of bug 4899. @@ -762,6 +762,7 @@ class PPDStackElement_Hash extends PPDStackElement { /** * Get the accumulator that would result if the close is not found. * + * @param int|bool $openingCount * @return PPDAccum_Hash */ function breakSyntax( $openingCount = false ) { @@ -812,6 +813,7 @@ class PPDAccum_Hash { /** * Append a string literal + * @param string $s */ function addLiteral( $s ) { if ( $this->lastNode === false ) { @@ -826,6 +828,7 @@ class PPDAccum_Hash { /** * Append a PPNode + * @param PPNode $node */ function addNode( PPNode $node ) { if ( $this->lastNode === false ) { @@ -838,6 +841,8 @@ class PPDAccum_Hash { /** * Append a tree node with text contents + * @param string $name + * @param string $value */ function addNodeWithText( $name, $value ) { $node = PPNode_Hash_Tree::newWithText( $name, $value ); @@ -848,6 +853,7 @@ class PPDAccum_Hash { * Append a PPAccum_Hash * Takes over ownership of the nodes in the source argument. These nodes may * subsequently be modified, especially nextSibling. + * @param PPAccum_Hash $accum */ function addAccum( $accum ) { if ( $accum->lastNode === false ) { @@ -898,7 +904,7 @@ class PPFrame_Hash implements PPFrame { /** * Construct a new preprocessor frame. - * @param $preprocessor Preprocessor: the parent preprocessor + * @param Preprocessor $preprocessor The parent preprocessor */ function __construct( $preprocessor ) { $this->preprocessor = $preprocessor; @@ -913,9 +919,8 @@ class PPFrame_Hash implements PPFrame { * Create a new child frame * $args is optionally a multi-root PPNode or array containing the template arguments * - * @param array|bool|\PPNode_Hash_Array $args PPNode_Hash_Array|array - * @param $title Title|bool - * + * @param array|bool|PPNode_Hash_Array $args + * @param Title|bool $title * @param int $indexOffset * @throws MWException * @return PPTemplateFrame_Hash @@ -952,8 +957,8 @@ class PPFrame_Hash implements PPFrame { /** * @throws MWException - * @param $root - * @param $flags int + * @param string|PPNode$root + * @param int $flags * @return string */ function expand( $root, $flags = 0 ) { @@ -1135,8 +1140,8 @@ class PPFrame_Hash implements PPFrame { } /** - * @param $sep - * @param $flags + * @param string $sep + * @param int $flags * @return string */ function implodeWithFlags( $sep, $flags /*, ... */ ) { @@ -1166,6 +1171,7 @@ class PPFrame_Hash implements PPFrame { /** * Implode with no flags specified * This previously called implodeWithFlags but has now been inlined to reduce stack depth + * @param string $sep * @return string */ function implode( $sep /*, ... */ ) { @@ -1196,6 +1202,7 @@ class PPFrame_Hash implements PPFrame { * Makes an object that, when expand()ed, will be the same as one obtained * with implode() * + * @param string $sep * @return PPNode_Hash_Array */ function virtualImplode( $sep /*, ... */ ) { @@ -1225,6 +1232,9 @@ class PPFrame_Hash implements PPFrame { /** * Virtual implode with brackets * + * @param string $start + * @param string $sep + * @param string $end * @return PPNode_Hash_Array */ function virtualBracketedImplode( $start, $sep, $end /*, ... */ ) { @@ -1257,8 +1267,8 @@ class PPFrame_Hash implements PPFrame { } /** - * @param $level bool - * @return array|bool|String + * @param bool $level + * @return array|bool|string */ function getPDBK( $level = false ) { if ( $level === false ) { @@ -1299,7 +1309,7 @@ class PPFrame_Hash implements PPFrame { } /** - * @param $name + * @param string $name * @return bool */ function getArgument( $name ) { @@ -1309,7 +1319,7 @@ class PPFrame_Hash implements PPFrame { /** * Returns true if the infinite loop check is OK, false if a loop is detected * - * @param $title Title + * @param Title $title * * @return bool */ @@ -1345,11 +1355,11 @@ class PPTemplateFrame_Hash extends PPFrame_Hash { var $numberedExpansionCache, $namedExpansionCache; /** - * @param $preprocessor - * @param $parent - * @param $numberedArgs array - * @param $namedArgs array - * @param $title Title + * @param Preprocessor $preprocessor + * @param bool|PPFrame $parent + * @param array $numberedArgs + * @param array $namedArgs + * @param Title $title */ function __construct( $preprocessor, $parent = false, $numberedArgs = array(), $namedArgs = array(), $title = false ) { parent::__construct( $preprocessor ); @@ -1431,7 +1441,7 @@ class PPTemplateFrame_Hash extends PPFrame_Hash { } /** - * @param $index + * @param int $index * @return array|bool */ function getNumberedArgument( $index ) { @@ -1446,7 +1456,7 @@ class PPTemplateFrame_Hash extends PPFrame_Hash { } /** - * @param $name + * @param string $name * @return bool */ function getNamedArgument( $name ) { @@ -1462,7 +1472,7 @@ class PPTemplateFrame_Hash extends PPFrame_Hash { } /** - * @param $name + * @param string $name * @return array|bool */ function getArgument( $name ) { @@ -1519,7 +1529,7 @@ class PPCustomFrame_Hash extends PPFrame_Hash { } /** - * @param $index + * @param int $index * @return bool */ function getArgument( $index ) { @@ -1563,8 +1573,8 @@ class PPNode_Hash_Tree implements PPNode { } /** - * @param $name - * @param $text + * @param string $name + * @param string $text * @return PPNode_Hash_Tree */ static function newWithText( $name, $text ) { @@ -1619,7 +1629,7 @@ class PPNode_Hash_Tree implements PPNode { } /** - * @param $i + * @param int $i * @return bool */ function item( $i ) { diff --git a/includes/parser/StripState.php b/includes/parser/StripState.php index 5b94453450..d4f4559bd7 100644 --- a/includes/parser/StripState.php +++ b/includes/parser/StripState.php @@ -37,7 +37,7 @@ class StripState { const UNSTRIP_RECURSION_LIMIT = 20; /** - * @param $prefix string + * @param string $prefix */ function __construct( $prefix ) { $this->prefix = $prefix; @@ -51,16 +51,16 @@ class StripState { /** * Add a nowiki strip item - * @param $marker - * @param $value + * @param string $marker + * @param string $value */ function addNoWiki( $marker, $value ) { $this->addItem( 'nowiki', $marker, $value ); } /** - * @param $marker - * @param $value + * @param string $marker + * @param string $value */ function addGeneral( $marker, $value ) { $this->addItem( 'general', $marker, $value ); @@ -68,9 +68,9 @@ class StripState { /** * @throws MWException - * @param $type - * @param $marker - * @param $value + * @param string $type + * @param string $marker + * @param string $value */ protected function addItem( $type, $marker, $value ) { if ( !preg_match( $this->regex, $marker, $m ) ) { @@ -81,7 +81,7 @@ class StripState { } /** - * @param $text + * @param string $text * @return mixed */ function unstripGeneral( $text ) { @@ -89,7 +89,7 @@ class StripState { } /** - * @param $text + * @param string $text * @return mixed */ function unstripNoWiki( $text ) { @@ -97,7 +97,7 @@ class StripState { } /** - * @param $text + * @param string $text * @return mixed */ function unstripBoth( $text ) { @@ -107,8 +107,8 @@ class StripState { } /** - * @param $type - * @param $text + * @param string $type + * @param string $text * @return mixed */ protected function unstripType( $type, $text ) { @@ -127,7 +127,7 @@ class StripState { } /** - * @param $m array + * @param array $m * @return array */ protected function unstripCallback( $m ) { @@ -159,7 +159,7 @@ class StripState { * Get a StripState object which is sufficient to unstrip the given text. * It will contain the minimum subset of strip items necessary. * - * @param $text string + * @param string $text * * @return StripState */ @@ -195,9 +195,9 @@ class StripState { * will not be preserved. The strings in the $texts array will have their * strip markers rewritten, the resulting array of strings will be returned. * - * @param $otherState StripState - * @param $texts Array - * @return Array + * @param StripState $otherState + * @param array $texts + * @return array */ function merge( $otherState, $texts ) { $mergePrefix = Parser::getRandomString(); @@ -215,7 +215,7 @@ class StripState { } /** - * @param $m + * @param array $m * @return string */ protected function mergeCallback( $m ) { @@ -226,7 +226,7 @@ class StripState { /** * Remove any strip markers found in the given text. * - * @param $text Input string + * @param string $text Input string * @return string */ function killMarkers( $text ) { diff --git a/includes/parser/Tidy.php b/includes/parser/Tidy.php index dbfab34335..f7fe5a8d91 100644 --- a/includes/parser/Tidy.php +++ b/includes/parser/Tidy.php @@ -50,7 +50,7 @@ class MWTidyWrapper { } /** - * @param $text string + * @param string $text * @return string */ public function getWrapped( $text ) { @@ -79,7 +79,7 @@ class MWTidyWrapper { } /** - * @param $m array + * @param array $m * * @return string */ @@ -91,7 +91,7 @@ class MWTidyWrapper { } /** - * @param $text string + * @param string $text * @return string */ public function postprocess( $text ) { @@ -121,8 +121,8 @@ class MWTidy { * If tidy isn't able to correct the markup, the original will be * returned in all its glory with a warning comment appended. * - * @param string $text hideous HTML input - * @return String: corrected HTML output + * @param string $text Hideous HTML input + * @return string Corrected HTML output */ public static function tidy( $text ) { global $wgTidyInternal; @@ -153,9 +153,9 @@ class MWTidy { /** * Check HTML for errors, used if $wgValidateAllHtml = true. * - * @param $text String - * @param &$errorStr String: return the error string - * @return Boolean: whether the HTML is valid + * @param string $text + * @param string &$errorStr Return the error string + * @return bool Whether the HTML is valid */ public static function checkErrors( $text, &$errorStr = null ) { global $wgTidyInternal; @@ -175,9 +175,9 @@ class MWTidy { * Also called in OutputHandler.php for full page validation * * @param string $text HTML to check - * @param $stderr Boolean: Whether to read result from STDERR rather than STDOUT - * @param &$retval int Exit code (-1 on internal error) - * @return mixed String or null + * @param bool $stderr Whether to read result from STDERR rather than STDOUT + * @param int &$retval Exit code (-1 on internal error) + * @return string|null */ private static function execExternalTidy( $text, $stderr = false, &$retval = null ) { global $wgTidyConf, $wgTidyBin, $wgTidyOpts; @@ -242,9 +242,9 @@ class MWTidy { * saving the overhead of spawning a new process. * * @param string $text HTML to check - * @param $stderr Boolean: Whether to read result from error status instead of output - * @param &$retval int Exit code (-1 on internal error) - * @return mixed String or null + * @param bool $stderr Whether to read result from error status instead of output + * @param int &$retval Exit code (-1 on internal error) + * @return string|null */ private static function execInternalTidy( $text, $stderr = false, &$retval = null ) { global $wgTidyConf, $wgDebugTidy; -- 2.20.1