Merge "jsduck: Add @inheritable to static methods from jQuery plugins"
[lhc/web/wiklou.git] / includes / Title.php
index d025f35..70d2baa 100644 (file)
@@ -144,10 +144,10 @@ class Title {
        /**
         * Create a new Title from a prefixed DB key
         *
-        * @param string $key the database key, which has underscores
+        * @param string $key The database key, which has underscores
         *      instead of spaces, possibly including namespace and
         *      interwiki prefixes
-        * @return Title, or NULL on an error
+        * @return Title|null Title, or null on an error
         */
        public static function newFromDBkey( $key ) {
                $t = new Title();
@@ -162,7 +162,7 @@ class Title {
        /**
         * Create a new Title from a TitleValue
         *
-        * @param TitleValue $titleValue, assumed to be safe.
+        * @param TitleValue $titleValue Assumed to be safe.
         *
         * @return Title
         */
@@ -177,14 +177,14 @@ class Title {
         * Create a new Title from text, such as what one would find in a link. De-
         * codes any HTML entities in the text.
         *
-        * @param string $text the link text; spaces, prefixes, and an
+        * @param string $text The link text; spaces, prefixes, and an
         *   initial ':' indicating the main namespace are accepted.
-        * @param int $defaultNamespace the namespace to use if none is specified
+        * @param int $defaultNamespace The namespace to use if none is specified
         *   by a prefix.  If you want to force a specific namespace even if
         *   $text might begin with a namespace prefix, use makeTitle() or
         *   makeTitleSafe().
         * @throws MWException
-        * @return Title|null Title or null on an error.
+        * @return Title|null Title or null on an error.
         */
        public static function newFromText( $text, $defaultNamespace = NS_MAIN ) {
                if ( is_object( $text ) ) {
@@ -235,8 +235,8 @@ class Title {
         * Create a new Title from URL-encoded text. Ensures that
         * the given title's length does not exceed the maximum.
         *
-        * @param string $url the title, as might be taken from a URL
-        * @return Title the new object, or NULL on an error
+        * @param string $url The title, as might be taken from a URL
+        * @return Title|null The new object, or null on an error
         */
        public static function newFromURL( $url ) {
                $t = new Title();
@@ -290,9 +290,9 @@ class Title {
        /**
         * Create a new Title from an article ID
         *
-        * @param int $id the page_id corresponding to the Title to create
-        * @param int $flags use Title::GAID_FOR_UPDATE to use master
-        * @return Title|null the new object, or NULL on an error
+        * @param int $id The page_id corresponding to the Title to create
+        * @param int $flags Use Title::GAID_FOR_UPDATE to use master
+        * @return Title|null The new object, or null on an error
         */
        public static function newFromID( $id, $flags = 0 ) {
                $db = ( $flags & self::GAID_FOR_UPDATE ) ? wfGetDB( DB_MASTER ) : wfGetDB( DB_SLAVE );
@@ -313,8 +313,8 @@ class Title {
        /**
         * Make an array of titles from an array of IDs
         *
-        * @param array $ids of Int Array of IDs
-        * @return Array of Titles
+        * @param int[] $ids Array of IDs
+        * @return Title[] Array of Titles
         */
        public static function newFromIDs( $ids ) {
                if ( !count( $ids ) ) {
@@ -340,7 +340,7 @@ class Title {
         * Make a Title object from a DB row
         *
         * @param stdClass $row Object database row (needs at least page_title,page_namespace)
-        * @return Title corresponding Title
+        * @return Title Corresponding Title
         */
        public static function newFromRow( $row ) {
                $t = self::makeTitle( $row->page_namespace, $row->page_title );
@@ -352,7 +352,7 @@ class Title {
         * Load Title object fields from a DB row.
         * If false is given, the title will be treated as non-existing.
         *
-        * @param $row stdClass|bool database row
+        * @param stdClass|bool $row Database row
         */
        public function loadFromRow( $row ) {
                if ( $row ) { // page found
@@ -389,11 +389,11 @@ class Title {
         * For convenience, spaces are converted to underscores so that
         * eg user_text fields can be used directly.
         *
-        * @param int $ns the namespace of the article
-        * @param string $title the unprefixed database key form
-        * @param string $fragment the link fragment (after the "#")
-        * @param string $interwiki the interwiki prefix
-        * @return Title the new object
+        * @param int $ns The namespace of the article
+        * @param string $title The unprefixed database key form
+        * @param string $fragment The link fragment (after the "#")
+        * @param string $interwiki The interwiki prefix
+        * @return Title The new object
         */
        public static function &makeTitle( $ns, $title, $fragment = '', $interwiki = '' ) {
                $t = new Title();
@@ -413,11 +413,11 @@ class Title {
         * The parameters will be checked for validity, which is a bit slower
         * than makeTitle() but safer for user-provided data.
         *
-        * @param int $ns the namespace of the article
-        * @param string $title database key form
-        * @param string $fragment the link fragment (after the "#")
-        * @param string $interwiki interwiki prefix
-        * @return Title the new object, or NULL on an error
+        * @param int $ns The namespace of the article
+        * @param string $title Database key form
+        * @param string $fragment The link fragment (after the "#")
+        * @param string $interwiki Interwiki prefix
+        * @return Title The new object, or null on an error
         */
        public static function makeTitleSafe( $ns, $title, $fragment = '', $interwiki = '' ) {
                if ( !MWNamespace::exists( $ns ) ) {
@@ -436,7 +436,7 @@ class Title {
        /**
         * Create a new Title for the Main Page
         *
-        * @return Title the new object
+        * @return Title The new object
         */
        public static function newMainPage() {
                $title = Title::newFromText( wfMessage( 'mainpage' )->inContentLanguage()->text() );
@@ -454,7 +454,7 @@ class Title {
         * the redirect table and other checks that don't need full recursion
         *
         * @param string $text Text with possible redirect
-        * @return Title: The corresponding Title
+        * @return Title The corresponding Title
         * @deprecated since 1.21, use Content::getRedirectTarget instead.
         */
        public static function newFromRedirect( $text ) {
@@ -488,7 +488,7 @@ class Title {
         * have been resolved (up to $wgMaxRedirects times)
         *
         * @param string $text Text with possible redirect
-        * @return Array of Titles, with the destination last
+        * @return Title[] Array of Titles, with the destination last
         * @deprecated since 1.21, use Content::getRedirectChain instead.
         */
        public static function newFromRedirectArray( $text ) {
@@ -501,8 +501,8 @@ class Title {
        /**
         * Get the prefixed DB key associated with an ID
         *
-        * @param int $id the page_id of the article
-        * @return Title an object representing the article, or NULL if no such article was found
+        * @param int $id The page_id of the article
+        * @return Title|null An object representing the article, or null if no such article was found
         */
        public static function nameOf( $id ) {
                $dbr = wfGetDB( DB_SLAVE );
@@ -524,7 +524,7 @@ class Title {
        /**
         * Get a regex character class describing the legal characters in a link
         *
-        * @return String the list of characters, not delimited
+        * @return string The list of characters, not delimited
         */
        public static function legalChars() {
                global $wgLegalTitleChars;
@@ -538,7 +538,7 @@ class Title {
         *
         * @todo: move this into MediaWikiTitleCodec
         *
-        * @return String regex string
+        * @return string Regex string
         */
        static function getTitleInvalidRegex() {
                static $rxTc = false;
@@ -662,42 +662,14 @@ class Title {
                return $out;
        }
 
-       /**
-        * Get a string representation of a title suitable for
-        * including in a search index
-        *
-        * @param int $ns a namespace index
-        * @param string $title text-form main part
-        * @return String a stripped-down title string ready for the search index
-        */
-       public static function indexTitle( $ns, $title ) {
-               global $wgContLang;
-
-               $lc = SearchEngine::legalSearchChars() . '&#;';
-               $t = $wgContLang->normalizeForSearch( $title );
-               $t = preg_replace( "/[^{$lc}]+/", ' ', $t );
-               $t = $wgContLang->lc( $t );
-
-               # Handle 's, s'
-               $t = preg_replace( "/([{$lc}]+)'s( |$)/", "\\1 \\1's ", $t );
-               $t = preg_replace( "/([{$lc}]+)s'( |$)/", "\\1s ", $t );
-
-               $t = preg_replace( "/\\s+/", ' ', $t );
-
-               if ( $ns == NS_FILE ) {
-                       $t = preg_replace( "/ (png|gif|jpg|jpeg|ogg)$/", "", $t );
-               }
-               return trim( $t );
-       }
-
        /**
         * Make a prefixed DB key from a DB key and a namespace index
         *
-        * @param int $ns numerical representation of the namespace
-        * @param string $title the DB key form the title
+        * @param int $ns Numerical representation of the namespace
+        * @param string $title The DB key form the title
         * @param string $fragment The link fragment (after the "#")
         * @param string $interwiki The interwiki prefix
-        * @return String the prefixed form of the title
+        * @return string The prefixed form of the title
         */
        public static function makeName( $ns, $title, $fragment = '', $interwiki = '' ) {
                global $wgContLang;
@@ -716,8 +688,8 @@ class Title {
        /**
         * Escape a text fragment, say from a link, for a URL
         *
-        * @param string $fragment containing a URL or link fragment (after the "#")
-        * @return String: escaped string
+        * @param string $fragment Containing a URL or link fragment (after the "#")
+        * @return string Escaped string
         */
        static function escapeFragmentForURL( $fragment ) {
                # Note that we don't urlencode the fragment.  urlencoded Unicode
@@ -730,10 +702,10 @@ class Title {
        /**
         * Callback for usort() to do title sorts by (namespace, title)
         *
-        * @param $a Title
-        * @param $b Title
+        * @param Title $a
+        * @param Title $b
         *
-        * @return Integer: result of string comparison, or namespace comparison
+        * @return int Result of string comparison, or namespace comparison
         */
        public static function compare( $a, $b ) {
                if ( $a->getNamespace() == $b->getNamespace() ) {
@@ -747,7 +719,7 @@ class Title {
         * Determine whether the object refers to a page within
         * this project.
         *
-        * @return Bool TRUE if this is an in-project interwiki link or a wikilink, FALSE otherwise
+        * @return bool True if this is an in-project interwiki link or a wikilink, false otherwise
         */
        public function isLocal() {
                if ( $this->isExternal() ) {
@@ -762,7 +734,7 @@ class Title {
        /**
         * Is this Title interwiki?
         *
-        * @return Bool
+        * @return bool
         */
        public function isExternal() {
                return $this->mInterwiki !== '';
@@ -773,7 +745,7 @@ class Title {
         *
         * Use Title::isExternal to check if a interwiki is set
         *
-        * @return String Interwiki prefix
+        * @return string Interwiki prefix
         */
        public function getInterwiki() {
                return $this->mInterwiki;
@@ -783,7 +755,7 @@ class Title {
         * Determine whether the object refers to a page within
         * this project and is transcludable.
         *
-        * @return Bool TRUE if this is transcludable
+        * @return bool True if this is transcludable
         */
        public function isTrans() {
                if ( !$this->isExternal() ) {
@@ -796,7 +768,7 @@ class Title {
        /**
         * Returns the DB name of the distant wiki which owns the object.
         *
-        * @return String the DB name
+        * @return string The DB name
         */
        public function getTransWikiID() {
                if ( !$this->isExternal() ) {
@@ -834,7 +806,7 @@ class Title {
        /**
         * Get the text form (spaces not underscores) of the main part
         *
-        * @return String Main part of the title
+        * @return string Main part of the title
         */
        public function getText() {
                return $this->mTextform;
@@ -843,7 +815,7 @@ class Title {
        /**
         * Get the URL-encoded form of the main part
         *
-        * @return String Main part of the title, URL-encoded
+        * @return string Main part of the title, URL-encoded
         */
        public function getPartialURL() {
                return $this->mUrlform;
@@ -852,7 +824,7 @@ class Title {
        /**
         * Get the main part with underscores
         *
-        * @return String: Main part of the title, with underscores
+        * @return string Main part of the title, with underscores
         */
        public function getDBkey() {
                return $this->mDbkeyform;
@@ -861,7 +833,7 @@ class Title {
        /**
         * Get the DB key with the initial letter case as specified by the user
         *
-        * @return String DB key
+        * @return string DB key
         */
        function getUserCaseDBKey() {
                if ( !is_null( $this->mUserCaseDBKey ) ) {
@@ -875,7 +847,7 @@ class Title {
        /**
         * Get the namespace index, i.e. one of the NS_xxxx constants.
         *
-        * @return Integer: Namespace index
+        * @return int Namespace index
         */
        public function getNamespace() {
                return $this->mNamespace;
@@ -885,7 +857,7 @@ class Title {
         * Get the page's content model id, see the CONTENT_MODEL_XXX constants.
         *
         * @throws MWException
-        * @return String: Content model id
+        * @return string Content model id
         */
        public function getContentModel() {
                if ( !$this->mContentModel ) {
@@ -908,7 +880,7 @@ class Title {
         * Convenience method for checking a title's content model name
         *
         * @param string $id The content model ID (use the CONTENT_MODEL_XXX constants).
-        * @return Boolean true if $this->getContentModel() == $id
+        * @return bool True if $this->getContentModel() == $id
         */
        public function hasContentModel( $id ) {
                return $this->getContentModel() == $id;
@@ -917,7 +889,7 @@ class Title {
        /**
         * Get the namespace text
         *
-        * @return String: Namespace text
+        * @return string Namespace text
         */
        public function getNsText() {
                if ( $this->isExternal() ) {
@@ -944,7 +916,7 @@ class Title {
        /**
         * Get the namespace text of the subject (rather than talk) page
         *
-        * @return String Namespace text
+        * @return string Namespace text
         */
        public function getSubjectNsText() {
                global $wgContLang;
@@ -954,7 +926,7 @@ class Title {
        /**
         * Get the namespace text of the talk page
         *
-        * @return String Namespace text
+        * @return string Namespace text
         */
        public function getTalkNsText() {
                global $wgContLang;
@@ -964,7 +936,7 @@ class Title {
        /**
         * Could this title have a corresponding talk page?
         *
-        * @return Bool TRUE or FALSE
+        * @return bool
         */
        public function canTalk() {
                return MWNamespace::canTalk( $this->mNamespace );
@@ -973,7 +945,7 @@ class Title {
        /**
         * Is this in a namespace that allows actual pages?
         *
-        * @return Bool
+        * @return bool
         * @internal note -- uses hardcoded namespace index instead of constants
         */
        public function canExist() {
@@ -983,7 +955,7 @@ class Title {
        /**
         * Can this title be added to a user's watchlist?
         *
-        * @return Bool TRUE or FALSE
+        * @return bool
         */
        public function isWatchable() {
                return !$this->isExternal() && MWNamespace::isWatchable( $this->getNamespace() );
@@ -992,7 +964,7 @@ class Title {
        /**
         * Returns true if this is a special page.
         *
-        * @return boolean
+        * @return bool
         */
        public function isSpecialPage() {
                return $this->getNamespace() == NS_SPECIAL;
@@ -1002,7 +974,7 @@ class Title {
         * Returns true if this title resolves to the named special page
         *
         * @param string $name The special page name
-        * @return boolean
+        * @return bool
         */
        public function isSpecial( $name ) {
                if ( $this->isSpecialPage() ) {
@@ -1079,7 +1051,7 @@ class Title {
         * This is MUCH simpler than individually testing for equivalence
         * against both NS_USER and NS_USER_TALK, and is also forward compatible.
         * @since 1.19
-        * @param $ns int
+        * @param int $ns
         * @return bool
         */
        public function hasSubjectNamespace( $ns ) {
@@ -1091,7 +1063,7 @@ class Title {
         * In other words, is this a content page, for the purposes of calculating
         * statistics, etc?
         *
-        * @return Boolean
+        * @return bool
         */
        public function isContentPage() {
                return MWNamespace::isContent( $this->getNamespace() );
@@ -1101,7 +1073,7 @@ class Title {
         * Would anybody with sufficient privileges be able to move this page?
         * Some pages just aren't movable.
         *
-        * @return Bool TRUE or FALSE
+        * @return bool
         */
        public function isMovable() {
                if ( !MWNamespace::isMovable( $this->getNamespace() ) || $this->isExternal() ) {
@@ -1122,7 +1094,7 @@ class Title {
         * ends up reporting something differently than $title->isMainPage();
         *
         * @since 1.18
-        * @return Bool
+        * @return bool
         */
        public function isMainPage() {
                return $this->equals( Title::newMainPage() );
@@ -1131,7 +1103,7 @@ class Title {
        /**
         * Is this a subpage?
         *
-        * @return Bool
+        * @return bool
         */
        public function isSubpage() {
                return MWNamespace::hasSubpages( $this->mNamespace )
@@ -1142,7 +1114,7 @@ class Title {
        /**
         * Is this a conversion table for the LanguageConverter?
         *
-        * @return Bool
+        * @return bool
         */
        public function isConversionTable() {
                // @todo ConversionTable should become a separate content model.
@@ -1154,7 +1126,7 @@ class Title {
        /**
         * Does that page contain wikitext, or it is JS, CSS or whatever?
         *
-        * @return Bool
+        * @return bool
         */
        public function isWikitextPage() {
                return $this->hasContentModel( CONTENT_MODEL_WIKITEXT );
@@ -1169,7 +1141,7 @@ class Title {
         *
         * Note that this method should not return true for pages that contain and show "inactive" CSS or JS.
         *
-        * @return Bool
+        * @return bool
         */
        public function isCssOrJsPage() {
                $isCssOrJsPage = NS_MEDIAWIKI == $this->mNamespace
@@ -1186,7 +1158,7 @@ class Title {
 
        /**
         * Is this a .css or .js subpage of a user page?
-        * @return Bool
+        * @return bool
         */
        public function isCssJsSubpage() {
                return ( NS_USER == $this->mNamespace && $this->isSubpage()
@@ -1197,7 +1169,7 @@ class Title {
        /**
         * Trim down a .css or .js subpage title to get the corresponding skin name
         *
-        * @return string containing skin name from .css or .js subpage title
+        * @return string Containing skin name from .css or .js subpage title
         */
        public function getSkinFromCssJsSubpage() {
                $subpage = explode( '/', $this->mTextform );
@@ -1212,7 +1184,7 @@ class Title {
        /**
         * Is this a .css subpage of a user page?
         *
-        * @return Bool
+        * @return bool
         */
        public function isCssSubpage() {
                return ( NS_USER == $this->mNamespace && $this->isSubpage()
@@ -1222,7 +1194,7 @@ class Title {
        /**
         * Is this a .js subpage of a user page?
         *
-        * @return Bool
+        * @return bool
         */
        public function isJsSubpage() {
                return ( NS_USER == $this->mNamespace && $this->isSubpage()
@@ -1232,7 +1204,7 @@ class Title {
        /**
         * Is this a talk page of some sort?
         *
-        * @return Bool
+        * @return bool
         */
        public function isTalkPage() {
                return MWNamespace::isTalk( $this->getNamespace() );
@@ -1241,7 +1213,7 @@ class Title {
        /**
         * Get a Title object associated with the talk page of this article
         *
-        * @return Title the object for the talk page
+        * @return Title The object for the talk page
         */
        public function getTalkPage() {
                return Title::makeTitle( MWNamespace::getTalk( $this->getNamespace() ), $this->getDBkey() );
@@ -1251,7 +1223,7 @@ class Title {
         * Get a title object associated with the subject page of this
         * talk page
         *
-        * @return Title the object for the subject page
+        * @return Title The object for the subject page
         */
        public function getSubjectPage() {
                // Is this the same title?
@@ -1265,28 +1237,18 @@ class Title {
        /**
         * Get the default namespace index, for when there is no namespace
         *
-        * @return Int Default namespace index
+        * @return int Default namespace index
         */
        public function getDefaultNamespace() {
                return $this->mDefaultNamespace;
        }
 
-       /**
-        * Get title for search index
-        *
-        * @return String a stripped-down title string ready for the
-        *  search index
-        */
-       public function getIndexTitle() {
-               return Title::indexTitle( $this->mNamespace, $this->mTextform );
-       }
-
        /**
         * Get the Title fragment (i.e.\ the bit after the #) in text form
         *
         * Use Title::hasFragment to check for a fragment
         *
-        * @return String Title fragment
+        * @return string Title fragment
         */
        public function getFragment() {
                return $this->mFragment;
@@ -1304,7 +1266,7 @@ class Title {
 
        /**
         * Get the fragment in URL form, including the "#" character if there is one
-        * @return String Fragment in URL form
+        * @return string Fragment in URL form
         */
        public function getFragmentForURL() {
                if ( !$this->hasFragment() ) {
@@ -1322,7 +1284,7 @@ class Title {
         * Deprecated for public use, use Title::makeTitle() with fragment parameter.
         * Still in active use privately.
         *
-        * @param string $fragment text
+        * @param string $fragment Text
         */
        public function setFragment( $fragment ) {
                $this->mFragment = str_replace( '_', ' ', substr( $fragment, 1 ) );
@@ -1332,8 +1294,8 @@ class Title {
         * Prefix some arbitrary text with the namespace or interwiki prefix
         * of this object
         *
-        * @param string $name the text
-        * @return String the prefixed text
+        * @param string $name The text
+        * @return string The prefixed text
         * @private
         */
        private function prefix( $name ) {
@@ -1351,7 +1313,7 @@ class Title {
        /**
         * Get the prefixed database key form
         *
-        * @return String the prefixed title, with underscores and
+        * @return string The prefixed title, with underscores and
         *  any interwiki and namespace prefixes
         */
        public function getPrefixedDBkey() {
@@ -1364,7 +1326,7 @@ class Title {
         * Get the prefixed title with spaces.
         * This is the form usually used for display
         *
-        * @return String the prefixed title, with spaces
+        * @return string The prefixed title, with spaces
         */
        public function getPrefixedText() {
                if ( $this->mPrefixedText === null ) {
@@ -1378,7 +1340,7 @@ class Title {
        /**
         * Return a string representation of this title
         *
-        * @return String representation of this title
+        * @return string Representation of this title
         */
        public function __toString() {
                return $this->getPrefixedText();
@@ -1388,7 +1350,7 @@ class Title {
         * Get the prefixed title with spaces, plus any fragment
         * (part beginning with '#')
         *
-        * @return String the prefixed title, with spaces and the fragment, including '#'
+        * @return string The prefixed title, with spaces and the fragment, including '#'
         */
        public function getFullText() {
                $text = $this->getPrefixedText();
@@ -1407,7 +1369,7 @@ class Title {
         * # returns: 'Foo'
         * @endcode
         *
-        * @return String Root name
+        * @return string Root name
         * @since 1.20
         */
        public function getRootText() {
@@ -1443,7 +1405,7 @@ class Title {
         * # returns: 'Foo/Bar'
         * @endcode
         *
-        * @return String Base name
+        * @return string Base name
         */
        public function getBaseText() {
                if ( !MWNamespace::hasSubpages( $this->mNamespace ) ) {
@@ -1483,7 +1445,7 @@ class Title {
         * # returns: "Baz"
         * @endcode
         *
-        * @return String Subpage name
+        * @return string Subpage name
         */
        public function getSubpageText() {
                if ( !MWNamespace::hasSubpages( $this->mNamespace ) ) {
@@ -1514,7 +1476,7 @@ class Title {
         * Get the HTML-escaped displayable text form.
         * Used for the title field in <a> tags.
         *
-        * @return String the text, including any prefixes
+        * @return string The text, including any prefixes
         * @deprecated since 1.19
         */
        public function getEscapedText() {
@@ -1525,7 +1487,7 @@ class Title {
        /**
         * Get a URL-encoded form of the subpage text
         *
-        * @return String URL-encoded subpage name
+        * @return string URL-encoded subpage name
         */
        public function getSubpageUrlForm() {
                $text = $this->getSubpageText();
@@ -1536,7 +1498,7 @@ class Title {
        /**
         * Get a URL-encoded title (not an actual URL) including interwiki
         *
-        * @return String the URL-encoded form
+        * @return string The URL-encoded form
         */
        public function getPrefixedURL() {
                $s = $this->prefix( $this->mDbkeyform );
@@ -1553,9 +1515,9 @@ class Title {
         * and the wfArrayToCgi moved to getLocalURL();
         *
         * @since 1.19 (r105919)
-        * @param $query
-        * @param $query2 bool
-        * @return String
+        * @param array|string $query
+        * @param bool $query2
+        * @return string
         */
        private static function fixUrlQueryArgs( $query, $query2 = false ) {
                if ( $query2 !== false ) {
@@ -1590,10 +1552,10 @@ class Title {
         *
         * @see self::getLocalURL for the arguments.
         * @see wfExpandUrl
-        * @param $query
-        * @param $query2 bool
-        * @param $proto Protocol type to use in URL
-        * @return String the URL
+        * @param array|string $query
+        * @param bool $query2
+        * @param string $proto Protocol type to use in URL
+        * @return string The URL
         */
        public function getFullURL( $query = '', $query2 = false, $proto = PROTO_RELATIVE ) {
                $query = self::fixUrlQueryArgs( $query, $query2 );
@@ -1625,14 +1587,14 @@ class Title {
         *   not used for interwiki links. Can be specified as an associative array as well,
         *   e.g., array( 'action' => 'edit' ) (keys and values will be URL-escaped).
         *   Some query patterns will trigger various shorturl path replacements.
-        * @param $query2 Mixed: An optional secondary query array. This one MUST
+        * @param array $query2 An optional secondary query array. This one MUST
         *   be an array. If a string is passed it will be interpreted as a deprecated
         *   variant argument and urlencoded into a variant= argument.
         *   This second query argument will be added to the $query
         *   The second parameter is deprecated since 1.19. Pass it as a key,value
         *   pair in the first parameter array instead.
         *
-        * @return String of the URL.
+        * @return string String of the URL.
         */
        public function getLocalURL( $query = '', $query2 = false ) {
                global $wgArticlePath, $wgScript, $wgServer, $wgRequest;
@@ -1720,11 +1682,11 @@ class Title {
         * The result obviously should not be URL-escaped, but does need to be
         * HTML-escaped if it's being output in HTML.
         *
-        * @param $query
-        * @param $query2 bool
-        * @param $proto Protocol to use; setting this will cause a full URL to be used
+        * @param array $query
+        * @param bool $query2
+        * @param string $proto Protocol to use; setting this will cause a full URL to be used
         * @see self::getLocalURL for the arguments.
-        * @return String the URL
+        * @return string The URL
         */
        public function getLinkURL( $query = '', $query2 = false, $proto = PROTO_RELATIVE ) {
                wfProfileIn( __METHOD__ );
@@ -1744,9 +1706,9 @@ class Title {
         * using in a link, without a server name or fragment
         *
         * @see self::getLocalURL for the arguments.
-        * @param $query string
-        * @param $query2 bool|string
-        * @return String the URL
+        * @param string $query
+        * @param bool|string $query2
+        * @return string The URL
         * @deprecated since 1.19
         */
        public function escapeLocalURL( $query = '', $query2 = false ) {
@@ -1759,7 +1721,7 @@ class Title {
         * using in a link, including the server name and fragment
         *
         * @see self::getLocalURL for the arguments.
-        * @return String the URL
+        * @return string The URL
         * @deprecated since 1.19
         */
        public function escapeFullURL( $query = '', $query2 = false ) {
@@ -1777,7 +1739,7 @@ class Title {
         * protocol-relative, the URL will be expanded to http://
         *
         * @see self::getLocalURL for the arguments.
-        * @return String the URL
+        * @return string The URL
         */
        public function getInternalURL( $query = '', $query2 = false ) {
                global $wgInternalServer, $wgServer;
@@ -1822,8 +1784,7 @@ class Title {
        /**
         * Get the edit URL for this Title
         *
-        * @return String the URL, or a null string if this is an
-        *  interwiki link
+        * @return string The URL, or a null string if this is an interwiki link
         */
        public function getEditURL() {
                if ( $this->isExternal() ) {
@@ -1837,8 +1798,8 @@ class Title {
        /**
         * Is $wgUser watching this page?
         *
-        * @deprecated in 1.20; use User::isWatched() instead.
-        * @return Bool
+        * @deprecated since 1.20; use User::isWatched() instead.
+        * @return bool
         */
        public function userIsWatching() {
                global $wgUser;
@@ -1856,8 +1817,8 @@ class Title {
        /**
         * Can $wgUser read this page?
         *
-        * @deprecated in 1.19; use userCan(), quickUserCan() or getUserPermissionsErrors() instead
-        * @return Bool
+        * @deprecated since 1.19; use userCan(), quickUserCan() or getUserPermissionsErrors() instead
+        * @return bool
         */
        public function userCanRead() {
                wfDeprecated( __METHOD__, '1.19' );
@@ -1874,10 +1835,9 @@ class Title {
         *
         * May provide false positives, but should never provide a false negative.
         *
-        * @param string $action action that permission needs to be checked for
-        * @param $user User to check (since 1.19); $wgUser will be used if not
-        *              provided.
-        * @return Bool
+        * @param string $action Action that permission needs to be checked for
+        * @param User $user User to check (since 1.19); $wgUser will be used if not provided.
+        * @return bool
         */
        public function quickUserCan( $action, $user = null ) {
                return $this->userCan( $action, $user, false );
@@ -1886,12 +1846,12 @@ class Title {
        /**
         * Can $user perform $action on this page?
         *
-        * @param string $action action that permission needs to be checked for
-        * @param $user User to check (since 1.19); $wgUser will be used if not
+        * @param string $action Action that permission needs to be checked for
+        * @param User $user User to check (since 1.19); $wgUser will be used if not
         *   provided.
         * @param bool $doExpensiveQueries Set this to false to avoid doing
         *   unnecessary queries.
-        * @return Bool
+        * @return bool
         */
        public function userCan( $action, $user = null, $doExpensiveQueries = true ) {
                if ( !$user instanceof User ) {
@@ -1907,12 +1867,12 @@ class Title {
         * @todo FIXME: This *does not* check throttles (User::pingLimiter()).
         *
         * @param string $action action that permission needs to be checked for
-        * @param $user User to check
+        * @param User $user User to check
         * @param bool $doExpensiveQueries Set this to false to avoid doing unnecessary
         *   queries by skipping checks for cascading protections and user blocks.
         * @param array $ignoreErrors of Strings Set this to a list of message keys
         *   whose corresponding errors may be ignored.
-        * @return Array of arguments to wfMessage to explain permissions problems.
+        * @return array Array of arguments to wfMessage to explain permissions problems.
         */
        public function getUserPermissionsErrors( $action, $user, $doExpensiveQueries = true, $ignoreErrors = array() ) {
                $errors = $this->getUserPermissionsErrorsInternal( $action, $user, $doExpensiveQueries );
@@ -1933,12 +1893,12 @@ class Title {
         * Permissions checks that fail most often, and which are easiest to test.
         *
         * @param string $action the action to check
-        * @param $user User user to check
-        * @param array $errors list of current errors
-        * @param $doExpensiveQueries Boolean whether or not to perform expensive queries
-        * @param $short Boolean short circuit on first error
+        * @param User $user User to check
+        * @param array $errors List of current errors
+        * @param bool $doExpensiveQueries Whether or not to perform expensive queries
+        * @param bool $short Short circuit on first error
         *
-        * @return Array list of errors
+        * @return array List of errors
         */
        private function checkQuickPermissions( $action, $user, $errors, $doExpensiveQueries, $short ) {
                if ( !wfRunHooks( 'TitleQuickPermissions', array( $this, $user, $action, &$errors, $doExpensiveQueries, $short ) ) ) {
@@ -1994,10 +1954,10 @@ class Title {
        /**
         * Add the resulting error code to the errors array
         *
-        * @param array $errors list of current errors
-        * @param $result Mixed result of errors
+        * @param array $errors List of current errors
+        * @param array $result Result of errors
         *
-        * @return Array list of errors
+        * @return array List of errors
         */
        private function resultToError( $errors, $result ) {
                if ( is_array( $result ) && count( $result ) && !is_array( $result[0] ) ) {
@@ -2019,13 +1979,13 @@ class Title {
        /**
         * Check various permission hooks
         *
-        * @param string $action the action to check
-        * @param $user User user to check
-        * @param array $errors list of current errors
-        * @param $doExpensiveQueries Boolean whether or not to perform expensive queries
-        * @param $short Boolean short circuit on first error
+        * @param string $action The action to check
+        * @param User $user User to check
+        * @param array $errors List of current errors
+        * @param bool $doExpensiveQueries Whether or not to perform expensive queries
+        * @param bool $short Short circuit on first error
         *
-        * @return Array list of errors
+        * @return array List of errors
         */
        private function checkPermissionHooks( $action, $user, $errors, $doExpensiveQueries, $short ) {
                // Use getUserPermissionsErrors instead
@@ -2052,13 +2012,13 @@ class Title {
        /**
         * Check permissions on special pages & namespaces
         *
-        * @param string $action the action to check
-        * @param $user User user to check
-        * @param array $errors list of current errors
-        * @param $doExpensiveQueries Boolean whether or not to perform expensive queries
-        * @param $short Boolean short circuit on first error
+        * @param string $action The action to check
+        * @param User $user User to check
+        * @param array $errors List of current errors
+        * @param bool $doExpensiveQueries Whether or not to perform expensive queries
+        * @param bool $short Short circuit on first error
         *
-        * @return Array list of errors
+        * @return array List of errors
         */
        private function checkSpecialsAndNSPermissions( $action, $user, $errors, $doExpensiveQueries, $short ) {
                # Only 'createaccount' can be performed on special pages,
@@ -2081,13 +2041,13 @@ class Title {
        /**
         * Check CSS/JS sub-page permissions
         *
-        * @param string $action the action to check
-        * @param $user User user to check
-        * @param array $errors list of current errors
-        * @param $doExpensiveQueries Boolean whether or not to perform expensive queries
-        * @param $short Boolean short circuit on first error
+        * @param string $action The action to check
+        * @param User $user User to check
+        * @param array $errors List of current errors
+        * @param bool $doExpensiveQueries Whether or not to perform expensive queries
+        * @param bool $short Short circuit on first error
         *
-        * @return Array list of errors
+        * @return array List of errors
         */
        private function checkCSSandJSPermissions( $action, $user, $errors, $doExpensiveQueries, $short ) {
                # Protect css/js subpages of user pages
@@ -2117,13 +2077,13 @@ class Title {
         * page. The user must possess all required rights for this
         * action.
         *
-        * @param string $action the action to check
-        * @param $user User user to check
-        * @param array $errors list of current errors
-        * @param $doExpensiveQueries Boolean whether or not to perform expensive queries
-        * @param $short Boolean short circuit on first error
+        * @param string $action The action to check
+        * @param User $user User to check
+        * @param array $errors List of current errors
+        * @param bool $doExpensiveQueries Whether or not to perform expensive queries
+        * @param bool $short Short circuit on first error
         *
-        * @return Array list of errors
+        * @return array List of errors
         */
        private function checkPageRestrictions( $action, $user, $errors, $doExpensiveQueries, $short ) {
                foreach ( $this->getRestrictions( $action ) as $right ) {
@@ -2151,13 +2111,13 @@ class Title {
        /**
         * Check restrictions on cascading pages.
         *
-        * @param string $action the action to check
-        * @param $user User to check
-        * @param array $errors list of current errors
-        * @param $doExpensiveQueries Boolean whether or not to perform expensive queries
-        * @param $short Boolean short circuit on first error
+        * @param string $action The action to check
+        * @param User $user User to check
+        * @param array $errors List of current errors
+        * @param bool $doExpensiveQueries Whether or not to perform expensive queries
+        * @param bool $short Short circuit on first error
         *
-        * @return Array list of errors
+        * @return array List of errors
         */
        private function checkCascadingSourcesRestrictions( $action, $user, $errors, $doExpensiveQueries, $short ) {
                if ( $doExpensiveQueries && !$this->isCssJsSubpage() ) {
@@ -2198,13 +2158,13 @@ class Title {
        /**
         * Check action permissions not already checked in checkQuickPermissions
         *
-        * @param string $action the action to check
-        * @param $user User to check
-        * @param array $errors list of current errors
-        * @param $doExpensiveQueries Boolean whether or not to perform expensive queries
-        * @param $short Boolean short circuit on first error
+        * @param string $action The action to check
+        * @param User $user User to check
+        * @param array $errors List of current errors
+        * @param bool $doExpensiveQueries Whether or not to perform expensive queries
+        * @param bool $short Short circuit on first error
         *
-        * @return Array list of errors
+        * @return array List of errors
         */
        private function checkActionPermissions( $action, $user, $errors, $doExpensiveQueries, $short ) {
                global $wgDeleteRevisionsLimit, $wgLang;
@@ -2257,13 +2217,13 @@ class Title {
        /**
         * Check that the user isn't blocked from editing.
         *
-        * @param string $action the action to check
-        * @param $user User to check
-        * @param array $errors list of current errors
-        * @param $doExpensiveQueries Boolean whether or not to perform expensive queries
-        * @param $short Boolean short circuit on first error
+        * @param string $action The action to check
+        * @param User $user User to check
+        * @param array $errors List of current errors
+        * @param bool $doExpensiveQueries Whether or not to perform expensive queries
+        * @param bool $short Short circuit on first error
         *
-        * @return Array list of errors
+        * @return array List of errors
         */
        private function checkUserBlock( $action, $user, $errors, $doExpensiveQueries, $short ) {
                // Account creation blocks handled at userlogin.
@@ -2292,13 +2252,13 @@ class Title {
        /**
         * Check that the user is allowed to read this page.
         *
-        * @param string $action the action to check
-        * @param $user User to check
-        * @param array $errors list of current errors
-        * @param $doExpensiveQueries Boolean whether or not to perform expensive queries
-        * @param $short Boolean short circuit on first error
+        * @param string $action The action to check
+        * @param User $user User to check
+        * @param array $errors List of current errors
+        * @param bool $doExpensiveQueries Whether or not to perform expensive queries
+        * @param bool $short Short circuit on first error
         *
-        * @return Array list of errors
+        * @return array List of errors
         */
        private function checkReadPermissions( $action, $user, $errors, $doExpensiveQueries, $short ) {
                global $wgWhitelistRead, $wgWhitelistReadRegexp;
@@ -2371,9 +2331,9 @@ class Title {
         * Get a description array when the user doesn't have the right to perform
         * $action (i.e. when User::isAllowed() returns false)
         *
-        * @param string $action the action to check
-        * @param $short Boolean short circuit on first error
-        * @return Array list of errors
+        * @param string $action The action to check
+        * @param bool $short Short circuit on first error
+        * @return array List of errors
         */
        private function missingPermissionError( $action, $short ) {
                // We avoid expensive display logic for quickUserCan's and such
@@ -2401,11 +2361,11 @@ class Title {
         * which checks ONLY that previously checked by userCan (i.e. it leaves out
         * checks on wfReadOnly() and blocks)
         *
-        * @param string $action action that permission needs to be checked for
-        * @param $user User to check
+        * @param string $action Action that permission needs to be checked for
+        * @param User $user User to check
         * @param bool $doExpensiveQueries Set this to false to avoid doing unnecessary queries.
         * @param bool $short Set this to true to stop after the first permission error.
-        * @return Array of arrays of the arguments to wfMessage to explain permissions problems.
+        * @return array Array of arrays of the arguments to wfMessage to explain permissions problems.
         */
        protected function getUserPermissionsErrorsInternal( $action, $user, $doExpensiveQueries = true, $short = false ) {
                wfProfileIn( __METHOD__ );
@@ -2463,7 +2423,7 @@ class Title {
        /**
         * Returns restriction types for the current Title
         *
-        * @return array applicable restriction types
+        * @return array Applicable restriction types
         */
        public function getRestrictionTypes() {
                if ( $this->isSpecialPage() ) {
@@ -2489,7 +2449,7 @@ class Title {
         * Is this title subject to title protection?
         * Title protection is the one applied against creation of such title.
         *
-        * @return Mixed An associative array representing any existent title
+        * @return array|bool An associative array representing any existent title
         *   protection, or false if there's none.
         */
        private function getTitleProtection() {
@@ -2521,11 +2481,11 @@ class Title {
        /**
         * Update the title protection status
         *
-        * @deprecated in 1.19; use WikiPage::doUpdateRestrictions() instead.
-        * @param $create_perm String Permission required for creation
+        * @deprecated since 1.19; use WikiPage::doUpdateRestrictions() instead.
+        * @param string $create_perm Permission required for creation
         * @param string $reason Reason for protection
         * @param string $expiry Expiry timestamp
-        * @return boolean true
+        * @return bool
         */
        public function updateTitleProtection( $create_perm, $reason, $expiry ) {
                wfDeprecated( __METHOD__, '1.19' );
@@ -2561,7 +2521,7 @@ class Title {
         * in $wgSemiprotectedRestrictionLevels?
         *
         * @param string $action Action to check (default: edit)
-        * @return Bool
+        * @return bool
         */
        public function isSemiProtected( $action = 'edit' ) {
                global $wgSemiprotectedRestrictionLevels;
@@ -2589,7 +2549,7 @@ class Title {
         *
         * @param string $action the action the page is protected from,
         * by default checks all actions.
-        * @return Bool
+        * @return bool
         */
        public function isProtected( $action = '' ) {
                global $wgRestrictionLevels;
@@ -2620,8 +2580,8 @@ class Title {
         * Determines if $user is unable to edit this page because it has been protected
         * by $wgNamespaceProtection.
         *
-        * @param $user User object to check permissions
-        * @return Bool
+        * @param User $user User object to check permissions
+        * @return bool
         */
        public function isNamespaceProtected( User $user ) {
                global $wgNamespaceProtection;
@@ -2639,7 +2599,7 @@ class Title {
        /**
         * Cascading protection: Return true if cascading restrictions apply to this page, false if not.
         *
-        * @return Bool If the page is subject to cascading restrictions.
+        * @return bool If the page is subject to cascading restrictions.
         */
        public function isCascadeProtected() {
                list( $sources, /* $restrictions */ ) = $this->getCascadeProtectionSources( false );
@@ -2664,7 +2624,7 @@ class Title {
         *
         * @param bool $getPages Whether or not to retrieve the actual pages
         *        that the restrictions have come from.
-        * @return Mixed Array of Title objects of the pages from which cascading restrictions
+        * @return array|bool Array of Title objects of the pages from which cascading restrictions
         *     have come, false for none, or true if such restrictions exist, but $getPages
         *     was not set.  The restriction array is an array of each type, each of which
         *     contains a array of unique groups.
@@ -2773,8 +2733,8 @@ class Title {
        /**
         * Accessor/initialisation for mRestrictions
         *
-        * @param string $action action that permission needs to be checked for
-        * @return Array of Strings the array of groups allowed to edit this article
+        * @param string $action Action that permission needs to be checked for
+        * @return array Array of Strings the array of groups allowed to edit this article
         */
        public function getRestrictions( $action ) {
                if ( !$this->mRestrictionsLoaded ) {
@@ -2788,7 +2748,7 @@ class Title {
        /**
         * Accessor/initialisation for mRestrictions
         *
-        * @return Array of Arrays of Strings the first level indexed by
+        * @return array Array of Arrays of Strings the first level indexed by
         * action, the second level containing the names of the groups
         * allowed to perform each action
         * @since 1.23
@@ -2803,8 +2763,8 @@ class Title {
        /**
         * Get the expiry time for the restriction against a given action
         *
-        * @param $action
-        * @return String|Bool 14-char timestamp, or 'infinity' if the page is protected forever
+        * @param string $action
+        * @return string|bool 14-char timestamp, or 'infinity' if the page is protected forever
         *     or not protected at all, or false if the action is not recognised.
         */
        public function getRestrictionExpiry( $action ) {
@@ -2817,7 +2777,7 @@ class Title {
        /**
         * Returns cascading restrictions for the current article
         *
-        * @return Boolean
+        * @return bool
         */
        function areRestrictionsCascading() {
                if ( !$this->mRestrictionsLoaded ) {
@@ -2830,8 +2790,8 @@ class Title {
        /**
         * Loads a string into mRestrictions array
         *
-        * @param $res Resource restrictions as an SQL result.
-        * @param string $oldFashionedRestrictions comma-separated list of page
+        * @param ResultWrapper $res Resource restrictions as an SQL result.
+        * @param string $oldFashionedRestrictions Comma-separated list of page
         *        restrictions from page table (pre 1.10)
         */
        private function loadRestrictionsFromResultWrapper( $res, $oldFashionedRestrictions = null ) {
@@ -2849,9 +2809,9 @@ class Title {
         * and page_restrictions table for this existing page.
         * Public for usage by LiquidThreads.
         *
-        * @param array $rows of db result objects
-        * @param string $oldFashionedRestrictions comma-separated list of page
-        *        restrictions from page table (pre 1.10)
+        * @param array $rows Array of db result objects
+        * @param string $oldFashionedRestrictions Comma-separated list of page
+        *   restrictions from page table (pre 1.10)
         */
        public function loadRestrictionsFromRows( $rows, $oldFashionedRestrictions = null ) {
                global $wgContLang;
@@ -2933,8 +2893,8 @@ class Title {
        /**
         * Load restrictions from the page_restrictions table
         *
-        * @param string $oldFashionedRestrictions comma-separated list of page
-        *        restrictions from page table (pre 1.10)
+        * @param string $oldFashionedRestrictions Comma-separated list of page
+        *   restrictions from page table (pre 1.10)
         */
        public function loadRestrictions( $oldFashionedRestrictions = null ) {
                global $wgContLang;
@@ -3009,7 +2969,7 @@ class Title {
        /**
         * Does this have subpages?  (Warning, usually requires an extra DB query.)
         *
-        * @return Bool
+        * @return bool
         */
        public function hasSubpages() {
                if ( !MWNamespace::hasSubpages( $this->mNamespace ) ) {
@@ -3035,8 +2995,8 @@ class Title {
        /**
         * Get all subpages of this page.
         *
-        * @param int $limit maximum number of subpages to fetch; -1 for no limit
-        * @return mixed TitleArray, or empty array if this page's namespace
+        * @param int $limit Maximum number of subpages to fetch; -1 for no limit
+        * @return TitleArray|array TitleArray, or empty array if this page's namespace
         *  doesn't allow subpages
         */
        public function getSubpages( $limit = -1 ) {
@@ -3065,7 +3025,7 @@ class Title {
        /**
         * Is there a version of this page in the deletion archive?
         *
-        * @return Int the number of archived revisions
+        * @return int The number of archived revisions
         */
        public function isDeleted() {
                if ( $this->getNamespace() < 0 ) {
@@ -3090,7 +3050,7 @@ class Title {
        /**
         * Is there a version of this page in the deletion archive?
         *
-        * @return Boolean
+        * @return bool
         */
        public function isDeletedQuick() {
                if ( $this->getNamespace() < 0 ) {
@@ -3114,9 +3074,9 @@ class Title {
         * Get the article ID for this Title from the link cache,
         * adding it if necessary
         *
-        * @param int $flags a bit field; may be Title::GAID_FOR_UPDATE to select
+        * @param int $flags A bit field; may be Title::GAID_FOR_UPDATE to select
         *  for update
-        * @return Int the ID
+        * @return int The ID
         */
        public function getArticleID( $flags = 0 ) {
                if ( $this->getNamespace() < 0 ) {
@@ -3141,8 +3101,8 @@ class Title {
         * Is this an article that is a redirect page?
         * Uses link cache, adding it if necessary
         *
-        * @param int $flags a bit field; may be Title::GAID_FOR_UPDATE to select for update
-        * @return Bool
+        * @param int $flags A bit field; may be Title::GAID_FOR_UPDATE to select for update
+        * @return bool
         */
        public function isRedirect( $flags = 0 ) {
                if ( !is_null( $this->mRedirect ) ) {
@@ -3176,8 +3136,8 @@ class Title {
         * What is the length of this page?
         * Uses link cache, adding it if necessary
         *
-        * @param int $flags a bit field; may be Title::GAID_FOR_UPDATE to select for update
-        * @return Int
+        * @param int $flags A bit field; may be Title::GAID_FOR_UPDATE to select for update
+        * @return int
         */
        public function getLength( $flags = 0 ) {
                if ( $this->mLength != -1 ) {
@@ -3204,8 +3164,8 @@ class Title {
        /**
         * What is the page_latest field for this page?
         *
-        * @param int $flags a bit field; may be Title::GAID_FOR_UPDATE to select for update
-        * @return Int or 0 if the page doesn't exist
+        * @param int $flags A bit field; may be Title::GAID_FOR_UPDATE to select for update
+        * @return int Int or 0 if the page doesn't exist
         */
        public function getLatestRevID( $flags = 0 ) {
                if ( !( $flags & Title::GAID_FOR_UPDATE ) && $this->mLatestID !== false ) {
@@ -3238,7 +3198,7 @@ class Title {
         * loading of the new page_id. It's also called from
         * WikiPage::doDeleteArticleReal()
         *
-        * @param int $newid the new Article ID
+        * @param int $newid The new Article ID
         */
        public function resetArticleID( $newid ) {
                $linkCache = LinkCache::singleton();
@@ -3262,9 +3222,9 @@ class Title {
        /**
         * Capitalize a text string for a title if it belongs to a namespace that capitalizes
         *
-        * @param string $text containing title to capitalize
-        * @param int $ns namespace index, defaults to NS_MAIN
-        * @return String containing capitalized title
+        * @param string $text Containing title to capitalize
+        * @param int $ns Namespace index, defaults to NS_MAIN
+        * @return string Containing capitalized title
         */
        public static function capitalize( $text, $ns = NS_MAIN ) {
                global $wgContLang;
@@ -3285,7 +3245,7 @@ class Title {
         * namespace prefixes, sets the other forms, and canonicalizes
         * everything.
         *
-        * @return Bool true on success
+        * @return bool True on success
         */
        private function secureAndSplit() {
                # Initialisation
@@ -3330,10 +3290,10 @@ class Title {
         * WARNING: do not use this function on arbitrary user-supplied titles!
         * On heavily-used templates it will max out the memory.
         *
-        * @param array $options may be FOR UPDATE
-        * @param string $table table name
-        * @param string $prefix fields prefix
-        * @return Array of Title objects linking here
+        * @param array $options May be FOR UPDATE
+        * @param string $table Table name
+        * @param string $prefix Fields prefix
+        * @return Title[] Array of Title objects linking here
         */
        public function getLinksTo( $options = array(), $table = 'pagelinks', $prefix = 'pl' ) {
                if ( count( $options ) > 0 ) {
@@ -3374,8 +3334,8 @@ class Title {
         * WARNING: do not use this function on arbitrary user-supplied titles!
         * On heavily-used templates it will max out the memory.
         *
-        * @param array $options may be FOR UPDATE
-        * @return Array of Title the Title objects linking here
+        * @param array $options May be FOR UPDATE
+        * @return Title[] Array of Title the Title objects linking here
         */
        public function getTemplateLinksTo( $options = array() ) {
                return $this->getLinksTo( $options, 'templatelinks', 'tl' );
@@ -3388,10 +3348,10 @@ class Title {
         * WARNING: do not use this function on arbitrary user-supplied titles!
         * On heavily-used templates it will max out the memory.
         *
-        * @param array $options may be FOR UPDATE
-        * @param string $table table name
-        * @param string $prefix fields prefix
-        * @return Array of Title objects linking here
+        * @param array $options May be FOR UPDATE
+        * @param string $table Table name
+        * @param string $prefix Fields prefix
+        * @return array Array of Title objects linking here
         */
        public function getLinksFrom( $options = array(), $table = 'pagelinks', $prefix = 'pl' ) {
                global $wgContentHandlerUseDB;
@@ -3451,8 +3411,8 @@ class Title {
         * WARNING: do not use this function on arbitrary user-supplied titles!
         * On heavily-used templates it will max out the memory.
         *
-        * @param array $options may be FOR UPDATE
-        * @return Array of Title the Title objects used here
+        * @param array $options May be FOR UPDATE
+        * @return Title[] Array of Title the Title objects used here
         */
        public function getTemplateLinksFrom( $options = array() ) {
                return $this->getLinksFrom( $options, 'templatelinks', 'tl' );
@@ -3462,7 +3422,7 @@ class Title {
         * Get an array of Title objects referring to non-existent articles linked from this page
         *
         * @todo check if needed (used only in SpecialBrokenRedirects.php, and should use redirect table in this case)
-        * @return Array of Title the Title objects
+        * @return Title[] Array of Title the Title objects
         */
        public function getBrokenLinksFrom() {
                if ( $this->getArticleID() == 0 ) {
@@ -3498,7 +3458,7 @@ class Title {
         * Get a list of URLs to purge from the Squid cache when this
         * page changes
         *
-        * @return Array of String the URLs
+        * @return string[] Array of String the URLs
         */
        public function getSquidURLs() {
                $urls = array(
@@ -3540,8 +3500,8 @@ class Title {
        /**
         * Move this page without authentication
         *
-        * @param $nt Title the new page Title
-        * @return Mixed true on success, getUserPermissionsErrors()-like array on failure
+        * @param Title $nt The new page Title
+        * @return array|bool True on success, getUserPermissionsErrors()-like array on failure
         */
        public function moveNoAuth( &$nt ) {
                return $this->moveTo( $nt, false );
@@ -3551,11 +3511,11 @@ class Title {
         * Check whether a given move operation would be valid.
         * Returns true if ok, or a getUserPermissionsErrors()-like array otherwise
         *
-        * @param $nt Title the new title
-        * @param bool $auth indicates whether $wgUser's permissions
+        * @param Title $nt The new title
+        * @param bool $auth Indicates whether $wgUser's permissions
         *  should be checked
-        * @param string $reason is the log summary of the move, used for spam checking
-        * @return Mixed True on success, getUserPermissionsErrors()-like array on failure
+        * @param string $reason Is the log summary of the move, used for spam checking
+        * @return array|bool True on success, getUserPermissionsErrors()-like array on failure
         */
        public function isValidMoveOperation( &$nt, $auth = true, $reason = '' ) {
                global $wgUser, $wgContentHandlerUseDB;
@@ -3701,13 +3661,13 @@ class Title {
        /**
         * Move a title to a new location
         *
-        * @param $nt Title the new title
-        * @param bool $auth indicates whether $wgUser's permissions
+        * @param Title $nt The new title
+        * @param bool $auth Indicates whether $wgUser's permissions
         *  should be checked
-        * @param string $reason the reason for the move
+        * @param string $reason The reason for the move
         * @param bool $createRedirect Whether to create a redirect from the old title to the new title.
         *  Ignored if the user doesn't have the suppressredirect right.
-        * @return Mixed true on success, getUserPermissionsErrors()-like array on failure
+        * @return array|bool True on success, getUserPermissionsErrors()-like array on failure
         */
        public function moveTo( &$nt, $auth = true, $reason = '', $createRedirect = true ) {
                global $wgUser;
@@ -3834,7 +3794,7 @@ class Title {
         * Move page to a title which is either a redirect to the
         * source page or nonexistent
         *
-        * @param $nt Title the page to move to, which should be a redirect or nonexistent
+        * @param Title $nt The page to move to, which should be a redirect or nonexistent
         * @param string $reason The reason for the move
         * @param bool $createRedirect Whether to leave a redirect at the old title. Does not check
         *   if the user has the suppressredirect right
@@ -3899,7 +3859,7 @@ class Title {
                }
 
                # Save a null revision in the page's history notifying of the move
-               $nullRevision = Revision::newNullRevision( $dbw, $oldid, $comment, true );
+               $nullRevision = Revision::newNullRevision( $dbw, $oldid, $comment, true, $wgUser );
                if ( !is_object( $nullRevision ) ) {
                        throw new MWException( 'No valid null revision produced in ' . __METHOD__ );
                }
@@ -3946,6 +3906,8 @@ class Title {
                                $redirectRevision = new Revision( array(
                                        'title' => $this, // for determining the default content model
                                        'page' => $newid,
+                                       'user_text' => $wgUser->getName(),
+                                       'user' => $wgUser->getId(),
                                        'comment' => $comment,
                                        'content' => $redirectContent ) );
                                $redirectRevision->insertOn( $dbw );
@@ -3966,12 +3928,12 @@ class Title {
        /**
         * Move this page's subpages to be subpages of $nt
         *
-        * @param $nt Title Move target
+        * @param Title $nt Move target
         * @param bool $auth Whether $wgUser's permissions should be checked
         * @param string $reason The reason for the move
         * @param bool $createRedirect Whether to create redirects from the old subpages to
         *     the new ones Ignored if the user doesn't have the 'suppressredirect' right
-        * @return mixed array with old page titles as keys, and strings (new page titles) or
+        * @return array Array with old page titles as keys, and strings (new page titles) or
         *     arrays (errors) as values, or an error array with numeric indices if no pages
         *     were moved
         */
@@ -4040,7 +4002,7 @@ class Title {
         * Checks if this page is just a one-rev redirect.
         * Adds lock, so don't use just for light purposes.
         *
-        * @return Bool
+        * @return bool
         */
        public function isSingleRevRedirect() {
                global $wgContentHandlerUseDB;
@@ -4086,8 +4048,8 @@ class Title {
         * Checks if $this can be moved to a given Title
         * - Selects for update, so don't call it unless you mean business
         *
-        * @param $nt Title the new title to check
-        * @return Bool
+        * @param Title $nt The new title to check
+        * @return bool
         */
        public function isValidMoveTarget( $nt ) {
                # Is it an existing file?
@@ -4133,7 +4095,7 @@ class Title {
         * Get categories to which this Title belongs and return an array of
         * categories' names.
         *
-        * @return Array of parents in the form:
+        * @return array Array of parents in the form:
         *        $parent => $currentarticle
         */
        public function getParentCategories() {
@@ -4168,8 +4130,8 @@ class Title {
        /**
         * Get a tree of parent categories
         *
-        * @param array $children with the children in the keys, to check for circular refs
-        * @return Array Tree of parent categories
+        * @param array $children Array with the children in the keys, to check for circular refs
+        * @return array Tree of parent categories
         */
        public function getParentCategoryTree( $children = array() ) {
                $stack = array();
@@ -4196,7 +4158,7 @@ class Title {
         * Get an associative array for selecting this title from
         * the "page" table
         *
-        * @return Array suitable for the $where parameter of DB::select()
+        * @return array Array suitable for the $where parameter of DB::select()
         */
        public function pageCond() {
                if ( $this->mArticleID > 0 ) {
@@ -4212,7 +4174,7 @@ class Title {
         *
         * @param int $revId Revision ID. Get the revision that was before this one.
         * @param int $flags Title::GAID_FOR_UPDATE
-        * @return Int|Bool Old revision ID, or FALSE if none exists
+        * @return int|bool Old revision ID, or false if none exists
         */
        public function getPreviousRevisionID( $revId, $flags = 0 ) {
                $db = ( $flags & self::GAID_FOR_UPDATE ) ? wfGetDB( DB_MASTER ) : wfGetDB( DB_SLAVE );
@@ -4237,7 +4199,7 @@ class Title {
         *
         * @param int $revId Revision ID. Get the revision that was after this one.
         * @param int $flags Title::GAID_FOR_UPDATE
-        * @return Int|Bool Next revision ID, or FALSE if none exists
+        * @return int|bool Next revision ID, or false if none exists
         */
        public function getNextRevisionID( $revId, $flags = 0 ) {
                $db = ( $flags & self::GAID_FOR_UPDATE ) ? wfGetDB( DB_MASTER ) : wfGetDB( DB_SLAVE );
@@ -4261,7 +4223,7 @@ class Title {
         * Get the first revision of the page
         *
         * @param int $flags Title::GAID_FOR_UPDATE
-        * @return Revision|Null if page doesn't exist
+        * @return Revision|null If page doesn't exist
         */
        public function getFirstRevision( $flags = 0 ) {
                $pageId = $this->getArticleID( $flags );
@@ -4283,7 +4245,7 @@ class Title {
         * Get the oldest revision timestamp of this page
         *
         * @param int $flags Title::GAID_FOR_UPDATE
-        * @return String: MW timestamp
+        * @return string MW timestamp
         */
        public function getEarliestRevTime( $flags = 0 ) {
                $rev = $this->getFirstRevision( $flags );
@@ -4341,9 +4303,10 @@ class Title {
         *
         * @param int|Revision $old Old revision or rev ID (first before range)
         * @param int|Revision $new New revision or rev ID (first after range)
-        * @return Int Number of revisions between these revisions.
+        * @param int|null $max Limit of Revisions to count, will be incremented to detect truncations
+        * @return int Number of revisions between these revisions.
         */
-       public function countRevisionsBetween( $old, $new ) {
+       public function countRevisionsBetween( $old, $new, $max = null ) {
                if ( !( $old instanceof Revision ) ) {
                        $old = Revision::newFromTitle( $this, (int)$old );
                }
@@ -4354,14 +4317,21 @@ class Title {
                        return 0; // nothing to compare
                }
                $dbr = wfGetDB( DB_SLAVE );
-               return (int)$dbr->selectField( 'revision', 'count(*)',
-                       array(
-                               'rev_page' => $this->getArticleID(),
-                               'rev_timestamp > ' . $dbr->addQuotes( $dbr->timestamp( $old->getTimestamp() ) ),
-                               'rev_timestamp < ' . $dbr->addQuotes( $dbr->timestamp( $new->getTimestamp() ) )
-                       ),
-                       __METHOD__
+               $conds = array(
+                       'rev_page' => $this->getArticleID(),
+                       'rev_timestamp > ' . $dbr->addQuotes( $dbr->timestamp( $old->getTimestamp() ) ),
+                       'rev_timestamp < ' . $dbr->addQuotes( $dbr->timestamp( $new->getTimestamp() ) )
                );
+               if ( $max !== null ) {
+                       $res = $dbr->select( 'revision', '1',
+                               $conds,
+                               __METHOD__,
+                               array( 'LIMIT' => $max + 1 ) // extra to detect truncation
+                       );
+                       return $res->numRows();
+               } else {
+                       return (int)$dbr->selectField( 'revision', 'count(*)', $conds, __METHOD__ );
+               }
        }
 
        /**
@@ -4460,8 +4430,8 @@ class Title {
        /**
         * Compare with another title.
         *
-        * @param $title Title
-        * @return Bool
+        * @param Title $title
+        * @return bool
         */
        public function equals( Title $title ) {
                // Note: === is necessary for proper matching of number-like titles.
@@ -4473,8 +4443,8 @@ class Title {
        /**
         * Check if this title is a subpage of another title
         *
-        * @param $title Title
-        * @return Bool
+        * @param Title $title
+        * @return bool
         */
        public function isSubpageOf( Title $title ) {
                return $this->getInterwiki() === $title->getInterwiki()
@@ -4489,7 +4459,7 @@ class Title {
         * If you want to know if a title can be meaningfully viewed, you should
         * probably call the isKnown() method instead.
         *
-        * @return Bool
+        * @return bool
         */
        public function exists() {
                return $this->getArticleID() != 0;
@@ -4509,7 +4479,7 @@ class Title {
         * existing code, but we might want to add an optional parameter to skip
         * it and any other expensive checks.)
         *
-        * @return Bool
+        * @return bool
         */
        public function isAlwaysKnown() {
                $isKnown = null;
@@ -4522,7 +4492,7 @@ class Title {
                 * @since 1.20
                 *
                 * @param Title $title
-                * @param boolean|null $isKnown
+                * @param bool|null $isKnown
                 */
                wfRunHooks( 'TitleIsAlwaysKnown', array( $this, &$isKnown ) );
 
@@ -4562,7 +4532,7 @@ class Title {
         * since LinkHolderArray calls isAlwaysKnown() and does its own
         * page existence check.
         *
-        * @return Bool
+        * @return bool
         */
        public function isKnown() {
                return $this->isAlwaysKnown() || $this->exists();
@@ -4571,7 +4541,7 @@ class Title {
        /**
         * Does this page have source text?
         *
-        * @return Boolean
+        * @return bool
         */
        public function hasSourceText() {
                if ( $this->exists() ) {
@@ -4595,7 +4565,7 @@ class Title {
        /**
         * Get the default message text or false if the message doesn't exist
         *
-        * @return String or false
+        * @return string|bool
         */
        public function getDefaultMessageText() {
                global $wgContLang;
@@ -4617,7 +4587,7 @@ class Title {
        /**
         * Updates page_touched for this page; called from LinksUpdate.php
         *
-        * @return Bool true if the update succeeded
+        * @return bool True if the update succeeded
         */
        public function invalidateCache() {
                if ( wfReadOnly() ) {
@@ -4657,8 +4627,8 @@ class Title {
        /**
         * Get the last touched timestamp
         *
-        * @param $db DatabaseBase: optional db
-        * @return String last-touched timestamp
+        * @param DatabaseBase $db Optional db
+        * @return string Last-touched timestamp
         */
        public function getTouched( $db = null ) {
                $db = isset( $db ) ? $db : wfGetDB( DB_SLAVE );
@@ -4669,8 +4639,8 @@ class Title {
        /**
         * Get the timestamp when this page was updated since the user last saw it.
         *
-        * @param $user User
-        * @return String|Null
+        * @param User $user
+        * @return string|null
         */
        public function getNotificationTimestamp( $user = null ) {
                global $wgUser, $wgShowUpdatedMarker;
@@ -4708,8 +4678,8 @@ class Title {
        /**
         * Generate strings used for xml 'id' names in monobook tabs
         *
-        * @param string $prepend defaults to 'nstab-'
-        * @return String XML 'id' name
+        * @param string $prepend Defaults to 'nstab-'
+        * @return string XML 'id' name
         */
        public function getNamespaceKey( $prepend = 'nstab-' ) {
                global $wgContLang;
@@ -4739,7 +4709,7 @@ class Title {
        /**
         * Get all extant redirects to this Title
         *
-        * @param int|Null $ns Single namespace to consider; NULL to consider all namespaces
+        * @param int|null $ns Single namespace to consider; null to consider all namespaces
         * @return Title[] Array of Title redirects to this title
         */
        public function getRedirectsHere( $ns = null ) {
@@ -4776,7 +4746,7 @@ class Title {
        /**
         * Check if this Title is a valid redirect target
         *
-        * @return Bool
+        * @return bool
         */
        public function isValidRedirectTarget() {
                global $wgInvalidRedirectTargets;
@@ -4807,7 +4777,7 @@ class Title {
        /**
         * Whether the magic words __INDEX__ and __NOINDEX__ function for  this page.
         *
-        * @return Boolean
+        * @return bool
         */
        public function canUseNoindex() {
                global $wgContentNamespaces, $wgExemptFromUserRobotsControl;
@@ -4917,7 +4887,7 @@ class Title {
         *
         * @since 1.21
         * @param int $oldid Revision ID that's being edited
-        * @return Array
+        * @return array
         */
        public function getEditNotices( $oldid = 0 ) {
                $notices = array();