r38622 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r38621‎ | r38622 | r38623 >
Date:13:42, 5 August 2008
Author:krimpet
Status:old
Tags:
Comment:
Documented User.php in depth; added useful aliases to Doxyfile
Modified paths:
  • /trunk/phase3/includes/User.php (modified) (history)
  • /trunk/phase3/maintenance/Doxyfile (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/Doxyfile
@@ -1,4 +1,4 @@
2 -# Doxyfile 1.5.1
 2+# Doxyfile 1.5.5
33
44 #
55 # Some placeholders have been added for MediaWiki usage:
@@ -7,6 +7,8 @@
88 # {{STRIP_FROM_PATH}}
99 # {{SVNSTAT}}
1010 # {{INPUT}}
 11+#
 12+# A number of MediaWiki-specific aliases are near the end of this file.
1113
1214 #---------------------------------------------------------------------------
1315 # Project related configuration options
@@ -16,7 +18,6 @@
1719 OUTPUT_DIRECTORY = {{OUTPUT_DIRECTORY}}
1820 CREATE_SUBDIRS = NO
1921 OUTPUT_LANGUAGE = English
20 -USE_WINDOWS_ENCODING = NO
2122 BRIEF_MEMBER_DESC = YES
2223 REPEAT_BRIEF = YES
2324 ABBREVIATE_BRIEF = "The $name class" \
@@ -42,11 +43,11 @@
4344 INHERIT_DOCS = YES
4445 SEPARATE_MEMBER_PAGES = NO
4546 TAB_SIZE = 4
46 -ALIASES =
 47+#ALIASES =
4748 OPTIMIZE_OUTPUT_FOR_C = NO
4849 OPTIMIZE_OUTPUT_JAVA = NO
4950 BUILTIN_STL_SUPPORT = NO
50 -DISTRIBUTE_GROUP_DOC = NO
 51+DISTRIBUTE_GROUP_DOC = YES
5152 SUBGROUPING = YES
5253 #---------------------------------------------------------------------------
5354 # Build related configuration options
@@ -268,8 +269,6 @@
269270 DOT_IMAGE_FORMAT = png
270271 DOT_PATH =
271272 DOTFILE_DIRS =
272 -MAX_DOT_GRAPH_WIDTH = 1024
273 -MAX_DOT_GRAPH_HEIGHT = 1024
274273 MAX_DOT_GRAPH_DEPTH = 1000
275274 DOT_TRANSPARENT = NO
276275 DOT_MULTI_TARGETS = NO
@@ -279,3 +278,16 @@
280279 # Configuration::additions related to the search engine
281280 #---------------------------------------------------------------------------
282281 SEARCHENGINE = NO
 282+
 283+ALIASES = "type{1}=<b> \1 </b>:" \
 284+ "2types{2}=<b> \1 </b> or <b> \2 </b>:" \
 285+ "3types{3}=<b> \1 </b>, <b> \2 </b>, or <b> \3 </b>:" \
 286+ "arrayof{2}=<b> Array </b> of \2" \
 287+ "null=\type{Null}" \
 288+ "boolean=\type{Boolean}" \
 289+ "bool=\boolean" \
 290+ "integer=\type{Integer}" \
 291+ "int=\integer" \
 292+ "string=\type{String}" \
 293+ "str=\string" \
 294+ "mixed=\type{Mixed}"
\ No newline at end of file
Index: trunk/phase3/includes/User.php
@@ -1,20 +1,29 @@
22 <?php
33 /**
4 - * See user.txt
 4+ * Implements the User class for the %MediaWiki software.
55 * @file
66 */
77
8 -# Number of characters in user_token field
 8+/**
 9+ * \int Number of characters in user_token field.
 10+ * @ingroup Constants
 11+ */
912 define( 'USER_TOKEN_LENGTH', 32 );
1013
11 -# Serialized record version
 14+/**
 15+ * \int Serialized record version.
 16+ * @ingroup Constants
 17+ */
1218 define( 'MW_USER_VERSION', 6 );
1319
14 -# Some punctuation to prevent editing from broken text-mangling proxies.
 20+/**
 21+ * \string Some punctuation to prevent editing from broken text-mangling proxies.
 22+ * @ingroup Constants
 23+ */
1524 define( 'EDIT_TOKEN_SUFFIX', '+\\' );
1625
1726 /**
18 - * Thrown by User::setPassword() on error
 27+ * Thrown by User::setPassword() on error.
1928 * @ingroup Exception
2029 */
2130 class PasswordError extends MWException {
@@ -34,11 +43,13 @@
3544 class User {
3645
3746 /**
38 - * A list of default user toggles, i.e. boolean user preferences that are
39 - * displayed by Special:Preferences as checkboxes. This list can be
40 - * extended via the UserToggles hook or $wgContLang->getExtraUserToggles().
 47+ * \arrayof{\string} A list of default user toggles, i.e., boolean user
 48+ * preferences that are displayed by Special:Preferences as checkboxes.
 49+ * This list can be extended via the UserToggles hook or by
 50+ * $wgContLang::getExtraUserToggles().
 51+ * @showinitializer
4152 */
42 - static public $mToggles = array(
 53+ public static $mToggles = array(
4354 'highlightbroken',
4455 'justify',
4556 'hideminor',
@@ -80,12 +91,13 @@
8192 );
8293
8394 /**
84 - * List of member variables which are saved to the shared cache (memcached).
85 - * Any operation which changes the corresponding database fields must
86 - * call a cache-clearing function.
 95+ * \arrayof{\string} List of member variables which are saved to the
 96+ * shared cache (memcached). Any operation which changes the
 97+ * corresponding database fields must call a cache-clearing function.
 98+ * @showinitializer
8799 */
88100 static $mCacheVars = array(
89 - # user table
 101+ // user table
90102 'mId',
91103 'mName',
92104 'mRealName',
@@ -101,13 +113,15 @@
102114 'mEmailTokenExpires',
103115 'mRegistration',
104116 'mEditCount',
105 - # user_group table
 117+ // user_group table
106118 'mGroups',
107119 );
108120
109121 /**
110 - * Core rights
111 - * Each of these should have a corresponding message of the form "right-$right"
 122+ * \arrayof{\string} Core rights.
 123+ * Each of these should have a corresponding message of the form
 124+ * "right-$right".
 125+ * @showinitializer
112126 */
113127 static $mCoreRights = array(
114128 'apihighlimits',
@@ -150,47 +164,56 @@
151165 'upload_by_url',
152166 'userrights',
153167 );
 168+ /**
 169+ * \string Cached results of getAllRights()
 170+ */
154171 static $mAllRights = false;
155172
156 - /**
157 - * The cache variable declarations
158 - */
 173+ /** @name Cache variables */
 174+ //@{
159175 var $mId, $mName, $mRealName, $mPassword, $mNewpassword, $mNewpassTime,
160176 $mEmail, $mOptions, $mTouched, $mToken, $mEmailAuthenticated,
161177 $mEmailToken, $mEmailTokenExpires, $mRegistration, $mGroups;
 178+ //@}
162179
163180 /**
164 - * Whether the cache variables have been loaded
 181+ * \bool Whether the cache variables have been loaded.
165182 */
166183 var $mDataLoaded;
167184
168185 /**
169 - * Initialisation data source if mDataLoaded==false. May be one of:
170 - * defaults anonymous user initialised from class defaults
171 - * name initialise from mName
172 - * id initialise from mId
173 - * session log in from cookies or session if possible
 186+ * \string Initialization data source if mDataLoaded==false. May be one of:
 187+ * - 'defaults' anonymous user initialised from class defaults
 188+ * - 'name' initialise from mName
 189+ * - 'id' initialise from mId
 190+ * - 'session' log in from cookies or session if possible
174191 *
175192 * Use the User::newFrom*() family of functions to set this.
176193 */
177194 var $mFrom;
178195
179 - /**
180 - * Lazy-initialised variables, invalidated with clearInstanceCache
181 - */
 196+ /** @name Lazy-initialized variables, invalidated with clearInstanceCache */
 197+ //@{
182198 var $mNewtalk, $mDatePreference, $mBlockedby, $mHash, $mSkin, $mRights,
183199 $mBlockreason, $mBlock, $mEffectiveGroups;
 200+ //@}
184201
185202 /**
186 - * Lightweight constructor for anonymous user
187 - * Use the User::newFrom* factory functions for other kinds of users
 203+ * Lightweight constructor for an anonymous user.
 204+ * Use the User::newFrom* factory functions for other kinds of users.
 205+ *
 206+ * @see newFromName()
 207+ * @see newFromId()
 208+ * @see newFromConfirmationCode()
 209+ * @see newFromSession()
 210+ * @see newFromRow()
188211 */
189212 function User() {
190213 $this->clearInstanceCache( 'defaults' );
191214 }
192215
193216 /**
194 - * Load the user table data for this object from the source given by mFrom
 217+ * Load the user table data for this object from the source given by mFrom.
195218 */
196219 function load() {
197220 if ( $this->mDataLoaded ) {
@@ -227,8 +250,8 @@
228251 }
229252
230253 /**
231 - * Load user table data given mId
232 - * @return false if the ID does not exist, true otherwise
 254+ * Load user table data, given mId has already been set.
 255+ * @return \bool false if the ID does not exist, true otherwise
233256 * @private
234257 */
235258 function loadFromId() {
@@ -283,6 +306,10 @@
284307 global $wgMemc;
285308 $wgMemc->set( $key, $data );
286309 }
 310+
 311+
 312+ /** @name newFrom*() static factory methods */
 313+ //@{
287314
288315 /**
289316 * Static factory method for creation from username.
@@ -290,14 +317,14 @@
291318 * This is slightly less efficient than newFromId(), so use newFromId() if
292319 * you have both an ID and a name handy.
293320 *
294 - * @param $name String: username, validated by Title:newFromText()
295 - * @param $validate Mixed: validate username. Takes the same parameters as
 321+ * @param $name \string Username, validated by Title::newFromText()
 322+ * @param $validate \mixed Validate username. Takes the same parameters as
296323 * User::getCanonicalName(), except that true is accepted as an alias
297324 * for 'valid', for BC.
298325 *
299 - * @return User object, or null if the username is invalid. If the username
300 - * is not present in the database, the result will be a user object with
301 - * a name, zero user ID and default settings.
 326+ * @return \type{User} The User object, or null if the username is invalid. If the
 327+ * username is not present in the database, the result will be a user object
 328+ * with a name, zero user ID and default settings.
302329 */
303330 static function newFromName( $name, $validate = 'valid' ) {
304331 if ( $validate === true ) {
@@ -315,6 +342,12 @@
316343 }
317344 }
318345
 346+ /**
 347+ * Static factory method for creation from a given user ID.
 348+ *
 349+ * @param $id \int Valid user ID
 350+ * @return \type{User} The corresponding User object
 351+ */
319352 static function newFromId( $id ) {
320353 $u = new User;
321354 $u->mId = $id;
@@ -329,8 +362,8 @@
330363 *
331364 * If the code is invalid or has expired, returns NULL.
332365 *
333 - * @param $code string
334 - * @return User
 366+ * @param $code \string Confirmation code
 367+ * @return \type{User}
335368 */
336369 static function newFromConfirmationCode( $code ) {
337370 $dbr = wfGetDB( DB_SLAVE );
@@ -349,7 +382,7 @@
350383 * Create a new user object using data from session or cookies. If the
351384 * login credentials are invalid, the result is an anonymous user.
352385 *
353 - * @return User
 386+ * @return \type{User}
354387 */
355388 static function newFromSession() {
356389 $user = new User;
@@ -360,17 +393,22 @@
361394 /**
362395 * Create a new user object from a user row.
363396 * The row should have all fields from the user table in it.
 397+ * @param $row array A row from the user table
 398+ * @return \type{User}
364399 */
365400 static function newFromRow( $row ) {
366401 $user = new User;
367402 $user->loadFromRow( $row );
368403 return $user;
369404 }
 405+
 406+ //@}
 407+
370408
371409 /**
372 - * Get username given an id.
373 - * @param $id Integer: database user id
374 - * @return string Nickname of a user
 410+ * Get the username corresponding to a given user ID
 411+ * @param $id \int User ID
 412+ * @return \string The corresponding username
375413 */
376414 static function whoIs( $id ) {
377415 $dbr = wfGetDB( DB_SLAVE );
@@ -378,10 +416,10 @@
379417 }
380418
381419 /**
382 - * Get the real name of a user given their identifier
 420+ * Get the real name of a user given their user ID
383421 *
384 - * @param $id Int: database user id
385 - * @return string Real name of a user
 422+ * @param $id \int User ID
 423+ * @return \string The corresponding user's real name
386424 */
387425 static function whoIsReal( $id ) {
388426 $dbr = wfGetDB( DB_SLAVE );
@@ -390,8 +428,8 @@
391429
392430 /**
393431 * Get database id given a user name
394 - * @param $name String: nickname of a user
395 - * @return integer|null Database user id (null: if non existent
 432+ * @param $name \string Username
 433+ * @return \2types{\int,\null} The corresponding user's ID, or null if user is nonexistent
396434 * @static
397435 */
398436 static function idFromName( $name ) {
@@ -423,8 +461,8 @@
424462 * addresses like this, if we allowed accounts like this to be created
425463 * new users could get the old edits of these anonymous users.
426464 *
427 - * @param $name String: nickname of a user
428 - * @return bool
 465+ * @param $name \string
 466+ * @return \bool
429467 */
430468 static function isIP( $name ) {
431469 return preg_match('/^\d{1,3}\.\d{1,3}\.\d{1,3}\.(?:xxx|\d{1,3})$/',$name) || IP::isIPv6($name);
@@ -438,8 +476,8 @@
439477 * is longer than the maximum allowed username size or doesn't begin with
440478 * a capital letter.
441479 *
442 - * @param $name string
443 - * @return bool
 480+ * @param $name \string
 481+ * @return \bool
444482 */
445483 static function isValidUserName( $name ) {
446484 global $wgContLang, $wgMaxNameChars;
@@ -492,8 +530,8 @@
493531 * If an account already exists in this form, login will be blocked
494532 * by a failure to pass this function.
495533 *
496 - * @param $name string
497 - * @return bool
 534+ * @param $name \string
 535+ * @return \bool
498536 */
499537 static function isUsableName( $name ) {
500538 global $wgReservedUsernames;
@@ -524,8 +562,8 @@
525563 * rather than in isValidUserName() to avoid disrupting
526564 * existing accounts.
527565 *
528 - * @param $name string
529 - * @return bool
 566+ * @param $name \string
 567+ * @return \bool
530568 */
531569 static function isCreatableName( $name ) {
532570 return
@@ -538,8 +576,8 @@
539577 /**
540578 * Is the input a valid password for this user?
541579 *
542 - * @param $password String: desired password
543 - * @return bool
 580+ * @param $password \string Desired password
 581+ * @return \bool
544582 */
545583 function isValidPassword( $password ) {
546584 global $wgMinimalPasswordLength, $wgContLang;
@@ -556,7 +594,7 @@
557595 }
558596
559597 /**
560 - * Does a string look like an email address?
 598+ * Does a string look like an e-mail address?
561599 *
562600 * There used to be a regular expression here, it got removed because it
563601 * rejected valid addresses. Actually just check if there is '@' somewhere
@@ -564,8 +602,8 @@
565603 *
566604 * @todo Check for RFC 2822 compilance (bug 959)
567605 *
568 - * @param $addr String: email address
569 - * @return bool
 606+ * @param $addr \string E-mail address
 607+ * @return \bool
570608 */
571609 public static function isValidEmailAddr( $addr ) {
572610 $result = null;
@@ -579,12 +617,12 @@
580618 /**
581619 * Given unvalidated user input, return a canonical username, or false if
582620 * the username is invalid.
583 - * @param $name string
584 - * @param $validate Mixed: type of validation to use:
585 - * false No validation
586 - * 'valid' Valid for batch processes
587 - * 'usable' Valid for batch processes and login
588 - * 'creatable' Valid for batch processes, login and account creation
 621+ * @param $name \string User input
 622+ * @param $validate \2types{\string,\bool} Type of validation to use:
 623+ * - false No validation
 624+ * - 'valid' Valid for batch processes
 625+ * - 'usable' Valid for batch processes and login
 626+ * - 'creatable' Valid for batch processes, login and account creation
589627 */
590628 static function getCanonicalName( $name, $validate = 'valid' ) {
591629 # Force usernames to capital
@@ -634,11 +672,10 @@
635673
636674 /**
637675 * Count the number of edits of a user
 676+ * @todo It should not be static and some day should be merged as proper member function / deprecated -- domas
638677 *
639 - * It should not be static and some day should be merged as proper member function / deprecated -- domas
640 - *
641 - * @param $uid Int: the user ID to check
642 - * @return int
 678+ * @param $uid \int User ID to check
 679+ * @return \int The user's edit count
643680 */
644681 static function edits( $uid ) {
645682 wfProfileIn( __METHOD__ );
@@ -674,7 +711,7 @@
675712 * Return a random password. Sourced from mt_rand, so it's not particularly secure.
676713 * @todo hash random numbers to improve security, like generateToken()
677714 *
678 - * @return string
 715+ * @return \string
679716 */
680717 static function randomPassword() {
681718 global $wgMinimalPasswordLength;
@@ -691,9 +728,10 @@
692729 }
693730
694731 /**
695 - * Set cached properties to default. Note: this no longer clears
696 - * uncached lazy-initialised properties. The constructor does that instead.
 732+ * Set cached properties to default.
697733 *
 734+ * @note This no longer clears uncached lazy-initialised properties;
 735+ * the constructor does that instead.
698736 * @private
699737 */
700738 function loadDefaults( $name = false ) {
@@ -728,8 +766,7 @@
729767 }
730768
731769 /**
732 - * Initialise php session
733 - * @deprecated use wfSetupSession()
 770+ * @deprecated Use wfSetupSession().
734771 */
735772 function SetupSession() {
736773 wfDeprecated( __METHOD__ );
@@ -738,8 +775,8 @@
739776
740777 /**
741778 * Load user data from the session or login cookie. If there are no valid
742 - * credentials, initialises the user as an anon.
743 - * @return true if the user is logged in, false otherwise
 779+ * credentials, initialises the user as an anonymous user.
 780+ * @return \bool True if the user is logged in, false otherwise.
744781 */
745782 private function loadFromSession() {
746783 global $wgMemc, $wgCookiePrefix;
@@ -806,10 +843,10 @@
807844 }
808845
809846 /**
810 - * Load user and user_group data from the database
811 - * $this->mId must be set, this is how the user is identified.
 847+ * Load user and user_group data from the database.
 848+ * $this::mId must be set, this is how the user is identified.
812849 *
813 - * @return true if the user exists, false if the user is anonymous
 850+ * @return \bool True if the user exists, false if the user is anonymous
814851 * @private
815852 */
816853 function loadFromDatabase() {
@@ -840,7 +877,9 @@
841878 }
842879
843880 /**
844 - * Initialise the user object from a row from the user table
 881+ * Initialize this object from a row from the user table.
 882+ *
 883+ * @param $row \arrayof{\mixed} Row from the user table to load.
845884 */
846885 function loadFromRow( $row ) {
847886 $this->mDataLoaded = true;
@@ -865,7 +904,7 @@
866905 }
867906
868907 /**
869 - * Load the groups from the database if they aren't already loaded
 908+ * Load the groups from the database if they aren't already loaded.
870909 * @private
871910 */
872911 function loadGroups() {
@@ -884,8 +923,8 @@
885924
886925 /**
887926 * Clear various cached data stored in this object.
888 - * @param $reloadFrom String: reload user and user_groups table data from a
889 - * given source. May be "name", "id", "defaults", "session" or false for
 927+ * @param $reloadFrom \string Reload user and user_groups table data from a
 928+ * given source. May be "name", "id", "defaults", "session", or false for
890929 * no reload.
891930 */
892931 function clearInstanceCache( $reloadFrom = false ) {
@@ -906,9 +945,8 @@
907946 /**
908947 * Combine the language default options with any site-specific options
909948 * and add the default language variants.
910 - * Not really private cause it's called by Language class
911 - * @return array
912 - * @private
 949+ *
 950+ * @return \arrayof{\string} Array of options
913951 */
914952 static function getDefaultOptions() {
915953 global $wgNamespacesToBeSearchedDefault;
@@ -934,8 +972,8 @@
935973 /**
936974 * Get a given default option value.
937975 *
938 - * @param $opt string
939 - * @return string
 976+ * @param $opt \string Name of option to retrieve
 977+ * @return \string
940978 */
941979 public static function getDefaultOption( $opt ) {
942980 $defOpts = self::getDefaultOptions();
@@ -948,7 +986,7 @@
949987
950988 /**
951989 * Get a list of user toggle names
952 - * @return array
 990+ * @return \arrayof{\string}
953991 */
954992 static function getToggles() {
955993 global $wgContLang;
@@ -961,7 +999,7 @@
9621000 /**
9631001 * Get blocking information
9641002 * @private
965 - * @param $bFromSlave Bool: specify whether to check slave or master. To
 1003+ * @param $bFromSlave \bool Whether to check the slave database first. To
9661004 * improve performance, non-critical checks are done
9671005 * against slaves. Check when actually saving should be
9681006 * done against master.
@@ -1032,6 +1070,12 @@
10331071 wfProfileOut( __METHOD__ );
10341072 }
10351073
 1074+ /**
 1075+ * Whether the given IP is in the SORBS blacklist.
 1076+ *
 1077+ * @param $ip \string IP to check
 1078+ * @return \bool
 1079+ */
10361080 function inSorbsBlacklist( $ip ) {
10371081 global $wgEnableSorbs, $wgSorbsUrl;
10381082
@@ -1039,6 +1083,13 @@
10401084 $this->inDnsBlacklist( $ip, $wgSorbsUrl );
10411085 }
10421086
 1087+ /**
 1088+ * Whether the given IP is in a given DNS blacklist.
 1089+ *
 1090+ * @param $ip \string IP to check
 1091+ * @param $base \string URL of the DNS blacklist
 1092+ * @return \bool
 1093+ */
10431094 function inDnsBlacklist( $ip, $base ) {
10441095 wfProfileIn( __METHOD__ );
10451096
@@ -1071,7 +1122,7 @@
10721123 /**
10731124 * Is this user subject to rate limiting?
10741125 *
1075 - * @return bool
 1126+ * @return \bool
10761127 */
10771128 public function isPingLimitable() {
10781129 global $wgRateLimitsExcludedGroups;
@@ -1086,10 +1137,11 @@
10871138 * Primitive rate limits: enforce maximum actions per time period
10881139 * to put a brake on flooding.
10891140 *
1090 - * Note: when using a shared cache like memcached, IP-address
 1141+ * @note When using a shared cache like memcached, IP-address
10911142 * last-hit counters will be shared across wikis.
10921143 *
1093 - * @return bool true if a rate limiter was tripped
 1144+ * @param $action \string Action to enforce; 'edit' if unspecified
 1145+ * @return \bool True if a rate limiter was tripped
10941146 */
10951147 function pingLimiter( $action='edit' ) {
10961148
@@ -1180,7 +1232,9 @@
11811233
11821234 /**
11831235 * Check if user is blocked
1184 - * @return bool True if blocked, false otherwise
 1236+ *
 1237+ * @param $bFromSlave \bool Whether to check the slave database instead of the master
 1238+ * @return \bool True if blocked, false otherwise
11851239 */
11861240 function isBlocked( $bFromSlave = true ) { // hacked from false due to horrible probs on site
11871241 wfDebug( "User::isBlocked: enter\n" );
@@ -1190,6 +1244,10 @@
11911245
11921246 /**
11931247 * Check if user is blocked from editing a particular article
 1248+ *
 1249+ * @param $title \string Title to check
 1250+ * @param $bFromSlave \bool Whether to check the slave database instead of the master
 1251+ * @return \bool True if blocked, false otherwise
11941252 */
11951253 function isBlockedFrom( $title, $bFromSlave = false ) {
11961254 global $wgBlockAllowsUTEdit;
@@ -1209,8 +1267,8 @@
12101268 }
12111269
12121270 /**
1213 - * Get name of blocker
1214 - * @return string name of blocker
 1271+ * If user is blocked, return the name of the user who placed the block
 1272+ * @return \string name of blocker
12151273 */
12161274 function blockedBy() {
12171275 $this->getBlockedStatus();
@@ -1218,8 +1276,8 @@
12191277 }
12201278
12211279 /**
1222 - * Get blocking reason
1223 - * @return string Blocking reason
 1280+ * If user is blocked, return the specified reason for the block
 1281+ * @return \string Blocking reason
12241282 */
12251283 function blockedFor() {
12261284 $this->getBlockedStatus();
@@ -1227,7 +1285,8 @@
12281286 }
12291287
12301288 /**
1231 - * Get the user ID. Returns 0 if the user is anonymous or nonexistent.
 1289+ * Get the user's ID.
 1290+ * @return \int The user's ID; 0 if the user is anonymous or nonexistent
12321291 */
12331292 function getId() {
12341293 if( $this->mId === null and $this->mName !== null
@@ -1242,7 +1301,8 @@
12431302 }
12441303
12451304 /**
1246 - * Set the user and reload all fields according to that ID
 1305+ * Set the user and reload all fields according to a given ID
 1306+ * @param $v \int User ID to reload
12471307 */
12481308 function setId( $v ) {
12491309 $this->mId = $v;
@@ -1250,7 +1310,8 @@
12511311 }
12521312
12531313 /**
1254 - * Get the user name, or the IP for anons
 1314+ * Get the user name, or the IP of an anonymous user
 1315+ * @return \string
12551316 */
12561317 function getName() {
12571318 if ( !$this->mDataLoaded && $this->mFrom == 'name' ) {
@@ -1275,8 +1336,9 @@
12761337 * address for an anonymous user to something other than the current
12771338 * remote IP.
12781339 *
1279 - * User::newFromName() has rougly the same function, when the named user
 1340+ * @note User::newFromName() has rougly the same function, when the named user
12801341 * does not exist.
 1342+ * @param $str \string New user name to set
12811343 */
12821344 function setName( $str ) {
12831345 $this->load();
@@ -1284,13 +1346,17 @@
12851347 }
12861348
12871349 /**
1288 - * Return the title dbkey form of the name, for eg user pages.
1289 - * @return string
 1350+ * Get the user's name escaped by underscores.
 1351+ * @return \string
12901352 */
12911353 function getTitleKey() {
12921354 return str_replace( ' ', '_', $this->getName() );
12931355 }
12941356
 1357+ /**
 1358+ * Check if the user has new messages.
 1359+ * @return \bool True if the user has new messages
 1360+ */
12951361 function getNewtalk() {
12961362 $this->load();
12971363
@@ -1322,6 +1388,7 @@
13231389
13241390 /**
13251391 * Return the talk page(s) this user has new messages on.
 1392+ * @return \arrayof{\string} Array of page URLs
13261393 */
13271394 function getNewMessageLinks() {
13281395 $talks = array();
@@ -1337,13 +1404,13 @@
13381405
13391406
13401407 /**
1341 - * Perform a user_newtalk check, uncached.
1342 - * Use getNewtalk for a cached check.
 1408+ * Internal uncached check for new messages
13431409 *
1344 - * @param $field string
1345 - * @param $id mixed
1346 - * @param $fromMaster Bool: true to fetch from the master, false for a slave
1347 - * @return bool
 1410+ * @see getNewtalk()
 1411+ * @param $field \string 'user_ip' for anonymous users, 'user_id' otherwise
 1412+ * @param $id \2types{\string,\int} User's IP address for anonymous users, User ID otherwise
 1413+ * @param $fromMaster \bool true to fetch from the master, false for a slave
 1414+ * @return \bool True if the user has new messages
13481415 * @private
13491416 */
13501417 function checkNewtalk( $field, $id, $fromMaster = false ) {
@@ -1358,9 +1425,10 @@
13591426 }
13601427
13611428 /**
1362 - * Add or update the
1363 - * @param $field string
1364 - * @param $id mixed
 1429+ * Add or update the new messages flag
 1430+ * @param $field \string 'user_ip' for anonymous users, 'user_id' otherwise
 1431+ * @param $id \2types{\string,\int} User's IP address for anonymous users, User ID otherwise
 1432+ * @return \bool True if successful, false otherwise
13651433 * @private
13661434 */
13671435 function updateNewtalk( $field, $id ) {
@@ -1380,8 +1448,9 @@
13811449
13821450 /**
13831451 * Clear the new messages flag for the given user
1384 - * @param $field string
1385 - * @param $id mixed
 1452+ * @param $field \string 'user_ip' for anonymous users, 'user_id' otherwise
 1453+ * @param $id \2types{\string,\int} User's IP address for anonymous users, User ID otherwise
 1454+ * @return \bool True if successful, false otherwise
13861455 * @private
13871456 */
13881457 function deleteNewtalk( $field, $id ) {
@@ -1400,7 +1469,7 @@
14011470
14021471 /**
14031472 * Update the 'You have new messages!' status.
1404 - * @param $val bool
 1473+ * @param $val \bool Whether the user has new messages
14051474 */
14061475 function setNewtalk( $val ) {
14071476 if( wfReadOnly() ) {
@@ -1439,6 +1508,7 @@
14401509 /**
14411510 * Generate a current or new-future timestamp to be stored in the
14421511 * user_touched field when we update things.
 1512+ * @return \string Timestamp in TS_MW format
14431513 */
14441514 private static function newTouchedTimestamp() {
14451515 global $wgClockSkewFudge;
@@ -1479,13 +1549,17 @@
14801550 }
14811551 }
14821552
 1553+ /**
 1554+ * Validate the cache for this account.
 1555+ * @param $timestamp \string A timestamp in TS_MW format
 1556+ */
14831557 function validateCache( $timestamp ) {
14841558 $this->load();
14851559 return ($timestamp >= $this->mTouched);
14861560 }
14871561
14881562 /**
1489 - * Set the password and reset the random token
 1563+ * Set the password and reset the random token.
14901564 * Calls through to authentication plugin if necessary;
14911565 * will have no effect if the auth plugin refuses to
14921566 * pass the change through or if the legal password
@@ -1495,7 +1569,7 @@
14961570 * wipes it, so the account cannot be logged in until
14971571 * a new password is set, for instance via e-mail.
14981572 *
1499 - * @param $str string
 1573+ * @param $str \string New password to set
15001574 * @throws PasswordError on failure
15011575 */
15021576 function setPassword( $str ) {
@@ -1523,10 +1597,9 @@
15241598 }
15251599
15261600 /**
1527 - * Set the password and reset the random token no matter
1528 - * what.
 1601+ * Set the password and reset the random token unconditionally.
15291602 *
1530 - * @param $str string
 1603+ * @param $str \string New password to set
15311604 */
15321605 function setInternalPassword( $str ) {
15331606 $this->load();
@@ -1542,6 +1615,10 @@
15431616 $this->mNewpassTime = null;
15441617 }
15451618
 1619+ /**
 1620+ * Get the user's current token.
 1621+ * @return \string
 1622+ */
15461623 function getToken() {
15471624 $this->load();
15481625 return $this->mToken;
@@ -1550,6 +1627,8 @@
15511628 /**
15521629 * Set the random token (used for persistent authentication)
15531630 * Called from loadDefaults() among other places.
 1631+ *
 1632+ * @param $token \string If specified, set the token to this value
15541633 * @private
15551634 */
15561635 function setToken( $token = false ) {
@@ -1568,7 +1647,13 @@
15691648 $this->mToken = $token;
15701649 }
15711650 }
1572 -
 1651+
 1652+ /**
 1653+ * Set the cookie password
 1654+ *
 1655+ * @param $str \string New cookie password
 1656+ * @private
 1657+ */
15731658 function setCookiePassword( $str ) {
15741659 $this->load();
15751660 $this->mCookiePassword = md5( $str );
@@ -1576,7 +1661,9 @@
15771662
15781663 /**
15791664 * Set the password for a password reminder or new account email
1580 - * Sets the user_newpass_time field if $throttle is true
 1665+ *
 1666+ * @param $str \string New password to set
 1667+ * @param $throttle \bool If true, reset the throttle timestamp to the present
15811668 */
15821669 function setNewpassword( $str, $throttle = true ) {
15831670 $this->load();
@@ -1587,8 +1674,9 @@
15881675 }
15891676
15901677 /**
1591 - * Returns true if a password reminder email has already been sent within
1592 - * the last $wgPasswordReminderResendTime hours
 1678+ * Has password reminder email been sent within the last
 1679+ * $wgPasswordReminderResendTime hours?
 1680+ * @return \bool
15931681 */
15941682 function isPasswordReminderThrottled() {
15951683 global $wgPasswordReminderResendTime;
@@ -1600,38 +1688,62 @@
16011689 return time() < $expiry;
16021690 }
16031691
 1692+ /**
 1693+ * Get the user's e-mail address
 1694+ * @return \string
 1695+ */
16041696 function getEmail() {
16051697 $this->load();
16061698 wfRunHooks( 'UserGetEmail', array( $this, &$this->mEmail ) );
16071699 return $this->mEmail;
16081700 }
16091701
 1702+ /**
 1703+ * Get the timestamp of the user's e-mail authentication
 1704+ * @return \string TS_MW timestamp
 1705+ */
16101706 function getEmailAuthenticationTimestamp() {
16111707 $this->load();
16121708 wfRunHooks( 'UserGetEmailAuthenticationTimestamp', array( $this, &$this->mEmailAuthenticated ) );
16131709 return $this->mEmailAuthenticated;
16141710 }
16151711
 1712+ /**
 1713+ * Set the user's e-mail address
 1714+ * @param $str \string New e-mail address
 1715+ */
16161716 function setEmail( $str ) {
16171717 $this->load();
16181718 $this->mEmail = $str;
16191719 wfRunHooks( 'UserSetEmail', array( $this, &$this->mEmail ) );
16201720 }
16211721
 1722+ /**
 1723+ * Get the user's real name
 1724+ * @return \string
 1725+ */
16221726 function getRealName() {
16231727 $this->load();
16241728 return $this->mRealName;
16251729 }
16261730
 1731+ /**
 1732+ * Set the user's real name
 1733+ * @param $str \string New real name
 1734+ */
16271735 function setRealName( $str ) {
16281736 $this->load();
16291737 $this->mRealName = $str;
16301738 }
16311739
16321740 /**
1633 - * @param $oname String: the option to check
1634 - * @param $defaultOverride String: A default value returned if the option does not exist
1635 - * @return string
 1741+ * Get the user's current setting for a given option.
 1742+ *
 1743+ * @param $oname \string The option to check
 1744+ * @param $defaultOverride \string A default value returned if the option does not exist
 1745+ * @return \string User's current value for the option
 1746+ * @see getBoolOption()
 1747+ * @see getIntOption()
16361748 */
16371749 function getOption( $oname, $defaultOverride = '' ) {
16381750 $this->load();
@@ -1649,46 +1761,41 @@
16501762 return $defaultOverride;
16511763 }
16521764 }
1653 -
 1765+
16541766 /**
1655 - * Get the user's date preference, including some important migration for
1656 - * old user rows.
 1767+ * Get the user's current setting for a given option, as a boolean value.
 1768+ *
 1769+ * @param $oname \string The option to check
 1770+ * @return \bool User's current value for the option
 1771+ * @see getOption()
16571772 */
1658 - function getDatePreference() {
1659 - if ( is_null( $this->mDatePreference ) ) {
1660 - global $wgLang;
1661 - $value = $this->getOption( 'date' );
1662 - $map = $wgLang->getDatePreferenceMigrationMap();
1663 - if ( isset( $map[$value] ) ) {
1664 - $value = $map[$value];
1665 - }
1666 - $this->mDatePreference = $value;
1667 - }
1668 - return $this->mDatePreference;
1669 - }
1670 -
1671 - /**
1672 - * @param $oname String: the option to check
1673 - * @return bool False if the option is not selected, true if it is
1674 - */
16751773 function getBoolOption( $oname ) {
16761774 return (bool)$this->getOption( $oname );
16771775 }
16781776
 1777+
16791778 /**
1680 - * Get an option as an integer value from the source string.
1681 - * @param $oname String: the option to check
1682 - * @param $default Int: optional value to return if option is unset/blank.
1683 - * @return int
 1779+ * Get the user's current setting for a given option, as a boolean value.
 1780+ *
 1781+ * @param $oname \string The option to check
 1782+ * @param $defaultOverride \int A default value returned if the option does not exist
 1783+ * @return \int User's current value for the option
 1784+ * @see getOption()
16841785 */
1685 - function getIntOption( $oname, $default=0 ) {
 1786+ function getIntOption( $oname, $defaultOverride=0 ) {
16861787 $val = $this->getOption( $oname );
16871788 if( $val == '' ) {
1688 - $val = $default;
 1789+ $val = $defaultOverride;
16891790 }
16901791 return intval( $val );
16911792 }
16921793
 1794+ /**
 1795+ * Set the given option for a user.
 1796+ *
 1797+ * @param $oname \string The option to set
 1798+ * @param $val \mixed New value to set
 1799+ */
16931800 function setOption( $oname, $val ) {
16941801 $this->load();
16951802 if ( is_null( $this->mOptions ) ) {
@@ -1713,6 +1820,28 @@
17141821 $this->mOptions[$oname] = $val;
17151822 }
17161823
 1824+ /**
 1825+ * Get the user's preferred date format.
 1826+ * @return \string
 1827+ */
 1828+ function getDatePreference() {
 1829+ // Important migration for old data rows
 1830+ if ( is_null( $this->mDatePreference ) ) {
 1831+ global $wgLang;
 1832+ $value = $this->getOption( 'date' );
 1833+ $map = $wgLang->getDatePreferenceMigrationMap();
 1834+ if ( isset( $map[$value] ) ) {
 1835+ $value = $map[$value];
 1836+ }
 1837+ $this->mDatePreference = $value;
 1838+ }
 1839+ return $this->mDatePreference;
 1840+ }
 1841+
 1842+ /**
 1843+ * Get the permissions this user has.
 1844+ * @return \arrayof{\string}
 1845+ */
17171846 function getRights() {
17181847 if ( is_null( $this->mRights ) ) {
17191848 $this->mRights = self::getGroupPermissions( $this->getEffectiveGroups() );
@@ -1726,7 +1855,7 @@
17271856 /**
17281857 * Get the list of explicit group memberships this user has.
17291858 * The implicit * and user groups are not included.
1730 - * @return array of strings
 1859+ * @return \arrayof{\string}
17311860 */
17321861 function getGroups() {
17331862 $this->load();
@@ -1737,8 +1866,8 @@
17381867 * Get the list of implicit group memberships this user has.
17391868 * This includes all explicit groups, plus 'user' if logged in,
17401869 * '*' for all accounts and autopromoted groups
1741 - * @param $recache Boolean: don't use the cache
1742 - * @return array of strings
 1870+ * @param $recache \bool Whether to avoid the cache
 1871+ * @return \arrayof{\string}
17431872 */
17441873 function getEffectiveGroups( $recache = false ) {
17451874 if ( $recache || is_null( $this->mEffectiveGroups ) ) {
@@ -1759,7 +1888,10 @@
17601889 return $this->mEffectiveGroups;
17611890 }
17621891
1763 - /* Return the edit count for the user. This is where User::edits should have been */
 1892+ /**
 1893+ * Get the user's edit count.
 1894+ * @return \int
 1895+ */
17641896 function getEditCount() {
17651897 if ($this->mId) {
17661898 if ( !isset( $this->mEditCount ) ) {
@@ -1776,7 +1908,7 @@
17771909 /**
17781910 * Add the user to the given group.
17791911 * This takes immediate effect.
1780 - * @param $group string
 1912+ * @param $group \string Name of the group to add
17811913 */
17821914 function addGroup( $group ) {
17831915 $dbw = wfGetDB( DB_MASTER );
@@ -1800,7 +1932,7 @@
18011933 /**
18021934 * Remove the user from the given group.
18031935 * This takes immediate effect.
1804 - * @param $group string
 1936+ * @param $group \string Name of the group to remove
18051937 */
18061938 function removeGroup( $group ) {
18071939 $this->load();
@@ -1821,27 +1953,24 @@
18221954
18231955
18241956 /**
1825 - * A more legible check for non-anonymousness.
1826 - * Returns true if the user is not an anonymous visitor.
1827 - *
1828 - * @return bool
 1957+ * Get whether the user is logged in
 1958+ * @return \bool
18291959 */
18301960 function isLoggedIn() {
18311961 return $this->getID() != 0;
18321962 }
18331963
18341964 /**
1835 - * A more legible check for anonymousness.
1836 - * Returns true if the user is an anonymous visitor.
1837 - *
1838 - * @return bool
 1965+ * Get whether the user is anonymous
 1966+ * @return \bool
18391967 */
18401968 function isAnon() {
18411969 return !$this->isLoggedIn();
18421970 }
18431971
18441972 /**
1845 - * Whether the user is a bot
 1973+ * Get whether the user is a bot
 1974+ * @return \bool
18461975 * @deprecated
18471976 */
18481977 function isBot() {
@@ -1851,8 +1980,8 @@
18521981
18531982 /**
18541983 * Check if user is allowed to access a feature / make an action
1855 - * @param $action String: action to be checked
1856 - * @return boolean True: action is allowed, False: action should not be allowed
 1984+ * @param $action \string action to be checked
 1985+ * @return \bool True if action is allowed, else false
18571986 */
18581987 function isAllowed($action='') {
18591988 if ( $action === '' )
@@ -1864,7 +1993,7 @@
18651994
18661995 /**
18671996 * Check whether to enable recent changes patrol features for this user
1868 - * @return bool
 1997+ * @return \bool
18691998 */
18701999 public function useRCPatrol() {
18712000 global $wgUseRCPatrol;
@@ -1872,8 +2001,8 @@
18732002 }
18742003
18752004 /**
1876 - * Check whether to enable recent changes patrol features for this user
1877 - * @return bool
 2005+ * Check whether to enable new pages patrol features for this user
 2006+ * @return \bool
18782007 */
18792008 public function useNPPatrol() {
18802009 global $wgUseRCPatrol, $wgUseNPPatrol;
@@ -1881,7 +2010,8 @@
18822011 }
18832012
18842013 /**
1885 - * Load a skin if it doesn't exist or return it
 2014+ * Get the current skin, loading it if required
 2015+ * @return \type{Skin}
18862016 * @todo FIXME : need to check the old failback system [AV]
18872017 */
18882018 function &getSkin() {
@@ -1899,13 +2029,10 @@
19002030 return $this->mSkin;
19012031 }
19022032
1903 - /**#@+
1904 - * @param $title Title: article title to look at
1905 - */
1906 -
19072033 /**
1908 - * Check watched status of an article
1909 - * @return bool True if article is watched
 2034+ * Check the watched status of an article.
 2035+ * @param $title \type{Title} Title of the article to look at
 2036+ * @return \bool True if article is watched
19102037 */
19112038 function isWatched( $title ) {
19122039 $wl = WatchedItem::fromUserTitle( $this, $title );
@@ -1913,7 +2040,8 @@
19142041 }
19152042
19162043 /**
1917 - * Watch an article
 2044+ * Watch an article.
 2045+ * @param $title \type{Title} Title of the article to look at
19182046 */
19192047 function addWatch( $title ) {
19202048 $wl = WatchedItem::fromUserTitle( $this, $title );
@@ -1922,7 +2050,8 @@
19232051 }
19242052
19252053 /**
1926 - * Stop watching an article
 2054+ * Stop watching an article.
 2055+ * @param $title \type{Title} Title of the article to look at
19272056 */
19282057 function removeWatch( $title ) {
19292058 $wl = WatchedItem::fromUserTitle( $this, $title );
@@ -1934,6 +2063,7 @@
19352064 * Clear the user's notification timestamp for the given title.
19362065 * If e-notif e-mails are on, they will receive notification mails on
19372066 * the next change of the page if it's watched etc.
 2067+ * @param $title \type{Title} Title of the article to look at
19382068 */
19392069 function clearNotification( &$title ) {
19402070 global $wgUser, $wgUseEnotif, $wgShowUpdatedMarker;
@@ -1989,14 +2119,12 @@
19902120 }
19912121 }
19922122
1993 - /**#@-*/
1994 -
19952123 /**
19962124 * Resets all of the given user's page-change notification timestamps.
19972125 * If e-notif e-mails are on, they will receive notification mails on
19982126 * the next change of any watched page.
19992127 *
2000 - * @param $currentUser Int: user ID number
 2128+ * @param $currentUser \int User ID
20012129 */
20022130 function clearAllNotifications( $currentUser ) {
20032131 global $wgUseEnotif, $wgShowUpdatedMarker;
@@ -2019,8 +2147,9 @@
20202148 }
20212149
20222150 /**
 2151+ * Encode this user's options as a string
 2152+ * @return \string Encoded options
20232153 * @private
2024 - * @return string Encoding options
20252154 */
20262155 function encodeOptions() {
20272156 $this->load();
@@ -2036,6 +2165,8 @@
20372166 }
20382167
20392168 /**
 2169+ * Set this user's options from an encoded string
 2170+ * @param $str \string Encoded options to import
20402171 * @private
20412172 */
20422173 function decodeOptions( $str ) {
@@ -2049,6 +2180,13 @@
20502181 }
20512182 }
20522183
 2184+ /**
 2185+ * Set a cookie on the user's client
 2186+ * @param $name \string Name of the cookie to set
 2187+ * @param $name \string Value to set
 2188+ * @param $name \int Expiration time, as a UNIX time value;
 2189+ * if 0 or not specified, use the default $wgCookieExpiration
 2190+ */
20532191 protected function setCookie( $name, $value, $exp=0 ) {
20542192 global $wgCookiePrefix,$wgCookieDomain,$wgCookieSecure,$wgCookieExpiration, $wgCookieHttpOnly;
20552193 if( $exp == 0 ) {
@@ -2085,10 +2223,17 @@
20862224 }
20872225 }
20882226
 2227+ /**
 2228+ * Clear a cookie on the user's client
 2229+ * @param $name \string Name of the cookie to clear
 2230+ */
20892231 protected function clearCookie( $name ) {
20902232 $this->setCookie( $name, '', time() - 86400 );
20912233 }
20922234
 2235+ /**
 2236+ * Set the default cookies for this session on the user's client.
 2237+ */
20932238 function setCookies() {
20942239 $this->load();
20952240 if ( 0 == $this->mId ) return;
@@ -2119,7 +2264,7 @@
21202265 }
21212266
21222267 /**
2123 - * Logout user.
 2268+ * Log this user out.
21242269 */
21252270 function logout() {
21262271 global $wgUser;
@@ -2129,8 +2274,9 @@
21302275 }
21312276
21322277 /**
2133 - * Really logout user
2134 - * Clears the cookies and session, resets the instance cache
 2278+ * Clear the user's cookies and session, and reset the instance cache.
 2279+ * @private
 2280+ * @see logout()
21352281 */
21362282 function doLogout() {
21372283 $this->clearInstanceCache( 'defaults' );
@@ -2145,7 +2291,7 @@
21462292 }
21472293
21482294 /**
2149 - * Save object settings into database
 2295+ * Save this user's settings into the database.
21502296 * @todo Only rarely do all these fields need to be set!
21512297 */
21522298 function saveSettings() {
@@ -2179,7 +2325,7 @@
21802326 }
21812327
21822328 /**
2183 - * Checks if a user with the given name exists, returns the ID.
 2329+ * If only this user's username is known, and it exists, return the user ID.
21842330 */
21852331 function idForName() {
21862332 $s = trim( $this->getName() );
@@ -2196,18 +2342,18 @@
21972343 /**
21982344 * Add a user to the database, return the user object
21992345 *
2200 - * @param $name String: the user's name
2201 - * @param $params Associative array of non-default parameters to save to the database:
2202 - * password The user's password. Password logins will be disabled if this is omitted.
2203 - * newpassword A temporary password mailed to the user
2204 - * email The user's email address
2205 - * email_authenticated The email authentication timestamp
2206 - * real_name The user's real name
2207 - * options An associative array of non-default options
2208 - * token Random authentication token. Do not set.
2209 - * registration Registration timestamp. Do not set.
 2346+ * @param $name \string Username to add
 2347+ * @param $params \arrayof{\string} Non-default parameters to save to the database:
 2348+ * - password The user's password. Password logins will be disabled if this is omitted.
 2349+ * - newpassword A temporary password mailed to the user
 2350+ * - email The user's email address
 2351+ * - email_authenticated The email authentication timestamp
 2352+ * - real_name The user's real name
 2353+ * - options An associative array of non-default options
 2354+ * - token Random authentication token. Do not set.
 2355+ * - registration Registration timestamp. Do not set.
22102356 *
2211 - * @return User object, or null if the username already exists
 2357+ * @return \type{User} A new User object, or null if the username already exists
22122358 */
22132359 static function createNew( $name, $params = array() ) {
22142360 $user = new User;
@@ -2245,7 +2391,7 @@
22462392 }
22472393
22482394 /**
2249 - * Add an existing user object to the database
 2395+ * Add this existing user object to the database
22502396 */
22512397 function addToDatabase() {
22522398 $this->load();
@@ -2269,13 +2415,13 @@
22702416 );
22712417 $this->mId = $dbw->insertId();
22722418
2273 - # Clear instance cache other than user table data, which is already accurate
 2419+ // Clear instance cache other than user table data, which is already accurate
22742420 $this->clearInstanceCache();
22752421 }
22762422
22772423 /**
2278 - * If the (non-anonymous) user is blocked, this function will block any IP address
2279 - * that they successfully log on from.
 2424+ * If this (non-anonymous) user is blocked, block any IP address
 2425+ * they've successfully logged in from.
22802426 */
22812427 function spreadBlock() {
22822428 wfDebug( __METHOD__."()\n" );
@@ -2304,7 +2450,7 @@
23052451 * which will give them a chance to modify this key based on their own
23062452 * settings.
23072453 *
2308 - * @return string
 2454+ * @return \string
23092455 */
23102456 function getPageRenderingHash() {
23112457 global $wgContLang, $wgUseDynamicDates, $wgLang;
@@ -2337,21 +2483,28 @@
23382484 return $confstr;
23392485 }
23402486
 2487+ /**
 2488+ * Get whether the user is explicitly blocked from account creation.
 2489+ * @return \bool
 2490+ */
23412491 function isBlockedFromCreateAccount() {
23422492 $this->getBlockedStatus();
23432493 return $this->mBlock && $this->mBlock->mCreateAccount;
23442494 }
23452495
23462496 /**
2347 - * Determine if the user is blocked from using Special:Emailuser.
2348 - *
2349 - * @return boolean
 2497+ * Get whether the user is blocked from using Special:Emailuser.
 2498+ * @return \bool
23502499 */
23512500 function isBlockedFromEmailuser() {
23522501 $this->getBlockedStatus();
23532502 return $this->mBlock && $this->mBlock->mBlockEmail;
23542503 }
23552504
 2505+ /**
 2506+ * Get whether the user is allowed to create an account.
 2507+ * @return \bool
 2508+ */
23562509 function isAllowedToCreateAccount() {
23572510 return $this->isAllowed( 'createaccount' ) && !$this->isBlockedFromCreateAccount();
23582511 }
@@ -2366,7 +2519,7 @@
23672520 /**
23682521 * Get this user's personal page title.
23692522 *
2370 - * @return Title
 2523+ * @return \type{Title}
23712524 */
23722525 function getUserPage() {
23732526 return Title::makeTitle( NS_USER, $this->getName() );
@@ -2375,7 +2528,7 @@
23762529 /**
23772530 * Get this user's talk page title.
23782531 *
2379 - * @return Title
 2532+ * @return \type{Title}
23802533 */
23812534 function getTalkPage() {
23822535 $title = $this->getUserPage();
@@ -2383,6 +2536,8 @@
23842537 }
23852538
23862539 /**
 2540+ * Get the maximum valid user ID.
 2541+ * @return \int
23872542 * @static
23882543 */
23892544 function getMaxID() {
@@ -2399,7 +2554,7 @@
24002555 /**
24012556 * Determine whether the user is a newbie. Newbies are either
24022557 * anonymous IPs, or the most recently created accounts.
2403 - * @return bool True if it is a newbie.
 2558+ * @return \bool True if the user is a newbie
24042559 */
24052560 function isNewbie() {
24062561 return !$this->isAllowed( 'autoconfirmed' );
@@ -2409,7 +2564,7 @@
24102565 * Is the user active? We check to see if they've made at least
24112566 * X number of edits in the last Y days.
24122567 *
2413 - * @return bool true if the user is active, false if not
 2568+ * @return \bool True if the user is active, false if not.
24142569 */
24152570 public function isActiveEditor() {
24162571 global $wgActiveUserEditCount, $wgActiveUserDays;
@@ -2433,8 +2588,8 @@
24342589
24352590 /**
24362591 * Check to see if the given clear-text password is one of the accepted passwords
2437 - * @param $password String: user password.
2438 - * @return bool True if the given password is correct otherwise False.
 2592+ * @param $password \string user password.
 2593+ * @return \bool True if the given password is correct, otherwise False.
24392594 */
24402595 function checkPassword( $password ) {
24412596 global $wgAuth;
@@ -2474,7 +2629,7 @@
24752630 /**
24762631 * Check if the given clear-text password matches the temporary password
24772632 * sent by e-mail for password reset operations.
2478 - * @return bool
 2633+ * @return \bool
24792634 */
24802635 function checkTemporaryPassword( $plaintext ) {
24812636 return self::comparePasswords( $this->mNewpassword, $plaintext, $this->getId() );
@@ -2486,9 +2641,8 @@
24872642 * login credentials aren't being hijacked with a foreign form
24882643 * submission.
24892644 *
2490 - * @param $salt Mixed: optional function-specific data for hash.
2491 - * Use a string or an array of strings.
2492 - * @return string
 2645+ * @param $salt \2types{\string,\arrayof{\string}} Optional function-specific data for hashing
 2646+ * @return \string The new edit token
24932647 */
24942648 function editToken( $salt = '' ) {
24952649 if ( $this->isAnon() ) {
@@ -2508,9 +2662,10 @@
25092663 }
25102664
25112665 /**
2512 - * Generate a hex-y looking random token for various uses.
2513 - * Could be made more cryptographically sure if someone cares.
2514 - * @return string
 2666+ * Generate a looking random token for various uses.
 2667+ *
 2668+ * @param $salt \string Optional salt value
 2669+ * @return \string The new random token
25152670 */
25162671 function generateToken( $salt = '' ) {
25172672 $token = dechex( mt_rand() ) . dechex( mt_rand() );
@@ -2523,9 +2678,9 @@
25242679 * user's own login session, not a form submission from a third-party
25252680 * site.
25262681 *
2527 - * @param $val String: the input value to compare
2528 - * @param $salt String: optional function-specific data for hash
2529 - * @return bool
 2682+ * @param $val \string Input value to compare
 2683+ * @param $salt \string Optional function-specific data for hashing
 2684+ * @return \bool Whether the token matches
25302685 */
25312686 function matchEditToken( $val, $salt = '' ) {
25322687 $sessionToken = $this->editToken( $salt );
@@ -2536,7 +2691,12 @@
25372692 }
25382693
25392694 /**
2540 - * Check whether the edit token is fine except for the suffix
 2695+ * Check given value against the token value stored in the session,
 2696+ * ignoring the suffix.
 2697+ *
 2698+ * @param $val \string Input value to compare
 2699+ * @param $salt \string Optional function-specific data for hashing
 2700+ * @return \bool Whether the token matches
25412701 */
25422702 function matchEditTokenNoSuffix( $val, $salt = '' ) {
25432703 $sessionToken = $this->editToken( $salt );
@@ -2547,10 +2707,7 @@
25482708 * Generate a new e-mail confirmation token and send a confirmation/invalidation
25492709 * mail to the user's given address.
25502710 *
2551 - * Calls saveSettings() internally; as it has side effects, not committing changes
2552 - * would be pretty silly.
2553 - *
2554 - * @return mixed True on success, a WikiError object on failure.
 2711+ * @return \2types{\bool,\type{WikiError}} True on success, a WikiError object on failure.
25552712 */
25562713 function sendConfirmationMail() {
25572714 global $wgLang;
@@ -2573,11 +2730,11 @@
25742731 * Send an e-mail to this user's account. Does not check for
25752732 * confirmed status or validity.
25762733 *
2577 - * @param $subject string
2578 - * @param $body string
2579 - * @param $from string: optional from address; default $wgPasswordSender will be used otherwise.
2580 - * @param $replyto string
2581 - * @return mixed True on success, a WikiError object on failure.
 2734+ * @param $subject \string Message subject
 2735+ * @param $body \string Message body
 2736+ * @param $from \string Optional From address; if unspecified, default $wgPasswordSender will be used
 2737+ * @param $replyto \string
 2738+ * @return \2types{\bool,\type{WikiError}} True on success, a WikiError object on failure
25822739 */
25832740 function sendMail( $subject, $body, $from = null, $replyto = null ) {
25842741 if( is_null( $from ) ) {
@@ -2592,13 +2749,13 @@
25932750
25942751 /**
25952752 * Generate, store, and return a new e-mail confirmation code.
2596 - * A hash (unsalted since it's used as a key) is stored.
 2753+ * A hash (unsalted, since it's used as a key) is stored.
25972754 *
2598 - * Call saveSettings() after calling this function to commit
 2755+ * @note Call saveSettings() after calling this function to commit
25992756 * this change to the database.
26002757 *
2601 - * @param &$expiration mixed output: accepts the expiration time
2602 - * @return string
 2758+ * @param[out] &$expiration \mixed Accepts the expiration time
 2759+ * @return \string
26032760 * @private
26042761 */
26052762 function confirmationToken( &$expiration ) {
@@ -2615,8 +2772,8 @@
26162773
26172774 /**
26182775 * Return a URL the user can use to confirm their email address.
2619 - * @param $token accepts the email confirmation token
2620 - * @return string
 2776+ * @param $token \string Accepts the email confirmation token
 2777+ * @return \string
26212778 * @private
26222779 */
26232780 function confirmationTokenUrl( $token ) {
@@ -2624,8 +2781,8 @@
26252782 }
26262783 /**
26272784 * Return a URL the user can use to invalidate their email address.
2628 - * @param $token accepts the email confirmation token
2629 - * @return string
 2785+ * @param $token \string Accepts the email confirmation token
 2786+ * @return \string
26302787 * @private
26312788 */
26322789 function invalidationTokenUrl( $token ) {
@@ -2637,10 +2794,14 @@
26382795 * This uses $wgArticlePath directly as a quickie hack to use the
26392796 * hardcoded English names of the Special: pages, for ASCII safety.
26402797 *
2641 - * Since these URLs get dropped directly into emails, using the
 2798+ * @note Since these URLs get dropped directly into emails, using the
26422799 * short English names avoids insanely long URL-encoded links, which
26432800 * also sometimes can get corrupted in some browsers/mailers
26442801 * (bug 6957 with Gmail and Internet Explorer).
 2802+ *
 2803+ * @param $page \string Special page
 2804+ * @param $token \string Token
 2805+ * @return \string Formatted URL
26452806 */
26462807 protected function getTokenUrl( $page, $token ) {
26472808 global $wgArticlePath;
@@ -2654,7 +2815,7 @@
26552816 /**
26562817 * Mark the e-mail address confirmed.
26572818 *
2658 - * Call saveSettings() after calling this function to commit the change.
 2819+ * @note Call saveSettings() after calling this function to commit the change.
26592820 */
26602821 function confirmEmail() {
26612822 $this->setEmailAuthenticationTimestamp( wfTimestampNow() );
@@ -2662,10 +2823,10 @@
26632824 }
26642825
26652826 /**
2666 - * Invalidate the user's email confirmation, unauthenticate the email
2667 - * if it was already confirmed.
 2827+ * Invalidate the user's e-mail confirmation, and unauthenticate the e-mail
 2828+ * address if it was already confirmed.
26682829 *
2669 - * Call saveSettings() after calling this function to commit the change.
 2830+ * @note Call saveSettings() after calling this function to commit the change.
26702831 */
26712832 function invalidateEmail() {
26722833 $this->load();
@@ -2675,6 +2836,10 @@
26762837 return true;
26772838 }
26782839
 2840+ /**
 2841+ * Set the e-mail authentication timestamp.
 2842+ * @param $timestamp \string TS_MW timestamp
 2843+ */
26792844 function setEmailAuthenticationTimestamp( $timestamp ) {
26802845 $this->load();
26812846 $this->mEmailAuthenticated = $timestamp;
@@ -2684,7 +2849,7 @@
26852850 /**
26862851 * Is this user allowed to send e-mails within limits of current
26872852 * site configuration?
2688 - * @return bool
 2853+ * @return \bool
26892854 */
26902855 function canSendEmail() {
26912856 $canSend = $this->isEmailConfirmed();
@@ -2695,7 +2860,7 @@
26962861 /**
26972862 * Is this user allowed to receive e-mails within limits of current
26982863 * site configuration?
2699 - * @return bool
 2864+ * @return \bool
27002865 */
27012866 function canReceiveEmail() {
27022867 return $this->isEmailConfirmed() && !$this->getOption( 'disablemail' );
@@ -2705,11 +2870,11 @@
27062871 * Is this user's e-mail address valid-looking and confirmed within
27072872 * limits of the current site configuration?
27082873 *
2709 - * If $wgEmailAuthentication is on, this may require the user to have
 2874+ * @note If $wgEmailAuthentication is on, this may require the user to have
27102875 * confirmed their address by returning a code or using a password
27112876 * sent to the address from the wiki.
27122877 *
2713 - * @return bool
 2878+ * @return \bool
27142879 */
27152880 function isEmailConfirmed() {
27162881 global $wgEmailAuthentication;
@@ -2729,8 +2894,8 @@
27302895 }
27312896
27322897 /**
2733 - * Return true if there is an outstanding request for e-mail confirmation.
2734 - * @return bool
 2898+ * Check whether there is an outstanding request for e-mail confirmation.
 2899+ * @return \bool
27352900 */
27362901 function isEmailConfirmationPending() {
27372902 global $wgEmailAuthentication;
@@ -2741,10 +2906,10 @@
27422907 }
27432908
27442909 /**
2745 - * Get the timestamp of account creation, or false for
2746 - * non-existent/anonymous user accounts
 2910+ * Get the timestamp of account creation.
27472911 *
2748 - * @return mixed
 2912+ * @return \2types{\string,\bool} string Timestamp of account creation, or false for
 2913+ * non-existent/anonymous user accounts.
27492914 */
27502915 public function getRegistration() {
27512916 return $this->mId > 0
@@ -2753,8 +2918,10 @@
27542919 }
27552920
27562921 /**
2757 - * @param $groups Array: list of groups
2758 - * @return array list of permission key names for given groups combined
 2922+ * Get the permissions associated with a given list of groups
 2923+ *
 2924+ * @param $groups \arrayof{\string} List of internal group names
 2925+ * @return \arrayof{\string} List of permission key names for given groups combined
27592926 */
27602927 static function getGroupPermissions( $groups ) {
27612928 global $wgGroupPermissions;
@@ -2771,8 +2938,8 @@
27722939 /**
27732940 * Get all the groups who have a given permission
27742941 *
2775 - * @param $role String: Role to check
2776 - * @return array list of groups with the given permission
 2942+ * @param $role \string Role to check
 2943+ * @return \arrayof{\string} List of internal group names with the given permission
27772944 */
27782945 static function getGroupsWithPermission( $role ) {
27792946 global $wgGroupPermissions;
@@ -2786,8 +2953,10 @@
27872954 }
27882955
27892956 /**
2790 - * @param $group String: key name
2791 - * @return string localized descriptive name for group, if provided
 2957+ * Get the localized descriptive name for a group, if it exists
 2958+ *
 2959+ * @param $group \string Internal group name
 2960+ * @return \string
27922961 */
27932962 static function getGroupName( $group ) {
27942963 global $wgMessageCache;
@@ -2800,8 +2969,10 @@
28012970 }
28022971
28032972 /**
2804 - * @param $group String: key name
2805 - * @return string localized descriptive name for member of a group, if provided
 2973+ * Get the localized descriptive name for a member of a group, if it exists
 2974+ *
 2975+ * @param $group \string Internal group name
 2976+ * @return \string
28062977 */
28072978 static function getGroupMember( $group ) {
28082979 global $wgMessageCache;
@@ -2816,9 +2987,8 @@
28172988 /**
28182989 * Return the set of defined explicit groups.
28192990 * The implicit groups (by default *, 'user' and 'autoconfirmed')
2820 - * are not included, as they are defined automatically,
2821 - * not in the database.
2822 - * @return array
 2991+ * are not included, as they are defined automatically, not in the database.
 2992+ * @return \arrayof{\string}
28232993 */
28242994 static function getAllGroups() {
28252995 global $wgGroupPermissions;
@@ -2829,7 +2999,8 @@
28303000 }
28313001
28323002 /**
2833 - * Get a list of all available permissions
 3003+ * Get a list of all available permissions.
 3004+ * @return \arrayof{\string}
28343005 */
28353006 static function getAllRights() {
28363007 if ( self::$mAllRights === false ) {
@@ -2846,8 +3017,7 @@
28473018
28483019 /**
28493020 * Get a list of implicit groups
2850 - *
2851 - * @return array
 3021+ * @return \arrayof{\string}
28523022 */
28533023 public static function getImplicitGroups() {
28543024 global $wgImplicitGroups;
@@ -2859,8 +3029,8 @@
28603030 /**
28613031 * Get the title of a page describing a particular group
28623032 *
2863 - * @param $group Name of the group
2864 - * @return mixed
 3033+ * @param $group \string Internal group name
 3034+ * @return \2types{\type{Title},\bool} Title of the page if it exists, false otherwise
28653035 */
28663036 static function getGroupPage( $group ) {
28673037 global $wgMessageCache;
@@ -2875,11 +3045,12 @@
28763046 }
28773047
28783048 /**
2879 - * Create a link to the group in HTML, if available
 3049+ * Create a link to the group in HTML, if available;
 3050+ * else return the group name.
28803051 *
2881 - * @param $group Name of the group
2882 - * @param $text The text of the link
2883 - * @return mixed
 3052+ * @param $group \string Internal name of the group
 3053+ * @param $text \string The text of the link
 3054+ * @return \string HTML link to the group
28843055 */
28853056 static function makeGroupLinkHTML( $group, $text = '' ) {
28863057 if( $text == '' ) {
@@ -2896,11 +3067,12 @@
28973068 }
28983069
28993070 /**
2900 - * Create a link to the group in Wikitext, if available
 3071+ * Create a link to the group in Wikitext, if available;
 3072+ * else return the group name.
29013073 *
2902 - * @param $group Name of the group
2903 - * @param $text The text of the link (by default, the name of the group)
2904 - * @return mixed
 3074+ * @param $group \string Internal name of the group
 3075+ * @param $text \string The text of the link
 3076+ * @return \string Wikilink to the group
29053077 */
29063078 static function makeGroupLinkWiki( $group, $text = '' ) {
29073079 if( $text == '' ) {
@@ -2959,6 +3131,12 @@
29603132 $this->invalidateCache();
29613133 }
29623134
 3135+ /**
 3136+ * Get the description of a given right
 3137+ *
 3138+ * @param $right \string Right to query
 3139+ * @return \string
 3140+ */
29633141 static function getRightDescription( $right ) {
29643142 global $wgMessageCache;
29653143 $wgMessageCache->loadAllMessages();
@@ -2972,8 +3150,9 @@
29733151 /**
29743152 * Make an old-style password hash
29753153 *
2976 - * @param $password String: plain-text password
2977 - * @param $userId String: user ID
 3154+ * @param $password \string Plain-text password
 3155+ * @param $userId \string User ID
 3156+ * @return \string Password hash
29783157 */
29793158 static function oldCrypt( $password, $userId ) {
29803159 global $wgPasswordSalt;
@@ -2987,8 +3166,10 @@
29883167 /**
29893168 * Make a new-style password hash
29903169 *
2991 - * @param $password String: plain-text password
2992 - * @param $salt String: salt, may be random or the user ID. False to generate a salt.
 3170+ * @param $password \string Plain-text password
 3171+ * @param $salt \string Optional salt, may be random or the user ID.
 3172+ * If unspecified or false, will generate one automatically
 3173+ * @return \string Password hash
29933174 */
29943175 static function crypt( $password, $salt = false ) {
29953176 global $wgPasswordSalt;
@@ -3007,9 +3188,10 @@
30083189 * Compare a password hash with a plain-text password. Requires the user
30093190 * ID if there's a chance that the hash is an old-style hash.
30103191 *
3011 - * @param $hash String: password hash
3012 - * @param $password String: plain-text password to compare
3013 - * @param $userId String: user ID for old-style password salt
 3192+ * @param $hash \string Password hash
 3193+ * @param $password \string Plain-text password to compare
 3194+ * @param $userId \string User ID for old-style password salt
 3195+ * @return \bool
30143196 */
30153197 static function comparePasswords( $hash, $password, $userId = false ) {
30163198 $m = false;

Status & tagging log