r111053 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r111052‎ | r111053 | r111054 >
Date:18:01, 9 February 2012
Author:reedy
Status:resolved
Tags:
Comment:
Fixing some of the "@return true" or "@return false", need to be "@return bool" and then the metadata can say true if foo, false if bar

Other documentation improvements
Modified paths:
  • /trunk/phase3/includes/Action.php (modified) (history)
  • /trunk/phase3/includes/Article.php (modified) (history)
  • /trunk/phase3/includes/Autopromote.php (modified) (history)
  • /trunk/phase3/includes/BacklinkCache.php (modified) (history)
  • /trunk/phase3/includes/Block.php (modified) (history)
  • /trunk/phase3/includes/EditPage.php (modified) (history)
  • /trunk/phase3/includes/GlobalFunctions.php (modified) (history)
  • /trunk/phase3/includes/HistoryBlob.php (modified) (history)
  • /trunk/phase3/includes/actions/HistoryAction.php (modified) (history)
  • /trunk/phase3/includes/api/ApiPageSet.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQuery.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryBase.php (modified) (history)
  • /trunk/phase3/includes/cache/MessageCache.php (modified) (history)
  • /trunk/phase3/includes/db/Database.php (modified) (history)
  • /trunk/phase3/includes/db/DatabaseIbm_db2.php (modified) (history)
  • /trunk/phase3/includes/db/DatabaseMysql.php (modified) (history)
  • /trunk/phase3/includes/db/DatabaseSqlite.php (modified) (history)
  • /trunk/phase3/includes/db/LoadBalancer.php (modified) (history)
  • /trunk/phase3/includes/filerepo/FileRepo.php (modified) (history)
  • /trunk/phase3/includes/filerepo/RepoGroup.php (modified) (history)
  • /trunk/phase3/includes/filerepo/backend/FileBackend.php (modified) (history)
  • /trunk/phase3/includes/filerepo/backend/FileOp.php (modified) (history)
  • /trunk/phase3/includes/filerepo/backend/SwiftFileBackend.php (modified) (history)
  • /trunk/phase3/includes/filerepo/backend/lockmanager/DBLockManager.php (modified) (history)
  • /trunk/phase3/includes/filerepo/file/File.php (modified) (history)
  • /trunk/phase3/includes/filerepo/file/LocalFile.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Article.php
@@ -188,7 +188,7 @@
189189 * This function has side effects! Do not use this function if you
190190 * only want the real revision text if any.
191191 *
192 - * @return Return the text of this revision
 192+ * @return string Return the text of this revision
193193 */
194194 public function getContent() {
195195 global $wgUser;
@@ -1582,7 +1582,7 @@
15831583
15841584 /**
15851585 * Get parser options suitable for rendering the primary article wikitext
1586 - * @return ParserOptions|false
 1586+ * @return ParserOptions|bool
15871587 */
15881588 public function getParserOptions() {
15891589 global $wgUser;
Index: trunk/phase3/includes/GlobalFunctions.php
@@ -980,8 +980,8 @@
981981 * Throws a warning that $function is deprecated
982982 *
983983 * @param $function String
984 - * @param $version String|false: Added in 1.19.
985 - * @param $component String|false: Added in 1.19.
 984+ * @param $version String|bool: Added in 1.19.
 985+ * @param $component String|bool: Added in 1.19.
986986 *
987987 * @return null
988988 */
@@ -3445,7 +3445,7 @@
34463446 * Shortcut for RepoGroup::singleton()->findFile()
34473447 *
34483448 * @param $title String or Title object
3449 - * @param $options Associative array of options:
 3449+ * @param $options array Associative array of options:
34503450 * time: requested time for an archived image, or false for the
34513451 * current version. An image object will be returned which was
34523452 * created at the specified time.
@@ -3806,7 +3806,7 @@
38073807 * because php might make it negative.
38083808 *
38093809 * @throws MWException if $data not long enough, or if unpack fails
3810 - * @return Associative array of the extracted data
 3810+ * @return array Associative array of the extracted data
38113811 */
38123812 function wfUnpack( $format, $data, $length=false ) {
38133813 if ( $length !== false ) {
Index: trunk/phase3/includes/db/DatabaseMysql.php
@@ -585,7 +585,7 @@
586586 /**
587587 * Get the position of the master from SHOW SLAVE STATUS
588588 *
589 - * @return MySQLMasterPos|false
 589+ * @return MySQLMasterPos|bool
590590 */
591591 function getSlavePos() {
592592 if ( !is_null( $this->mFakeSlaveLag ) ) {
@@ -606,7 +606,7 @@
607607 /**
608608 * Get the position of the master from SHOW MASTER STATUS
609609 *
610 - * @return MySQLMasterPos|false
 610+ * @return MySQLMasterPos|bool
611611 */
612612 function getMasterPos() {
613613 if ( $this->mFakeMaster ) {
Index: trunk/phase3/includes/db/DatabaseIbm_db2.php
@@ -472,7 +472,7 @@
473473 * @param $user String
474474 * @param $password String
475475 * @param $dbName String: database name
476 - * @return a fresh connection
 476+ * @return DatabaseBase a fresh connection
477477 */
478478 public function open( $server, $user, $password, $dbName ) {
479479 wfProfileIn( __METHOD__ );
@@ -1279,11 +1279,11 @@
12801280 * @param $conds Array or string, condition(s) for WHERE
12811281 * @param $fname String: calling function name (use __METHOD__)
12821282 * for logs/profiling
1283 - * @param $options Associative array of options
 1283+ * @param $options array Associative array of options
12841284 * (e.g. array( 'GROUP BY' => 'page_title' )),
12851285 * see Database::makeSelectOptions code for list of
12861286 * supported stuff
1287 - * @param $join_conds Associative array of table join conditions (optional)
 1287+ * @param $join_conds array Associative array of table join conditions (optional)
12881288 * (e.g. array( 'page' => array('LEFT JOIN',
12891289 * 'page_latest=rev_id') )
12901290 * @return Mixed: database result resource for fetch functions or false
@@ -1333,7 +1333,7 @@
13341334 *
13351335 * @private
13361336 *
1337 - * @param $options Associative array of options to be turned into
 1337+ * @param $options array Associative array of options to be turned into
13381338 * an SQL query, valid keys are listed in the function.
13391339 * @return Array
13401340 */
Index: trunk/phase3/includes/db/Database.php
@@ -2599,7 +2599,7 @@
26002600 *
26012601 * @param $sql String SQL query we will append the limit too
26022602 * @param $limit Integer the SQL limit
2603 - * @param $offset Integer|false the SQL offset (default false)
 2603+ * @param $offset Integer|bool the SQL offset (default false)
26042604 *
26052605 * @return string
26062606 */
@@ -3009,7 +3009,7 @@
30103010 * installations. Most callers should use LoadBalancer::safeGetLag()
30113011 * instead.
30123012 *
3013 - * @return Database replication lag in seconds
 3013+ * @return int Database replication lag in seconds
30143014 */
30153015 function getLag() {
30163016 return intval( $this->mFakeSlaveLag );
@@ -3134,7 +3134,7 @@
31353135 * ones in $GLOBALS. If an array is set here, $GLOBALS will not be used at
31363136 * all. If it's set to false, $GLOBALS will be used.
31373137 *
3138 - * @param $vars False, or array mapping variable name to value.
 3138+ * @param $vars bool|array mapping variable name to value.
31393139 */
31403140 function setSchemaVars( $vars ) {
31413141 $this->mSchemaVars = $vars;
Index: trunk/phase3/includes/db/DatabaseSqlite.php
@@ -617,7 +617,7 @@
618618 * Get information about a given field
619619 * Returns false if the field does not exist.
620620 *
621 - * @return SQLiteField|false
 621+ * @return SQLiteField|bool
622622 */
623623 function fieldInfo( $table, $field ) {
624624 $tableName = $this->tableName( $table );
Index: trunk/phase3/includes/db/LoadBalancer.php
@@ -385,7 +385,7 @@
386386 * Returns false if there is no connection open
387387 *
388388 * @param $i int
389 - * @return DatabaseBase|false
 389+ * @return DatabaseBase|bool
390390 */
391391 function getAnyOpenConnection( $i ) {
392392 foreach ( $this->mConns as $conns ) {
Index: trunk/phase3/includes/filerepo/file/LocalFile.php
@@ -620,7 +620,7 @@
621621
622622 /**
623623 * Get all thumbnail names previously generated for this file
624 - * @param $archiveName string|false Name of an archive file
 624+ * @param $archiveName string|bool Name of an archive file
625625 * @return array first element is the base dir, then files in that base dir.
626626 */
627627 function getThumbnails( $archiveName = false ) {
Index: trunk/phase3/includes/filerepo/file/File.php
@@ -252,7 +252,7 @@
253253 /**
254254 * Return the associated title object
255255 *
256 - * @return Title|false
 256+ * @return Title|bool
257257 */
258258 public function getTitle() {
259259 return $this->title;
@@ -329,7 +329,7 @@
330330 * Most callers don't check the return value, but ForeignAPIFile::getPath
331331 * returns false.
332332 *
333 - * @return string|false
 333+ * @return string|bool
334334 */
335335 public function getPath() {
336336 if ( !isset( $this->path ) ) {
@@ -344,7 +344,7 @@
345345 * Returns false on failure. Callers must not alter the file.
346346 * Temporary files are cleared automatically.
347347 *
348 - * @return string|false
 348+ * @return string|bool
349349 */
350350 public function getLocalRefPath() {
351351 $this->assertRepoDefined();
@@ -774,7 +774,7 @@
775775 * @param $params Array: an associative array of handler-specific parameters.
776776 * Typical keys are width, height and page.
777777 * @param $flags Integer: a bitfield, may contain self::RENDER_NOW to force rendering
778 - * @return MediaTransformOutput|false
 778+ * @return MediaTransformOutput|bool
779779 */
780780 function transform( $params, $flags = 0 ) {
781781 global $wgUseSquid, $wgIgnoreImageErrors, $wgThumbnailEpoch;
@@ -1329,7 +1329,7 @@
13301330 /**
13311331 * Returns the repository
13321332 *
1333 - * @return FileRepo|false
 1333+ * @return FileRepo|bool
13341334 */
13351335 function getRepo() {
13361336 return $this->repo;
@@ -1418,7 +1418,7 @@
14191419 * @param $versions array set of record ids of deleted items to restore,
14201420 * or empty to restore all revisions.
14211421 * @param $unsuppress bool remove restrictions on content upon restoration?
1422 - * @return int|false the number of file revisions restored if successful,
 1422+ * @return int|bool the number of file revisions restored if successful,
14231423 * or false on failure
14241424 * STUB
14251425 * Overridden by LocalFile
@@ -1548,7 +1548,7 @@
15491549 /**
15501550 * Get the 14-character timestamp of the file upload
15511551 *
1552 - * @return string|false TS_MW timestamp or false on failure
 1552+ * @return string|bool TS_MW timestamp or false on failure
15531553 */
15541554 function getTimestamp() {
15551555 $this->assertRepoDefined();
Index: trunk/phase3/includes/filerepo/backend/lockmanager/DBLockManager.php
@@ -245,7 +245,7 @@
246246 * Get (or reuse) a connection to a lock DB
247247 *
248248 * @param $lockDb string
249 - * @return Database
 249+ * @return DatabaseBase
250250 * @throws DBError
251251 */
252252 protected function getConnection( $lockDb ) {
Index: trunk/phase3/includes/filerepo/backend/FileOp.php
@@ -297,7 +297,7 @@
298298 * precheckDestExistence() helper function to get the source file SHA-1.
299299 * Subclasses should overwride this iff the source is not in storage.
300300 *
301 - * @return string|false Returns false on failure
 301+ * @return string|bool Returns false on failure
302302 */
303303 protected function getSourceSha1Base36() {
304304 return null; // N/A
@@ -324,7 +324,7 @@
325325 *
326326 * @param $source string Storage path
327327 * @param $predicates Array
328 - * @return string|false
 328+ * @return string|bool
329329 */
330330 final protected function fileSha1( $source, array $predicates ) {
331331 if ( isset( $predicates['sha1'][$source] ) ) {
Index: trunk/phase3/includes/filerepo/backend/SwiftFileBackend.php
@@ -693,7 +693,7 @@
694694 /**
695695 * Get a connection to the Swift proxy
696696 *
697 - * @return CF_Connection|false
 697+ * @return CF_Connection|bool
698698 * @throws InvalidResponseException
699699 */
700700 protected function getConnection() {
Index: trunk/phase3/includes/filerepo/backend/FileBackend.php
@@ -406,7 +406,7 @@
407407 * latest : use the latest available data
408408 *
409409 * @param $params Array
410 - * @return string|false TS_MW timestamp or false on failure
 410+ * @return string|bool TS_MW timestamp or false on failure
411411 */
412412 abstract public function getFileTimestamp( array $params );
413413
@@ -419,7 +419,7 @@
420420 * latest : use the latest available data
421421 *
422422 * @param $params Array
423 - * @return string|false Returns false on failure
 423+ * @return string|bool Returns false on failure
424424 */
425425 abstract public function getFileContents( array $params );
426426
@@ -431,7 +431,7 @@
432432 * latest : use the latest available data
433433 *
434434 * @param $params Array
435 - * @return integer|false Returns false on failure
 435+ * @return integer|bool Returns false on failure
436436 */
437437 abstract public function getFileSize( array $params );
438438
@@ -448,7 +448,7 @@
449449 * latest : use the latest available data
450450 *
451451 * @param $params Array
452 - * @return Array|false|null Returns null on failure
 452+ * @return Array|bool|null Returns null on failure
453453 */
454454 abstract public function getFileStat( array $params );
455455
@@ -460,7 +460,7 @@
461461 * latest : use the latest available data
462462 *
463463 * @param $params Array
464 - * @return string|false Hash string or false on failure
 464+ * @return string|bool Hash string or false on failure
465465 */
466466 abstract public function getFileSha1Base36( array $params );
467467
Index: trunk/phase3/includes/filerepo/RepoGroup.php
@@ -65,7 +65,7 @@
6666 /**
6767 * Construct a group of file repositories.
6868 *
69 - * @param $localInfo Associative array for local repo's info
 69+ * @param $localInfo array Associative array for local repo's info
7070 * @param $foreignInfo Array of repository info arrays.
7171 * Each info array is an associative array with the 'class' member
7272 * giving the class name. The entire array is passed to the repository
Index: trunk/phase3/includes/filerepo/FileRepo.php
@@ -295,7 +295,7 @@
296296 * private: If true, return restricted (deleted) files if the current
297297 * user is allowed to view them. Otherwise, such files will not
298298 * be found.
299 - * @return File|false
 299+ * @return File|bool
300300 */
301301 public function findFile( $title, $options = array() ) {
302302 $title = File::normalizeTitle( $title );
@@ -377,8 +377,8 @@
378378 * version control should return false if the time is specified.
379379 *
380380 * @param $sha1 String base 36 SHA-1 hash
381 - * @param $options Option array, same as findFile().
382 - * @return File|false
 381+ * @param $options array Option array, same as findFile().
 382+ * @return File|bool
383383 */
384384 public function findFileFromKey( $sha1, $options = array() ) {
385385 $time = isset( $options['time'] ) ? $options['time'] : false;
@@ -419,7 +419,7 @@
420420 /**
421421 * Get the public root URL of the repository
422422 *
423 - * @return string|false
 423+ * @return string|bool
424424 */
425425 public function getRootUrl() {
426426 return $this->url;
@@ -531,7 +531,7 @@
532532 *
533533 * @param $query mixed Query string to append
534534 * @param $entry string Entry point; defaults to index
535 - * @return string|false
 535+ * @return string|bool
536536 */
537537 public function makeUrl( $query = '', $entry = 'index' ) {
538538 if ( isset( $this->scriptDirUrl ) ) {
@@ -611,7 +611,7 @@
612612 /**
613613 * Get the URL of the stylesheet to apply to description pages
614614 *
615 - * @return string|false
 615+ * @return string|bool
616616 */
617617 public function getDescriptionStylesheetUrl() {
618618 if ( isset( $this->scriptDirUrl ) ) {
@@ -1188,7 +1188,7 @@
11891189 * Get the timestamp of a file with a given virtual URL/storage path
11901190 *
11911191 * @param $virtualUrl string
1192 - * @return string|false
 1192+ * @return string|bool
11931193 */
11941194 public function getFileTimestamp( $virtualUrl ) {
11951195 $path = $this->resolveToStoragePath( $virtualUrl );
@@ -1199,7 +1199,7 @@
12001200 * Get the sha1 of a file with a given virtual URL/storage path
12011201 *
12021202 * @param $virtualUrl string
1203 - * @return string|false
 1203+ * @return string|bool
12041204 */
12051205 public function getFileSha1( $virtualUrl ) {
12061206 $path = $this->resolveToStoragePath( $virtualUrl );
Index: trunk/phase3/includes/EditPage.php
@@ -1551,7 +1551,7 @@
15521552 *
15531553 * @param $text string
15541554 *
1555 - * @return string|false matching string or false
 1555+ * @return string|bool matching string or false
15561556 */
15571557 public static function matchSpamRegex( $text ) {
15581558 global $wgSpamRegex;
@@ -1565,7 +1565,7 @@
15661566 *
15671567 * @parma $text string
15681568 *
1569 - * @return string|false matching string or false
 1569+ * @return string|bool matching string or false
15701570 */
15711571 public static function matchSummarySpamRegex( $text ) {
15721572 global $wgSummarySpamRegex;
Index: trunk/phase3/includes/actions/HistoryAction.php
@@ -69,7 +69,6 @@
7070
7171 /**
7272 * Print the history page for an article.
73 - * @return nothing
7473 */
7574 function onView() {
7675 global $wgScript, $wgUseFileCache, $wgSquidMaxage;
@@ -108,7 +107,8 @@
109108 $feedType = $request->getVal( 'feed' );
110109 if ( $feedType ) {
111110 wfProfileOut( __METHOD__ );
112 - return $this->feed( $feedType );
 111+ $this->feed( $feedType );
 112+ return;
113113 }
114114
115115 // Fail nicely if article doesn't exist.
Index: trunk/phase3/includes/api/ApiQueryBase.php
@@ -392,7 +392,7 @@
393393 * @param $name string Name to assign to the database connection
394394 * @param $db int One of the DB_* constants
395395 * @param $groups array Query groups
396 - * @return Database
 396+ * @return DatabaseBase
397397 */
398398 public function selectNamedDB( $name, $db, $groups ) {
399399 $this->mDb = $this->getQuery()->getNamedDB( $name, $db, $groups );
Index: trunk/phase3/includes/api/ApiQuery.php
@@ -135,7 +135,7 @@
136136
137137 /**
138138 * Gets a default slave database connection object
139 - * @return Database
 139+ * @return DatabaseBase
140140 */
141141 public function getDB() {
142142 if ( !isset( $this->mSlaveDB ) ) {
Index: trunk/phase3/includes/api/ApiPageSet.php
@@ -342,7 +342,7 @@
343343
344344 /**
345345 * Populate this PageSet from a rowset returned from the database
346 - * @param $db Database object
 346+ * @param $db DatabaseBase object
347347 * @param $queryResult ResultWrapper Query result object
348348 */
349349 public function populateFromQueryResult( $db, $queryResult ) {
Index: trunk/phase3/includes/BacklinkCache.php
@@ -103,7 +103,7 @@
104104 /**
105105 * Get the slave connection to the database
106106 * When non existing, will initialize the connection.
107 - * @return Database object
 107+ * @return DatabaseBase object
108108 */
109109 protected function getDB() {
110110 if ( !isset( $this->db ) ) {
Index: trunk/phase3/includes/cache/MessageCache.php
@@ -696,7 +696,7 @@
697697 * @param $title String: Message cache key with initial uppercase letter.
698698 * @param $code String: code denoting the language to try.
699699 *
700 - * @return string|false
 700+ * @return string|bool
701701 */
702702 function getMsgFromNamespace( $title, $code ) {
703703 global $wgAdaptiveMessageCache;
Index: trunk/phase3/includes/Autopromote.php
@@ -32,7 +32,7 @@
3333 *
3434 * Does not return groups the user already belongs to or has once belonged.
3535 *
36 - * @param $user The user to get the groups for
 36+ * @param $user User The user to get the groups for
3737 * @param $event String key in $wgAutopromoteOnce (each one has groups/criteria)
3838 *
3939 * @return array Groups the user should be promoted to.
Index: trunk/phase3/includes/Block.php
@@ -893,7 +893,7 @@
894894 * Encode expiry for DB
895895 *
896896 * @param $expiry String: timestamp for expiry, or
897 - * @param $db Database object
 897+ * @param $db DatabaseBase object
898898 * @return String
899899 * @deprecated since 1.18; use $dbw->encodeExpiry() instead
900900 */
Index: trunk/phase3/includes/Action.php
@@ -78,7 +78,7 @@
7979 * @param $action String
8080 * @param $page Page
8181 * @param $context IContextSource
82 - * @return Action|false|null false if the action is disabled, null
 82+ * @return Action|bool|null false if the action is disabled, null
8383 * if it is not recognised
8484 */
8585 public final static function factory( $action, Page $page, IContextSource $context = null ) {
Index: trunk/phase3/includes/HistoryBlob.php
@@ -179,8 +179,8 @@
180180 var $mOldId, $mHash, $mRef;
181181
182182 /**
183 - * @param $hash Strng: the content hash of the text
184 - * @param $oldid Integer: the old_id for the CGZ object
 183+ * @param $hash string the content hash of the text
 184+ * @param $oldid Integer the old_id for the CGZ object
185185 */
186186 function __construct( $hash = '', $oldid = 0 ) {
187187 $this->mHash = $hash;
@@ -298,7 +298,7 @@
299299 }
300300
301301 /**
302 - * @return string|false
 302+ * @return string|bool
303303 */
304304 function getText() {
305305 $dbr = wfGetDB( DB_SLAVE );

Status & tagging log