r81380 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r81379‎ | r81380 | r81381 >
Date:11:00, 2 February 2011
Author:happy-melon
Status:ok
Tags:
Comment:
Follow-up r79682: more documentation tidying
Modified paths:
  • /trunk/phase3/includes/OutputPage.php (modified) (history)
  • /trunk/phase3/includes/Title.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/OutputPage.php
@@ -981,7 +981,7 @@
982982 /**
983983 * Add an array of categories, with names in the keys
984984 *
985 - * @param $categories Associative array mapping category name to its sort key
 985+ * @param $categories Array mapping category name => sort key
986986 */
987987 public function addCategoryLinks( $categories ) {
988988 global $wgUser, $wgContLang;
@@ -1043,7 +1043,7 @@
10441044 /**
10451045 * Reset the category links (but not the category list) and add $categories
10461046 *
1047 - * @param $categories Associative array mapping category name to its sort key
 1047+ * @param $categories Array mapping category name => sort key
10481048 */
10491049 public function setCategoryLinks( $categories ) {
10501050 $this->mCategoryLinks = array();
@@ -1471,7 +1471,7 @@
14721472 * Add an HTTP header that will influence on the cache
14731473 *
14741474 * @param $header String: header name
1475 - * @param $option either an Array or null
 1475+ * @param $option Array|null
14761476 * @fixme Document the $option parameter; it appears to be for
14771477 * X-Vary-Options but what format is acceptable?
14781478 */
@@ -2047,7 +2047,7 @@
20482048 /**
20492049 * Format a list of error messages
20502050 *
2051 - * @param $errors An array of arrays returned by Title::getUserPermissionsErrors
 2051+ * @param $errors Array of arrays returned by Title::getUserPermissionsErrors
20522052 * @param $action String: action that was denied or null if unknown
20532053 * @return String: the wikitext error-messages, formatted into a list.
20542054 */
Index: trunk/phase3/includes/Title.php
@@ -94,10 +94,10 @@
9595 /**
9696 * Create a new Title from a prefixed DB key
9797 *
98 - * @param $key String The database key, which has underscores
 98+ * @param $key String the database key, which has underscores
9999 * instead of spaces, possibly including namespace and
100100 * interwiki prefixes
101 - * @return Title the new object, or NULL on an error
 101+ * @return Title, or NULL on an error
102102 */
103103 public static function newFromDBkey( $key ) {
104104 $t = new Title();
@@ -113,13 +113,13 @@
114114 * Create a new Title from text, such as what one would find in a link. De-
115115 * codes any HTML entities in the text.
116116 *
117 - * @param $text String The link text; spaces, prefixes, and an
 117+ * @param $text String the link text; spaces, prefixes, and an
118118 * initial ':' indicating the main namespace are accepted.
119 - * @param $defaultNamespace int The namespace to use if none is speci-
 119+ * @param $defaultNamespace Int the namespace to use if none is speci-
120120 * fied by a prefix. If you want to force a specific namespace even if
121121 * $text might begin with a namespace prefix, use makeTitle() or
122122 * makeTitleSafe().
123 - * @return Title The new object, or null on an error.
 123+ * @return Title, or null on an error.
124124 */
125125 public static function newFromText( $text, $defaultNamespace = NS_MAIN ) {
126126 if ( is_object( $text ) ) {
@@ -138,9 +138,7 @@
139139 return Title::$titleCache[$text];
140140 }
141141
142 - /**
143 - * Convert things like é ā or 〗 into normalized (bug 14952) text
144 - */
 142+ # Convert things like é ā or 〗 into normalized (bug 14952) text
145143 $filteredText = Sanitizer::decodeCharReferencesAndNormalize( $text );
146144
147145 $t = new Title();
@@ -272,8 +270,8 @@
273271 *
274272 * @param $ns Int the namespace of the article
275273 * @param $title String the unprefixed database key form
276 - * @param $fragment String The link fragment (after the "#")
277 - * @param $interwiki String The interwiki prefix
 274+ * @param $fragment String the link fragment (after the "#")
 275+ * @param $interwiki String the interwiki prefix
278276 * @return Title the new object
279277 */
280278 public static function &makeTitle( $ns, $title, $fragment = '', $interwiki = '' ) {
@@ -294,9 +292,9 @@
295293 * than makeTitle() but safer for user-provided data.
296294 *
297295 * @param $ns Int the namespace of the article
298 - * @param $title String the database key form
299 - * @param $fragment String The link fragment (after the "#")
300 - * @param $interwiki String The interwiki prefix
 296+ * @param $title String database key form
 297+ * @param $fragment String the link fragment (after the "#")
 298+ * @param $interwiki String interwiki prefix
301299 * @return Title the new object, or NULL on an error
302300 */
303301 public static function makeTitleSafe( $ns, $title, $fragment = '', $interwiki = '' ) {
@@ -343,7 +341,7 @@
344342 * in order to provide (hopefully) the Title of the final destination instead of another redirect
345343 *
346344 * @param $text String Text with possible redirect
347 - * @return Title The corresponding Title
 345+ * @return Title
348346 */
349347 public static function newFromRedirectRecurse( $text ) {
350348 $titles = self::newFromRedirectArray( $text );
@@ -396,7 +394,7 @@
397395 * Do not call this function directly, use one of the newFromRedirect* functions above
398396 *
399397 * @param $text String Text with possible redirect
400 - * @return Title The corresponding Title
 398+ * @return Title
401399 */
402400 protected static function newFromRedirectInternal( $text ) {
403401 $redir = MagicWord::get( 'redirect' );
@@ -432,8 +430,7 @@
433431 * Get the prefixed DB key associated with an ID
434432 *
435433 * @param $id Int the page_id of the article
436 - * @return Title an object representing the article, or NULL
437 - * if no such article was found
 434+ * @return Title an object representing the article, or NULL if no such article was found
438435 */
439436 public static function nameOf( $id ) {
440437 $dbr = wfGetDB( DB_SLAVE );
@@ -468,8 +465,7 @@
469466 *
470467 * @param $ns Int a namespace index
471468 * @param $title String text-form main part
472 - * @return String a stripped-down title string ready for the
473 - * search index
 469+ * @return String a stripped-down title string ready for the search index
474470 */
475471 public static function indexTitle( $ns, $title ) {
476472 global $wgContLang;
@@ -518,8 +514,7 @@
519515 * Determine whether the object refers to a page within
520516 * this project.
521517 *
522 - * @return Bool TRUE if this is an in-project interwiki link
523 - * or a wikilink, FALSE otherwise
 518+ * @return Bool TRUE if this is an in-project interwiki link or a wikilink, FALSE otherwise
524519 */
525520 public function isLocal() {
526521 if ( $this->mInterwiki != '' ) {
@@ -544,8 +539,7 @@
545540 }
546541
547542 /**
548 - * Returns the DB name of the distant wiki
549 - * which owns the object.
 543+ * Returns the DB name of the distant wiki which owns the object.
550544 *
551545 * @return String the DB name
552546 */
@@ -598,7 +592,7 @@
599593 public function getDBkey() { return $this->mDbkeyform; }
600594
601595 /**
602 - * Get the namespace index, i.e.\ one of the NS_xxxx constants.
 596+ * Get the namespace index, i.e. one of the NS_xxxx constants.
603597 *
604598 * @return Integer: Namespace index
605599 */
@@ -738,8 +732,7 @@
739733 * Get the prefixed title with spaces, plus any fragment
740734 * (part beginning with '#')
741735 *
742 - * @return String the prefixed title, with spaces and
743 - * the fragment, including '#'
 736+ * @return String the prefixed title, with spaces and the fragment, including '#'
744737 */
745738 public function getFullText() {
746739 $text = $this->getPrefixedText();
@@ -939,7 +932,7 @@
940933 *
941934 * @param $query Array of Strings An associative array of key => value pairs for the
942935 * query string. Keys and values will be escaped.
943 - * @param $variant String Language variant of URL (for sr, zh..). Ignored
 936+ * @param $variant String language variant of URL (for sr, zh..). Ignored
944937 * for external links. Default is "false" (same variant as current page,
945938 * for anonymous users).
946939 * @return String the URL
@@ -1185,7 +1178,7 @@
11861179 * @param $user User to check
11871180 * @param $doExpensiveQueries Bool Set this to false to avoid doing unnecessary queries.
11881181 * @param $ignoreErrors Array of Strings Set this to a list of message keys whose corresponding errors may be ignored.
1189 - * @return Array of arrays of the arguments to wfMsg to explain permissions problems.
 1182+ * @return Array of arguments to wfMsg to explain permissions problems.
11901183 */
11911184 public function getUserPermissionsErrors( $action, $user, $doExpensiveQueries = true, $ignoreErrors = array() ) {
11921185 $errors = $this->getUserPermissionsErrorsInternal( $action, $user, $doExpensiveQueries );
@@ -1436,7 +1429,7 @@
14371430 * Check restrictions on cascading pages.
14381431 *
14391432 * @param $action String the action to check
1440 - * @param $user User user to check
 1433+ * @param $user User to check
14411434 * @param $errors Array list of current errors
14421435 * @param $doExpensiveQueries Boolean whether or not to perform expensive queries
14431436 * @param $short Boolean short circuit on first error
@@ -1475,7 +1468,7 @@
14761469 * Check action permissions not already checked in checkQuickPermissions
14771470 *
14781471 * @param $action String the action to check
1479 - * @param $user User user to check
 1472+ * @param $user User to check
14801473 * @param $errors Array list of current errors
14811474 * @param $doExpensiveQueries Boolean whether or not to perform expensive queries
14821475 * @param $short Boolean short circuit on first error
@@ -1521,7 +1514,7 @@
15221515 * Check that the user isn't blocked from editting.
15231516 *
15241517 * @param $action String the action to check
1525 - * @param $user User user to check
 1518+ * @param $user User to check
15261519 * @param $errors Array list of current errors
15271520 * @param $doExpensiveQueries Boolean whether or not to perform expensive queries
15281521 * @param $short Boolean short circuit on first error
@@ -1797,44 +1790,33 @@
17981791 } else {
17991792 global $wgWhitelistRead;
18001793
1801 - /**
1802 - * Always grant access to the login page.
1803 - * Even anons need to be able to log in.
1804 - */
 1794+ # Always grant access to the login page.
 1795+ # Even anons need to be able to log in.
18051796 if ( $this->isSpecial( 'Userlogin' ) || $this->isSpecial( 'Resetpass' ) ) {
18061797 return true;
18071798 }
18081799
1809 - /**
1810 - * Bail out if there isn't whitelist
1811 - */
 1800+ # Bail out if there isn't whitelist
18121801 if ( !is_array( $wgWhitelistRead ) ) {
18131802 return false;
18141803 }
18151804
1816 - /**
1817 - * Check for explicit whitelisting
1818 - */
 1805+ # Check for explicit whitelisting
18191806 $name = $this->getPrefixedText();
18201807 $dbName = $this->getPrefixedDBKey();
18211808 // Check with and without underscores
18221809 if ( in_array( $name, $wgWhitelistRead, true ) || in_array( $dbName, $wgWhitelistRead, true ) )
18231810 return true;
18241811
1825 - /**
1826 - * Old settings might have the title prefixed with
1827 - * a colon for main-namespace pages
1828 - */
 1812+ # Old settings might have the title prefixed with
 1813+ # a colon for main-namespace pages
18291814 if ( $this->getNamespace() == NS_MAIN ) {
18301815 if ( in_array( ':' . $name, $wgWhitelistRead ) ) {
18311816 return true;
18321817 }
18331818 }
18341819
1835 - /**
1836 - * If it's a special page, ditch the subpage bit
1837 - * and check again
1838 - */
 1820+ # If it's a special page, ditch the subpage bit and check again
18391821 if ( $this->getNamespace() == NS_SPECIAL ) {
18401822 $name = $this->getDBkey();
18411823 list( $name, /* $subpage */ ) = SpecialPage::resolveAliasWithSubpage( $name );
@@ -1964,7 +1946,7 @@
19651947 * Is this a *valid* .css or .js subpage of a user page?
19661948 *
19671949 * @return Bool
1968 - * @deprecated
 1950+ * @deprecated @since 1.17
19691951 */
19701952 public function isValidCssJsSubpage() {
19711953 return $this->isCssJsSubpage();
@@ -2040,11 +2022,10 @@
20412023 *
20422024 * @param $getPages Bool Whether or not to retrieve the actual pages
20432025 * that the restrictions have come from.
2044 - * @return Mixed Array of the Title
2045 - * objects of the pages from which cascading restrictions have come,
2046 - * false for none, or true if such restrictions exist, but $getPages was not set.
2047 - * The restriction array is an array of each type, each of which contains a
2048 - * array of unique groups.
 2026+ * @return Mixed Array of Title objects of the pages from which cascading restrictions
 2027+ * have come, false for none, or true if such restrictions exist, but $getPages
 2028+ * was not set. The restriction array is an array of each type, each of which
 2029+ * contains a array of unique groups.
20492030 */
20502031 public function getCascadeProtectionSources( $getPages = true ) {
20512032 $pagerestrictions = array();
@@ -2151,7 +2132,7 @@
21522133 * Loads a string into mRestrictions array
21532134 *
21542135 * @param $res Resource restrictions as an SQL result.
2155 - * @param $oldFashionedRestrictions string comma-separated list of page
 2136+ * @param $oldFashionedRestrictions String comma-separated list of page
21562137 * restrictions from page table (pre 1.10)
21572138 */
21582139 private function loadRestrictionsFromResultWrapper( $res, $oldFashionedRestrictions = null ) {
@@ -2214,11 +2195,10 @@
22152196 $now = wfTimestampNow();
22162197 $purgeExpired = false;
22172198
 2199+ # Cycle through all the restrictions.
22182200 foreach ( $rows as $row ) {
2219 - # Cycle through all the restrictions.
22202201
22212202 // Don't take care of restrictions types that aren't allowed
2222 -
22232203 if ( !in_array( $row->pr_type, $restrictionTypes ) )
22242204 continue;
22252205
@@ -2249,7 +2229,7 @@
22502230 /**
22512231 * Load restrictions from the page_restrictions table
22522232 *
2253 - * @param $oldFashionedRestrictions string comma-separated list of page
 2233+ * @param $oldFashionedRestrictions String comma-separated list of page
22542234 * restrictions from page table (pre 1.10)
22552235 */
22562236 public function loadRestrictions( $oldFashionedRestrictions = null ) {
@@ -2320,7 +2300,7 @@
23212301 /**
23222302 * Get the expiry time for the restriction against a given action
23232303 *
2324 - * @return 14-char timestamp, or 'infinity' if the page is protected forever
 2304+ * @return String|Bool 14-char timestamp, or 'infinity' if the page is protected forever
23252305 * or not protected at all, or false if the action is not recognised.
23262306 */
23272307 public function getRestrictionExpiry( $action ) {
@@ -2535,7 +2515,7 @@
25362516 * Note that this doesn't pick up many things that could be wrong with titles, but that
25372517 * replacing this regex with something valid will make many titles valid.
25382518 *
2539 - * @return string regex string
 2519+ * @return String regex string
25402520 */
25412521 static function getTitleInvalidRegex() {
25422522 static $rxTc = false;
@@ -2560,7 +2540,7 @@
25612541 /**
25622542 * Capitalize a text string for a title if it belongs to a namespace that capitalizes
25632543 *
2564 - * @param $text string containing title to capitalize
 2544+ * @param $text String containing title to capitalize
25652545 * @param $ns int namespace index, defaults to NS_MAIN
25662546 * @return String containing capitalized title
25672547 */
@@ -2605,7 +2585,6 @@
26062586 # Note: use of the /u option on preg_replace here will cause
26072587 # input with invalid UTF-8 sequences to be nullified out in PHP 5.2.x,
26082588 # conveniently disabling them.
2609 - #
26102589 $dbkey = preg_replace( '/[ _\xA0\x{1680}\x{180E}\x{2000}-\x{200A}\x{2028}\x{2029}\x{202F}\x{205F}\x{3000}]+/u', '_', $dbkey );
26112590 $dbkey = trim( $dbkey, '_' );
26122591
@@ -2642,9 +2621,11 @@
26432622 # For Talk:X pages, check if X has a "namespace" prefix
26442623 if ( $ns == NS_TALK && preg_match( $prefixRegexp, $dbkey, $x ) ) {
26452624 if ( $wgContLang->getNsIndex( $x[1] ) ) {
2646 - return false; # Disallow Talk:File:x type titles...
 2625+ # Disallow Talk:File:x type titles...
 2626+ return false;
26472627 } else if ( Interwiki::isValidInterwiki( $x[1] ) ) {
2648 - return false; # Disallow Talk:Interwiki:x type titles...
 2628+ # Disallow Talk:Interwiki:x type titles...
 2629+ return false;
26492630 }
26502631 }
26512632 } elseif ( Interwiki::isValidInterwiki( $p ) ) {
@@ -2686,7 +2667,6 @@
26872668 } while ( true );
26882669
26892670 # We already know that some pages won't be in the database!
2690 - #
26912671 if ( $this->mInterwiki != '' || NS_SPECIAL == $this->mNamespace ) {
26922672 $this->mArticleID = 0;
26932673 }
@@ -2700,16 +2680,13 @@
27012681 }
27022682
27032683 # Reject illegal characters.
2704 - #
27052684 if ( preg_match( $rxTc, $dbkey ) ) {
27062685 return false;
27072686 }
27082687
2709 - /**
2710 - * Pages with "/./" or "/../" appearing in the URLs will often be un-
2711 - * reachable due to the way web browsers deal with 'relative' URLs.
2712 - * Also, they conflict with subpage syntax. Forbid them explicitly.
2713 - */
 2688+ # Pages with "/./" or "/../" appearing in the URLs will often be un-
 2689+ # reachable due to the way web browsers deal with 'relative' URLs.
 2690+ # Also, they conflict with subpage syntax. Forbid them explicitly.
27142691 if ( strpos( $dbkey, '.' ) !== false &&
27152692 ( $dbkey === '.' || $dbkey === '..' ||
27162693 strpos( $dbkey, './' ) === 0 ||
@@ -2722,57 +2699,45 @@
27232700 return false;
27242701 }
27252702
2726 - /**
2727 - * Magic tilde sequences? Nu-uh!
2728 - */
 2703+ # Magic tilde sequences? Nu-uh!
27292704 if ( strpos( $dbkey, '~~~' ) !== false ) {
27302705 return false;
27312706 }
27322707
2733 - /**
2734 - * Limit the size of titles to 255 bytes.
2735 - * This is typically the size of the underlying database field.
2736 - * We make an exception for special pages, which don't need to be stored
2737 - * in the database, and may edge over 255 bytes due to subpage syntax
2738 - * for long titles, e.g. [[Special:Block/Long name]]
2739 - */
 2708+ # Limit the size of titles to 255 bytes. This is typically the size of the
 2709+ # underlying database field. We make an exception for special pages, which
 2710+ # don't need to be stored in the database, and may edge over 255 bytes due
 2711+ # to subpage syntax for long titles, e.g. [[Special:Block/Long name]]
27402712 if ( ( $this->mNamespace != NS_SPECIAL && strlen( $dbkey ) > 255 ) ||
27412713 strlen( $dbkey ) > 512 )
27422714 {
27432715 return false;
27442716 }
27452717
2746 - /**
2747 - * Normally, all wiki links are forced to have
2748 - * an initial capital letter so [[foo]] and [[Foo]]
2749 - * point to the same place.
2750 - *
2751 - * Don't force it for interwikis, since the other
2752 - * site might be case-sensitive.
2753 - */
 2718+ # Normally, all wiki links are forced to have an initial capital letter so [[foo]]
 2719+ # and [[Foo]] point to the same place. Don't force it for interwikis, since the
 2720+ # other site might be case-sensitive.
27542721 $this->mUserCaseDBKey = $dbkey;
27552722 if ( $this->mInterwiki == '' ) {
27562723 $dbkey = self::capitalize( $dbkey, $this->mNamespace );
27572724 }
27582725
2759 - /**
2760 - * Can't make a link to a namespace alone...
2761 - * "empty" local links can only be self-links
2762 - * with a fragment identifier.
2763 - */
2764 - if ( $dbkey == '' &&
2765 - $this->mInterwiki == '' &&
2766 - $this->mNamespace != NS_MAIN ) {
 2726+ # Can't make a link to a namespace alone... "empty" local links can only be
 2727+ # self-links with a fragment identifier.
 2728+ if ( $dbkey == '' && $this->mInterwiki == '' && $this->mNamespace != NS_MAIN ) {
27672729 return false;
27682730 }
 2731+
27692732 // Allow IPv6 usernames to start with '::' by canonicalizing IPv6 titles.
27702733 // IP names are not allowed for accounts, and can only be referring to
27712734 // edits from the IP. Given '::' abbreviations and caps/lowercaps,
27722735 // there are numerous ways to present the same IP. Having sp:contribs scan
27732736 // them all is silly and having some show the edits and others not is
27742737 // inconsistent. Same for talk/userpages. Keep them normalized instead.
2775 - $dbkey = ( $this->mNamespace == NS_USER || $this->mNamespace == NS_USER_TALK ) ?
2776 - IP::sanitizeIP( $dbkey ) : $dbkey;
 2738+ $dbkey = ( $this->mNamespace == NS_USER || $this->mNamespace == NS_USER_TALK )
 2739+ ? IP::sanitizeIP( $dbkey )
 2740+ : $dbkey;
 2741+
27772742 // Any remaining initial :s are illegal.
27782743 if ( $dbkey !== '' && ':' == $dbkey { 0 } ) {
27792744 return false;
@@ -3082,7 +3047,7 @@
30833048 * @param $nt Title the new title
30843049 * @param $auth Bool indicates whether $wgUser's permissions
30853050 * should be checked
3086 - * @param $reason String The reason for the move
 3051+ * @param $reason String the reason for the move
30873052 * @param $createRedirect Bool Whether to create a redirect from the old title to the new title.
30883053 * Ignored if the user doesn't have the suppressredirect right.
30893054 * @return Mixed true on success, getUserPermissionsErrors()-like array on failure
@@ -3093,7 +3058,8 @@
30943059 return $err;
30953060 }
30963061
3097 - // If it is a file, move it first. It is done before all other moving stuff is done because it's hard to revert
 3062+ // If it is a file, move it first. It is done before all other moving stuff is
 3063+ // done because it's hard to revert
30983064 $dbw = wfGetDB( DB_MASTER );
30993065 if ( $this->getNamespace() == NS_FILE ) {
31003066 $file = wfLocalFile( $this );
@@ -3217,12 +3183,10 @@
32183184 * Move page to a title which is either a redirect to the
32193185 * source page or nonexistent
32203186 *
3221 - * @param $nt Title the page to move to, which should
3222 - * be a redirect or nonexistent
 3187+ * @param $nt Title the page to move to, which should be a redirect or nonexistent
32233188 * @param $reason String The reason for the move
3224 - * @param $createRedirect Bool Whether to leave a
3225 - * redirect at the old title. Ignored if the user doesn't
3226 - * have the suppressredirect right
 3189+ * @param $createRedirect Bool Whether to leave a redirect at the old title. Ignored
 3190+ * if the user doesn't have the suppressredirect right
32273191 */
32283192 private function moveToInternal( &$nt, $reason = '', $createRedirect = true ) {
32293193 global $wgUser, $wgContLang;
@@ -3351,10 +3315,11 @@
33523316 * @param $nt Title Move target
33533317 * @param $auth bool Whether $wgUser's permissions should be checked
33543318 * @param $reason string The reason for the move
3355 - * @param $createRedirect bool Whether to create redirects from the old subpages to the new ones
3356 - * Ignored if the user doesn't have the 'suppressredirect' right
 3319+ * @param $createRedirect bool Whether to create redirects from the old subpages to
 3320+ * the new ones Ignored if the user doesn't have the 'suppressredirect' right
33573321 * @return mixed array with old page titles as keys, and strings (new page titles) or
3358 - * arrays (errors) as values, or an error array with numeric indices if no pages were moved
 3322+ * arrays (errors) as values, or an error array with numeric indices if no pages
 3323+ * were moved
33593324 */
33603325 public function moveSubpages( $nt, $auth = true, $reason = '', $createRedirect = true ) {
33613326 global $wgMaximumMovedPages;
@@ -3459,7 +3424,7 @@
34603425 * - Selects for update, so don't call it unless you mean business
34613426 *
34623427 * @param $nt Title the new title to check
3463 - * @return Bool TRUE or FALSE
 3428+ * @return Bool
34643429 */
34653430 public function isValidMoveTarget( $nt ) {
34663431 # Is it an existing file?
@@ -3511,7 +3476,7 @@
35123477 * categories' names.
35133478 *
35143479 * @return Array of parents in the form:
3515 - * $parent => $currentarticle
 3480+ * $parent => $currentarticle
35163481 */
35173482 public function getParentCategories() {
35183483 global $wgContLang;
@@ -3574,7 +3539,7 @@
35753540 * Get an associative array for selecting this title from
35763541 * the "page" table
35773542 *
3578 - * @return Array Selection array
 3543+ * @return Array suitable for the $where parameter of DB::select()
35793544 */
35803545 public function pageCond() {
35813546 if ( $this->mArticleID > 0 ) {
@@ -3590,7 +3555,7 @@
35913556 *
35923557 * @param $revId Int Revision ID. Get the revision that was before this one.
35933558 * @param $flags Int Title::GAID_FOR_UPDATE
3594 - * @return \twotypes{\int,\bool} Old revision ID, or FALSE if none exists
 3559+ * @return Int|Bool Old revision ID, or FALSE if none exists
35953560 */
35963561 public function getPreviousRevisionID( $revId, $flags = 0 ) {
35973562 $db = ( $flags & self::GAID_FOR_UPDATE ) ? wfGetDB( DB_MASTER ) : wfGetDB( DB_SLAVE );
@@ -3609,7 +3574,7 @@
36103575 *
36113576 * @param $revId Int Revision ID. Get the revision that was after this one.
36123577 * @param $flags Int Title::GAID_FOR_UPDATE
3613 - * @return \twotypes{\int,\bool} Next revision ID, or FALSE if none exists
 3578+ * @return Int|Bool Next revision ID, or FALSE if none exists
36143579 */
36153580 public function getNextRevisionID( $revId, $flags = 0 ) {
36163581 $db = ( $flags & self::GAID_FOR_UPDATE ) ? wfGetDB( DB_MASTER ) : wfGetDB( DB_SLAVE );
@@ -3627,7 +3592,7 @@
36283593 * Get the first revision of the page
36293594 *
36303595 * @param $flags Int Title::GAID_FOR_UPDATE
3631 - * @return Revision (or NULL if page doesn't exist)
 3596+ * @return Revision|Null if page doesn't exist
36323597 */
36333598 public function getFirstRevision( $flags = 0 ) {
36343599 $db = ( $flags & self::GAID_FOR_UPDATE ) ? wfGetDB( DB_MASTER ) : wfGetDB( DB_SLAVE );
@@ -3719,7 +3684,7 @@
37203685 * Compare with another title.
37213686 *
37223687 * @param $title Title
3723 - * @return Bool TRUE or FALSE
 3688+ * @return Bool
37243689 */
37253690 public function equals( Title $title ) {
37263691 // Note: === is necessary for proper matching of number-like titles.
@@ -3744,7 +3709,7 @@
37453710 /**
37463711 * Return a string representation of this title
37473712 *
3748 - * @return String String representation of this title
 3713+ * @return String representation of this title
37493714 */
37503715 public function __toString() {
37513716 return $this->getPrefixedText();
@@ -3786,17 +3751,21 @@
37873752 switch( $this->mNamespace ) {
37883753 case NS_MEDIA:
37893754 case NS_FILE:
3790 - return (bool)wfFindFile( $this ); // file exists, possibly in a foreign repo
 3755+ // file exists, possibly in a foreign repo
 3756+ return (bool)wfFindFile( $this );
37913757 case NS_SPECIAL:
3792 - return SpecialPage::exists( $this->getDBkey() ); // valid special page
 3758+ // valid special page
 3759+ return SpecialPage::exists( $this->getDBkey() );
37933760 case NS_MAIN:
3794 - return $this->mDbkeyform == ''; // selflink, possibly with fragment
 3761+ // selflink, possibly with fragment
 3762+ return $this->mDbkeyform == '';
37953763 case NS_MEDIAWIKI:
37963764 // If the page is form Mediawiki:message/lang, calling wfMsgWeirdKey causes
37973765 // the full l10n of that language to be loaded. That takes much memory and
37983766 // isn't needed. So we strip the language part away.
37993767 list( $basename, /* rest */ ) = explode( '/', $this->mDbkeyform, 2 );
3800 - return (bool)wfMsgWeirdKey( $basename ); // known system message
 3768+ // known system message
 3769+ return (bool)wfMsgWeirdKey( $basename );
38013770 default:
38023771 return false;
38033772 }
@@ -3866,7 +3835,7 @@
38673836 * Get the last touched timestamp
38683837 *
38693838 * @param $db DatabaseBase: optional db
3870 - * @return String Last touched timestamp
 3839+ * @return String last-touched timestamp
38713840 */
38723841 public function getTouched( $db = null ) {
38733842 $db = isset( $db ) ? $db : wfGetDB( DB_SLAVE );
@@ -3878,7 +3847,7 @@
38793848 * Get the timestamp when this page was updated since the user last saw it.
38803849 *
38813850 * @param $user User
3882 - * @return Mixed: string/null
 3851+ * @return String|Null
38833852 */
38843853 public function getNotificationTimestamp( $user = null ) {
38853854 global $wgUser, $wgShowUpdatedMarker;
@@ -4007,10 +3976,10 @@
40083977 }
40093978
40103979 /**
4011 - * If the Title refers to a special page alias which is not the local default,
 3980+ * If the Title refers to a special page alias which is not the local default, resolve
 3981+ * the alias, and localise the name as necessary. Otherwise, return $this
40123982 *
4013 - * @return Title A new Title which points to the local default.
4014 - * Otherwise, returns $this.
 3983+ * @return Title
40153984 */
40163985 public function fixSpecialName() {
40173986 if ( $this->getNamespace() == NS_SPECIAL ) {
@@ -4039,8 +4008,7 @@
40404009 /**
40414010 * Get all extant redirects to this Title
40424011 *
4043 - * @param $ns Int|Null Single namespace to consider;
4044 - * NULL to consider all namespaces
 4012+ * @param $ns Int|Null Single namespace to consider; NULL to consider all namespaces
40454013 * @return Array of Title redirects to this title
40464014 */
40474015 public function getRedirectsHere( $ns = null ) {
@@ -4104,8 +4072,7 @@
41054073 }
41064074
41074075 /**
4108 - * Whether the magic words __INDEX__ and __NOINDEX__ function for
4109 - * this page.
 4076+ * Whether the magic words __INDEX__ and __NOINDEX__ function for this page.
41104077 *
41114078 * @return Boolean
41124079 */

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r79682Documentation formathappy-melon23:08, 5 January 2011

Status & tagging log