From e1d83d5721442fd045b657ace298d0cb25b9b254 Mon Sep 17 00:00:00 2001 From: Sam Reed Date: Thu, 9 Feb 2012 18:01:54 +0000 Subject: [PATCH] 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 --- includes/Action.php | 2 +- includes/Article.php | 4 ++-- includes/Autopromote.php | 2 +- includes/BacklinkCache.php | 2 +- includes/Block.php | 2 +- includes/EditPage.php | 4 ++-- includes/GlobalFunctions.php | 8 ++++---- includes/HistoryBlob.php | 6 +++--- includes/actions/HistoryAction.php | 4 ++-- includes/api/ApiPageSet.php | 2 +- includes/api/ApiQuery.php | 2 +- includes/api/ApiQueryBase.php | 2 +- includes/cache/MessageCache.php | 2 +- includes/db/Database.php | 6 +++--- includes/db/DatabaseIbm_db2.php | 8 ++++---- includes/db/DatabaseMysql.php | 4 ++-- includes/db/DatabaseSqlite.php | 2 +- includes/db/LoadBalancer.php | 2 +- includes/filerepo/FileRepo.php | 16 ++++++++-------- includes/filerepo/RepoGroup.php | 2 +- includes/filerepo/backend/FileBackend.php | 10 +++++----- includes/filerepo/backend/FileOp.php | 4 ++-- includes/filerepo/backend/SwiftFileBackend.php | 2 +- .../backend/lockmanager/DBLockManager.php | 2 +- includes/filerepo/file/File.php | 14 +++++++------- includes/filerepo/file/LocalFile.php | 2 +- 26 files changed, 58 insertions(+), 58 deletions(-) diff --git a/includes/Action.php b/includes/Action.php index 37c4848855..328ce977ea 100644 --- a/includes/Action.php +++ b/includes/Action.php @@ -78,7 +78,7 @@ abstract class Action { * @param $action String * @param $page Page * @param $context IContextSource - * @return Action|false|null false if the action is disabled, null + * @return Action|bool|null false if the action is disabled, null * if it is not recognised */ public final static function factory( $action, Page $page, IContextSource $context = null ) { diff --git a/includes/Article.php b/includes/Article.php index 1fbcdb4ce8..b21f71fecc 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -188,7 +188,7 @@ class Article extends Page { * This function has side effects! Do not use this function if you * only want the real revision text if any. * - * @return Return the text of this revision + * @return string Return the text of this revision */ public function getContent() { global $wgUser; @@ -1582,7 +1582,7 @@ class Article extends Page { /** * Get parser options suitable for rendering the primary article wikitext - * @return ParserOptions|false + * @return ParserOptions|bool */ public function getParserOptions() { global $wgUser; diff --git a/includes/Autopromote.php b/includes/Autopromote.php index a233603074..38adf1447e 100644 --- a/includes/Autopromote.php +++ b/includes/Autopromote.php @@ -32,7 +32,7 @@ class Autopromote { * * Does not return groups the user already belongs to or has once belonged. * - * @param $user The user to get the groups for + * @param $user User The user to get the groups for * @param $event String key in $wgAutopromoteOnce (each one has groups/criteria) * * @return array Groups the user should be promoted to. diff --git a/includes/BacklinkCache.php b/includes/BacklinkCache.php index d17104f873..152c5f033d 100644 --- a/includes/BacklinkCache.php +++ b/includes/BacklinkCache.php @@ -103,7 +103,7 @@ class BacklinkCache { /** * Get the slave connection to the database * When non existing, will initialize the connection. - * @return Database object + * @return DatabaseBase object */ protected function getDB() { if ( !isset( $this->db ) ) { diff --git a/includes/Block.php b/includes/Block.php index ded9cf9ef2..c258dd2568 100644 --- a/includes/Block.php +++ b/includes/Block.php @@ -893,7 +893,7 @@ class Block { * Encode expiry for DB * * @param $expiry String: timestamp for expiry, or - * @param $db Database object + * @param $db DatabaseBase object * @return String * @deprecated since 1.18; use $dbw->encodeExpiry() instead */ diff --git a/includes/EditPage.php b/includes/EditPage.php index 29aaee8e53..dc671a6bdf 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -1551,7 +1551,7 @@ class EditPage { * * @param $text string * - * @return string|false matching string or false + * @return string|bool matching string or false */ public static function matchSpamRegex( $text ) { global $wgSpamRegex; @@ -1565,7 +1565,7 @@ class EditPage { * * @parma $text string * - * @return string|false matching string or false + * @return string|bool matching string or false */ public static function matchSummarySpamRegex( $text ) { global $wgSummarySpamRegex; diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index ab93508fd8..b6e74b7e70 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -980,8 +980,8 @@ function wfLogDBError( $text ) { * Throws a warning that $function is deprecated * * @param $function String - * @param $version String|false: Added in 1.19. - * @param $component String|false: Added in 1.19. + * @param $version String|bool: Added in 1.19. + * @param $component String|bool: Added in 1.19. * * @return null */ @@ -3445,7 +3445,7 @@ function &wfGetLBFactory() { * Shortcut for RepoGroup::singleton()->findFile() * * @param $title String or Title object - * @param $options Associative array of options: + * @param $options array Associative array of options: * time: requested time for an archived image, or false for the * current version. An image object will be returned which was * created at the specified time. @@ -3806,7 +3806,7 @@ function wfRunHooks( $event, $args = array() ) { * because php might make it negative. * * @throws MWException if $data not long enough, or if unpack fails - * @return Associative array of the extracted data + * @return array Associative array of the extracted data */ function wfUnpack( $format, $data, $length=false ) { if ( $length !== false ) { diff --git a/includes/HistoryBlob.php b/includes/HistoryBlob.php index f707b3f6a5..dcb25cd682 100644 --- a/includes/HistoryBlob.php +++ b/includes/HistoryBlob.php @@ -179,8 +179,8 @@ class HistoryBlobStub { var $mOldId, $mHash, $mRef; /** - * @param $hash Strng: the content hash of the text - * @param $oldid Integer: the old_id for the CGZ object + * @param $hash string the content hash of the text + * @param $oldid Integer the old_id for the CGZ object */ function __construct( $hash = '', $oldid = 0 ) { $this->mHash = $hash; @@ -298,7 +298,7 @@ class HistoryBlobCurStub { } /** - * @return string|false + * @return string|bool */ function getText() { $dbr = wfGetDB( DB_SLAVE ); diff --git a/includes/actions/HistoryAction.php b/includes/actions/HistoryAction.php index 23a3f3d7ac..254a5db4ea 100644 --- a/includes/actions/HistoryAction.php +++ b/includes/actions/HistoryAction.php @@ -69,7 +69,6 @@ class HistoryAction extends FormlessAction { /** * Print the history page for an article. - * @return nothing */ function onView() { global $wgScript, $wgUseFileCache, $wgSquidMaxage; @@ -108,7 +107,8 @@ class HistoryAction extends FormlessAction { $feedType = $request->getVal( 'feed' ); if ( $feedType ) { wfProfileOut( __METHOD__ ); - return $this->feed( $feedType ); + $this->feed( $feedType ); + return; } // Fail nicely if article doesn't exist. diff --git a/includes/api/ApiPageSet.php b/includes/api/ApiPageSet.php index 7b84c473dd..cc86c76a36 100644 --- a/includes/api/ApiPageSet.php +++ b/includes/api/ApiPageSet.php @@ -342,7 +342,7 @@ class ApiPageSet extends ApiQueryBase { /** * Populate this PageSet from a rowset returned from the database - * @param $db Database object + * @param $db DatabaseBase object * @param $queryResult ResultWrapper Query result object */ public function populateFromQueryResult( $db, $queryResult ) { diff --git a/includes/api/ApiQuery.php b/includes/api/ApiQuery.php index 5a98ecf197..c172d24dc1 100644 --- a/includes/api/ApiQuery.php +++ b/includes/api/ApiQuery.php @@ -135,7 +135,7 @@ class ApiQuery extends ApiBase { /** * Gets a default slave database connection object - * @return Database + * @return DatabaseBase */ public function getDB() { if ( !isset( $this->mSlaveDB ) ) { diff --git a/includes/api/ApiQueryBase.php b/includes/api/ApiQueryBase.php index 4fe82de0cb..2666045b23 100644 --- a/includes/api/ApiQueryBase.php +++ b/includes/api/ApiQueryBase.php @@ -392,7 +392,7 @@ abstract class ApiQueryBase extends ApiBase { * @param $name string Name to assign to the database connection * @param $db int One of the DB_* constants * @param $groups array Query groups - * @return Database + * @return DatabaseBase */ public function selectNamedDB( $name, $db, $groups ) { $this->mDb = $this->getQuery()->getNamedDB( $name, $db, $groups ); diff --git a/includes/cache/MessageCache.php b/includes/cache/MessageCache.php index 78342f5549..f916503196 100644 --- a/includes/cache/MessageCache.php +++ b/includes/cache/MessageCache.php @@ -696,7 +696,7 @@ class MessageCache { * @param $title String: Message cache key with initial uppercase letter. * @param $code String: code denoting the language to try. * - * @return string|false + * @return string|bool */ function getMsgFromNamespace( $title, $code ) { global $wgAdaptiveMessageCache; diff --git a/includes/db/Database.php b/includes/db/Database.php index 2c9a128564..ab9e2f4357 100644 --- a/includes/db/Database.php +++ b/includes/db/Database.php @@ -2599,7 +2599,7 @@ abstract class DatabaseBase implements DatabaseType { * * @param $sql String SQL query we will append the limit too * @param $limit Integer the SQL limit - * @param $offset Integer|false the SQL offset (default false) + * @param $offset Integer|bool the SQL offset (default false) * * @return string */ @@ -3009,7 +3009,7 @@ abstract class DatabaseBase implements DatabaseType { * installations. Most callers should use LoadBalancer::safeGetLag() * instead. * - * @return Database replication lag in seconds + * @return int Database replication lag in seconds */ function getLag() { return intval( $this->mFakeSlaveLag ); @@ -3134,7 +3134,7 @@ abstract class DatabaseBase implements DatabaseType { * ones in $GLOBALS. If an array is set here, $GLOBALS will not be used at * all. If it's set to false, $GLOBALS will be used. * - * @param $vars False, or array mapping variable name to value. + * @param $vars bool|array mapping variable name to value. */ function setSchemaVars( $vars ) { $this->mSchemaVars = $vars; diff --git a/includes/db/DatabaseIbm_db2.php b/includes/db/DatabaseIbm_db2.php index 7aefd5900e..03dbac9eac 100644 --- a/includes/db/DatabaseIbm_db2.php +++ b/includes/db/DatabaseIbm_db2.php @@ -472,7 +472,7 @@ class DatabaseIbm_db2 extends DatabaseBase { * @param $user String * @param $password String * @param $dbName String: database name - * @return a fresh connection + * @return DatabaseBase a fresh connection */ public function open( $server, $user, $password, $dbName ) { wfProfileIn( __METHOD__ ); @@ -1279,11 +1279,11 @@ class DatabaseIbm_db2 extends DatabaseBase { * @param $conds Array or string, condition(s) for WHERE * @param $fname String: calling function name (use __METHOD__) * for logs/profiling - * @param $options Associative array of options + * @param $options array Associative array of options * (e.g. array( 'GROUP BY' => 'page_title' )), * see Database::makeSelectOptions code for list of * supported stuff - * @param $join_conds Associative array of table join conditions (optional) + * @param $join_conds array Associative array of table join conditions (optional) * (e.g. array( 'page' => array('LEFT JOIN', * 'page_latest=rev_id') ) * @return Mixed: database result resource for fetch functions or false @@ -1333,7 +1333,7 @@ class DatabaseIbm_db2 extends DatabaseBase { * * @private * - * @param $options Associative array of options to be turned into + * @param $options array Associative array of options to be turned into * an SQL query, valid keys are listed in the function. * @return Array */ diff --git a/includes/db/DatabaseMysql.php b/includes/db/DatabaseMysql.php index a23d9cd42c..6b5b6bc6b4 100644 --- a/includes/db/DatabaseMysql.php +++ b/includes/db/DatabaseMysql.php @@ -585,7 +585,7 @@ class DatabaseMysql extends DatabaseBase { /** * Get the position of the master from SHOW SLAVE STATUS * - * @return MySQLMasterPos|false + * @return MySQLMasterPos|bool */ function getSlavePos() { if ( !is_null( $this->mFakeSlaveLag ) ) { @@ -606,7 +606,7 @@ class DatabaseMysql extends DatabaseBase { /** * Get the position of the master from SHOW MASTER STATUS * - * @return MySQLMasterPos|false + * @return MySQLMasterPos|bool */ function getMasterPos() { if ( $this->mFakeMaster ) { diff --git a/includes/db/DatabaseSqlite.php b/includes/db/DatabaseSqlite.php index d266125634..23c7a6bf1d 100644 --- a/includes/db/DatabaseSqlite.php +++ b/includes/db/DatabaseSqlite.php @@ -617,7 +617,7 @@ class DatabaseSqlite extends DatabaseBase { * Get information about a given field * Returns false if the field does not exist. * - * @return SQLiteField|false + * @return SQLiteField|bool */ function fieldInfo( $table, $field ) { $tableName = $this->tableName( $table ); diff --git a/includes/db/LoadBalancer.php b/includes/db/LoadBalancer.php index e96c6720ea..5357eb49ba 100644 --- a/includes/db/LoadBalancer.php +++ b/includes/db/LoadBalancer.php @@ -385,7 +385,7 @@ class LoadBalancer { * Returns false if there is no connection open * * @param $i int - * @return DatabaseBase|false + * @return DatabaseBase|bool */ function getAnyOpenConnection( $i ) { foreach ( $this->mConns as $conns ) { diff --git a/includes/filerepo/FileRepo.php b/includes/filerepo/FileRepo.php index 1ccbd46c26..1242853dd0 100644 --- a/includes/filerepo/FileRepo.php +++ b/includes/filerepo/FileRepo.php @@ -295,7 +295,7 @@ class FileRepo { * private: If true, return restricted (deleted) files if the current * user is allowed to view them. Otherwise, such files will not * be found. - * @return File|false + * @return File|bool */ public function findFile( $title, $options = array() ) { $title = File::normalizeTitle( $title ); @@ -377,8 +377,8 @@ class FileRepo { * version control should return false if the time is specified. * * @param $sha1 String base 36 SHA-1 hash - * @param $options Option array, same as findFile(). - * @return File|false + * @param $options array Option array, same as findFile(). + * @return File|bool */ public function findFileFromKey( $sha1, $options = array() ) { $time = isset( $options['time'] ) ? $options['time'] : false; @@ -419,7 +419,7 @@ class FileRepo { /** * Get the public root URL of the repository * - * @return string|false + * @return string|bool */ public function getRootUrl() { return $this->url; @@ -531,7 +531,7 @@ class FileRepo { * * @param $query mixed Query string to append * @param $entry string Entry point; defaults to index - * @return string|false + * @return string|bool */ public function makeUrl( $query = '', $entry = 'index' ) { if ( isset( $this->scriptDirUrl ) ) { @@ -611,7 +611,7 @@ class FileRepo { /** * Get the URL of the stylesheet to apply to description pages * - * @return string|false + * @return string|bool */ public function getDescriptionStylesheetUrl() { if ( isset( $this->scriptDirUrl ) ) { @@ -1188,7 +1188,7 @@ class FileRepo { * Get the timestamp of a file with a given virtual URL/storage path * * @param $virtualUrl string - * @return string|false + * @return string|bool */ public function getFileTimestamp( $virtualUrl ) { $path = $this->resolveToStoragePath( $virtualUrl ); @@ -1199,7 +1199,7 @@ class FileRepo { * Get the sha1 of a file with a given virtual URL/storage path * * @param $virtualUrl string - * @return string|false + * @return string|bool */ public function getFileSha1( $virtualUrl ) { $path = $this->resolveToStoragePath( $virtualUrl ); diff --git a/includes/filerepo/RepoGroup.php b/includes/filerepo/RepoGroup.php index 334ef2b818..99c1115ee8 100644 --- a/includes/filerepo/RepoGroup.php +++ b/includes/filerepo/RepoGroup.php @@ -65,7 +65,7 @@ class RepoGroup { /** * Construct a group of file repositories. * - * @param $localInfo Associative array for local repo's info + * @param $localInfo array Associative array for local repo's info * @param $foreignInfo Array of repository info arrays. * Each info array is an associative array with the 'class' member * giving the class name. The entire array is passed to the repository diff --git a/includes/filerepo/backend/FileBackend.php b/includes/filerepo/backend/FileBackend.php index 13abcbcced..7cbfb919d6 100644 --- a/includes/filerepo/backend/FileBackend.php +++ b/includes/filerepo/backend/FileBackend.php @@ -406,7 +406,7 @@ abstract class FileBackend { * latest : use the latest available data * * @param $params Array - * @return string|false TS_MW timestamp or false on failure + * @return string|bool TS_MW timestamp or false on failure */ abstract public function getFileTimestamp( array $params ); @@ -419,7 +419,7 @@ abstract class FileBackend { * latest : use the latest available data * * @param $params Array - * @return string|false Returns false on failure + * @return string|bool Returns false on failure */ abstract public function getFileContents( array $params ); @@ -431,7 +431,7 @@ abstract class FileBackend { * latest : use the latest available data * * @param $params Array - * @return integer|false Returns false on failure + * @return integer|bool Returns false on failure */ abstract public function getFileSize( array $params ); @@ -448,7 +448,7 @@ abstract class FileBackend { * latest : use the latest available data * * @param $params Array - * @return Array|false|null Returns null on failure + * @return Array|bool|null Returns null on failure */ abstract public function getFileStat( array $params ); @@ -460,7 +460,7 @@ abstract class FileBackend { * latest : use the latest available data * * @param $params Array - * @return string|false Hash string or false on failure + * @return string|bool Hash string or false on failure */ abstract public function getFileSha1Base36( array $params ); diff --git a/includes/filerepo/backend/FileOp.php b/includes/filerepo/backend/FileOp.php index e51f5b1a27..300d513fb8 100644 --- a/includes/filerepo/backend/FileOp.php +++ b/includes/filerepo/backend/FileOp.php @@ -297,7 +297,7 @@ abstract class FileOp { * precheckDestExistence() helper function to get the source file SHA-1. * Subclasses should overwride this iff the source is not in storage. * - * @return string|false Returns false on failure + * @return string|bool Returns false on failure */ protected function getSourceSha1Base36() { return null; // N/A @@ -324,7 +324,7 @@ abstract class FileOp { * * @param $source string Storage path * @param $predicates Array - * @return string|false + * @return string|bool */ final protected function fileSha1( $source, array $predicates ) { if ( isset( $predicates['sha1'][$source] ) ) { diff --git a/includes/filerepo/backend/SwiftFileBackend.php b/includes/filerepo/backend/SwiftFileBackend.php index 2ad2d91ba0..b0a94c5c63 100644 --- a/includes/filerepo/backend/SwiftFileBackend.php +++ b/includes/filerepo/backend/SwiftFileBackend.php @@ -693,7 +693,7 @@ class SwiftFileBackend extends FileBackendStore { /** * Get a connection to the Swift proxy * - * @return CF_Connection|false + * @return CF_Connection|bool * @throws InvalidResponseException */ protected function getConnection() { diff --git a/includes/filerepo/backend/lockmanager/DBLockManager.php b/includes/filerepo/backend/lockmanager/DBLockManager.php index 045056ead6..8682eb687f 100644 --- a/includes/filerepo/backend/lockmanager/DBLockManager.php +++ b/includes/filerepo/backend/lockmanager/DBLockManager.php @@ -245,7 +245,7 @@ class DBLockManager extends LockManager { * Get (or reuse) a connection to a lock DB * * @param $lockDb string - * @return Database + * @return DatabaseBase * @throws DBError */ protected function getConnection( $lockDb ) { diff --git a/includes/filerepo/file/File.php b/includes/filerepo/file/File.php index 0be67e042d..5d5647e597 100644 --- a/includes/filerepo/file/File.php +++ b/includes/filerepo/file/File.php @@ -252,7 +252,7 @@ abstract class File { /** * Return the associated title object * - * @return Title|false + * @return Title|bool */ public function getTitle() { return $this->title; @@ -329,7 +329,7 @@ abstract class File { * Most callers don't check the return value, but ForeignAPIFile::getPath * returns false. * - * @return string|false + * @return string|bool */ public function getPath() { if ( !isset( $this->path ) ) { @@ -344,7 +344,7 @@ abstract class File { * Returns false on failure. Callers must not alter the file. * Temporary files are cleared automatically. * - * @return string|false + * @return string|bool */ public function getLocalRefPath() { $this->assertRepoDefined(); @@ -774,7 +774,7 @@ abstract class File { * @param $params Array: an associative array of handler-specific parameters. * Typical keys are width, height and page. * @param $flags Integer: a bitfield, may contain self::RENDER_NOW to force rendering - * @return MediaTransformOutput|false + * @return MediaTransformOutput|bool */ function transform( $params, $flags = 0 ) { global $wgUseSquid, $wgIgnoreImageErrors, $wgThumbnailEpoch; @@ -1329,7 +1329,7 @@ abstract class File { /** * Returns the repository * - * @return FileRepo|false + * @return FileRepo|bool */ function getRepo() { return $this->repo; @@ -1418,7 +1418,7 @@ abstract class File { * @param $versions array set of record ids of deleted items to restore, * or empty to restore all revisions. * @param $unsuppress bool remove restrictions on content upon restoration? - * @return int|false the number of file revisions restored if successful, + * @return int|bool the number of file revisions restored if successful, * or false on failure * STUB * Overridden by LocalFile @@ -1548,7 +1548,7 @@ abstract class File { /** * Get the 14-character timestamp of the file upload * - * @return string|false TS_MW timestamp or false on failure + * @return string|bool TS_MW timestamp or false on failure */ function getTimestamp() { $this->assertRepoDefined(); diff --git a/includes/filerepo/file/LocalFile.php b/includes/filerepo/file/LocalFile.php index 4c4e161743..bf0577164c 100644 --- a/includes/filerepo/file/LocalFile.php +++ b/includes/filerepo/file/LocalFile.php @@ -620,7 +620,7 @@ class LocalFile extends File { /** * Get all thumbnail names previously generated for this file - * @param $archiveName string|false Name of an archive file + * @param $archiveName string|bool Name of an archive file * @return array first element is the base dir, then files in that base dir. */ function getThumbnails( $archiveName = false ) { -- 2.20.1