From: Sam Reed Date: Thu, 9 Feb 2012 17:42:35 +0000 (+0000) Subject: Fixing some of the "@return true" or "@return false", need to be "@return bool" and... X-Git-Tag: 1.31.0-rc.0~24828 X-Git-Url: https://git.cyclocoop.org/%7B%24admin_url%7Dmembres/modifier.php?a=commitdiff_plain;h=138ddc452fc1fc4efb8464d27e2a71f21c516b9c;p=lhc%2Fweb%2Fwiklou.git 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 --- diff --git a/includes/Category.php b/includes/Category.php index 9d9b5a67ba..c51a7c46da 100644 --- a/includes/Category.php +++ b/includes/Category.php @@ -103,7 +103,7 @@ class Category { * Factory function. * * @param $title Title for the category page - * @return category|false on a totally invalid name + * @return Category|bool on a totally invalid name */ public static function newFromTitle( $title ) { $cat = new self(); @@ -185,7 +185,7 @@ class Category { public function getFileCount() { return $this->getX( 'mFiles' ); } /** - * @return Title|false Title for this category, or false on failure. + * @return Title|bool Title for this category, or false on failure. */ public function getTitle() { if ( $this->mTitle ) return $this->mTitle; diff --git a/includes/ExternalStore.php b/includes/ExternalStore.php index 3bee6ed8ba..f2eed4b3c5 100644 --- a/includes/ExternalStore.php +++ b/includes/ExternalStore.php @@ -24,7 +24,7 @@ class ExternalStore { * * @param $url String: The URL of the text to get * @param $params Array: associative array of parameters for the ExternalStore object. - * @return The text stored or false on error + * @return string|bool The text stored or false on error */ static function fetchFromURL( $url, $params = array() ) { global $wgExternalStores; @@ -81,7 +81,7 @@ class ExternalStore { * @param $url * @param $data * @param $params array - * @return string|false The URL of the stored data item, or false on error + * @return string|bool The URL of the stored data item, or false on error */ static function insert( $url, $data, $params = array() ) { list( $proto, $params ) = explode( '://', $url, 2 ); diff --git a/includes/ExternalUser.php b/includes/ExternalUser.php index 37716390a5..49d525f883 100644 --- a/includes/ExternalUser.php +++ b/includes/ExternalUser.php @@ -98,7 +98,7 @@ abstract class ExternalUser { * This is a wrapper around newFromId(). * * @param $user User - * @return ExternalUser|false + * @return ExternalUser|bool */ public static function newFromUser( $user ) { global $wgExternalAuthType; diff --git a/includes/HTMLForm.php b/includes/HTMLForm.php index 7326bf5c1e..a5ff8cd760 100644 --- a/includes/HTMLForm.php +++ b/includes/HTMLForm.php @@ -111,7 +111,7 @@ class HTMLForm extends ContextSource { /** * Form action URL. false means we will use the URL to set Title * @since 1.19 - * @var false|string + * @var bool|string */ protected $mAction = false; diff --git a/includes/api/ApiBase.php b/includes/api/ApiBase.php index e67ac052e3..5a7ae268b8 100644 --- a/includes/api/ApiBase.php +++ b/includes/api/ApiBase.php @@ -512,7 +512,7 @@ abstract class ApiBase extends ContextSource { /** * Returns usage examples for this module. Return false if no examples are available. - * @return false|string|array + * @return bool|string|array */ protected function getExamples() { return false; @@ -1372,7 +1372,7 @@ abstract class ApiBase extends ContextSource { } /** - * @return false|string|array Returns a false if the module has no help url, else returns a (array of) string + * @return bool|string|array Returns a false if the module has no help url, else returns a (array of) string */ public function getHelpUrls() { return false; diff --git a/includes/api/ApiQuery.php b/includes/api/ApiQuery.php index cd54a7daf7..5a98ecf197 100644 --- a/includes/api/ApiQuery.php +++ b/includes/api/ApiQuery.php @@ -154,7 +154,7 @@ class ApiQuery 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 getNamedDB( $name, $db, $groups ) { if ( !array_key_exists( $name, $this->mNamedDB ) ) { diff --git a/includes/cache/FileCacheBase.php b/includes/cache/FileCacheBase.php index 37401655c6..70bb221656 100644 --- a/includes/cache/FileCacheBase.php +++ b/includes/cache/FileCacheBase.php @@ -74,7 +74,7 @@ abstract class FileCacheBase { /** * Get the last-modified timestamp of the cache file - * @return string|false TS_MW timestamp + * @return string|bool TS_MW timestamp */ public function cacheTimestamp() { $timestamp = filemtime( $this->cachePath() ); diff --git a/includes/cache/MessageCache.php b/includes/cache/MessageCache.php index 6b53db0f54..78342f5549 100644 --- a/includes/cache/MessageCache.php +++ b/includes/cache/MessageCache.php @@ -126,7 +126,7 @@ class MessageCache { * * @param $hash String: the hash of contents, to check validity. * @param $code Mixed: Optional language code, see documenation of load(). - * @return false on failure. + * @return bool on failure. */ function loadFromLocal( $hash, $code ) { global $wgCacheDirectory, $wgLocalMessageCacheSerialized; @@ -520,7 +520,7 @@ class MessageCache { * @param $cache Array: cached messages with a version. * @param $memc Bool: Wether to update or not memcache. * @param $code String: Language code. - * @return False on somekind of error. + * @return bool on somekind of error. */ protected function saveToCaches( $cache, $memc = true, $code = false ) { wfProfileIn( __METHOD__ ); diff --git a/includes/db/Database.php b/includes/db/Database.php index 29523b3da0..2c9a128564 100644 --- a/includes/db/Database.php +++ b/includes/db/Database.php @@ -1093,7 +1093,7 @@ abstract class DatabaseBase implements DatabaseType { * @param $fname string The function name of the caller. * @param $options string|array The query options. See DatabaseBase::select() for details. * - * @return false|mixed The value from the field, or false on failure. + * @return bool|mixed The value from the field, or false on failure. */ function selectField( $table, $var, $cond = '', $fname = 'DatabaseBase::selectField', $options = array() ) diff --git a/includes/db/DatabaseIbm_db2.php b/includes/db/DatabaseIbm_db2.php index fed3b12e11..7aefd5900e 100644 --- a/includes/db/DatabaseIbm_db2.php +++ b/includes/db/DatabaseIbm_db2.php @@ -122,7 +122,7 @@ class IBM_DB2Result{ /** * Construct and initialize a wrapper for DB2 query results - * @param $db Database + * @param $db DatabaseBase * @param $result Object * @param $num_rows Integer * @param $sql String diff --git a/includes/db/DatabaseMysql.php b/includes/db/DatabaseMysql.php index c179b7244b..a23d9cd42c 100644 --- a/includes/db/DatabaseMysql.php +++ b/includes/db/DatabaseMysql.php @@ -385,7 +385,7 @@ class DatabaseMysql extends DatabaseBase { * @param $table string * @param $index string * @param $fname string - * @return false|array + * @return bool|array */ function indexInfo( $table, $index, $fname = 'DatabaseMysql::indexInfo' ) { # SHOW INDEX works in MySQL 3.23.58, but SHOW INDEXES does not. diff --git a/includes/db/DatabaseSqlite.php b/includes/db/DatabaseSqlite.php index b2eb1c6bd8..d266125634 100644 --- a/includes/db/DatabaseSqlite.php +++ b/includes/db/DatabaseSqlite.php @@ -88,7 +88,7 @@ class DatabaseSqlite extends DatabaseBase { * * @param $fileName string * - * @return PDO|false SQL connection or false if failed + * @return PDO|bool SQL connection or false if failed */ function openFile( $fileName ) { $this->mDatabaseFile = $fileName; @@ -140,7 +140,7 @@ class DatabaseSqlite extends DatabaseBase { /** * Check if the searchindext table is FTS enabled. - * @return false if not enabled. + * @return bool if not enabled. */ function checkForEnabledSearch() { if ( self::$fulltextEnabled === null ) { diff --git a/includes/filerepo/backend/FSFile.php b/includes/filerepo/backend/FSFile.php index 54dd135996..5d2bb52154 100644 --- a/includes/filerepo/backend/FSFile.php +++ b/includes/filerepo/backend/FSFile.php @@ -45,7 +45,7 @@ class FSFile { /** * Get the file size in bytes * - * @return int|false + * @return int|bool */ public function getSize() { return filesize( $this->path ); @@ -54,7 +54,7 @@ class FSFile { /** * Get the file's last-modified timestamp * - * @return string|false TS_MW timestamp or false on failure + * @return string|bool TS_MW timestamp or false on failure */ public function getTimestamp() { wfSuppressWarnings(); @@ -174,7 +174,7 @@ class FSFile { * 160 log 2 / log 36 = 30.95, so the 160-bit hash fills 31 digits in base 36 * fairly neatly. * - * @return false|string False on failure + * @return bool|string False on failure */ public function getSha1Base36() { wfProfileIn( __METHOD__ ); @@ -224,7 +224,7 @@ class FSFile { * * @param $path string * - * @return false|string False on failure + * @return bool|string False on failure */ public static function getSha1Base36FromPath( $path ) { $fsFile = new self( $path ); diff --git a/includes/filerepo/backend/FileBackend.php b/includes/filerepo/backend/FileBackend.php index f44066fbc7..f1e8c84e44 100644 --- a/includes/filerepo/backend/FileBackend.php +++ b/includes/filerepo/backend/FileBackend.php @@ -96,7 +96,7 @@ abstract class FileBackend { /** * Get an explanatory message if this backend is read-only * - * @return string|false Returns falls if the backend is not read-only + * @return string|bool Returns falls if the backend is not read-only */ final public function getReadOnlyReason() { return ( $this->readOnly != '' ) ? $this->readOnly : false; diff --git a/includes/filerepo/backend/lockmanager/LSLockManager.php b/includes/filerepo/backend/lockmanager/LSLockManager.php index b7ac743cf0..c1b741fde8 100644 --- a/includes/filerepo/backend/lockmanager/LSLockManager.php +++ b/includes/filerepo/backend/lockmanager/LSLockManager.php @@ -175,7 +175,7 @@ class LSLockManager extends LockManager { * @param $action string * @param $type string * @param $values Array - * @return string|false + * @return string|bool */ protected function sendCommand( $lockSrv, $action, $type, $values ) { $conn = $this->getConnection( $lockSrv ); diff --git a/includes/filerepo/file/ArchivedFile.php b/includes/filerepo/file/ArchivedFile.php index 3b9bd7f0c2..2b43273fb9 100644 --- a/includes/filerepo/file/ArchivedFile.php +++ b/includes/filerepo/file/ArchivedFile.php @@ -93,7 +93,7 @@ class ArchivedFile { /** * Loads a file object from the filearchive table - * @return true on success or null + * @return bool on success or null */ public function load() { if ( $this->dataLoaded ) { diff --git a/includes/filerepo/file/File.php b/includes/filerepo/file/File.php index f74fb678f1..0be67e042d 100644 --- a/includes/filerepo/file/File.php +++ b/includes/filerepo/file/File.php @@ -68,19 +68,19 @@ abstract class File { */ /** - * @var FileRepo|false + * @var FileRepo|bool */ var $repo; /** - * @var Title|false + * @var Title|bool */ var $title; var $lastError, $redirected, $redirectedTitle; /** - * @var FSFile|false + * @var FSFile|bool */ protected $fsFile; @@ -111,8 +111,8 @@ abstract class File { * may return false or throw exceptions if they are not set. * Most subclasses will want to call assertRepoDefined() here. * - * @param $title Title|string|false - * @param $repo FileRepo|false + * @param $title Title|string|bool + * @param $repo FileRepo|bool */ function __construct( $title, $repo ) { if ( $title !== false ) { // subclasses may not use MW titles @@ -127,7 +127,7 @@ abstract class File { * valid Title object with namespace NS_FILE or null * * @param $title Title|string - * @param $exception string|false Use 'exception' to throw an error on bad titles + * @param $exception string|bool Use 'exception' to throw an error on bad titles * @return Title|null */ static function normalizeTitle( $title, $exception = false ) { @@ -383,7 +383,7 @@ abstract class File { * * @param $page int * - * @return false|number + * @return bool|number */ public function getHeight( $page = 1 ) { return false; @@ -1401,7 +1401,7 @@ abstract class File { * * @param $reason String * @param $suppress Boolean: hide content from sysops? - * @return true on success, false on some kind of failure + * @return bool on success, false on some kind of failure * STUB * Overridden by LocalFile */ @@ -1442,7 +1442,7 @@ abstract class File { * Returns the number of pages of a multipage document, or false for * documents which aren't multipage documents * - * @return false|int + * @return bool|int */ function pageCount() { if ( !isset( $this->pageCount ) ) { @@ -1618,7 +1618,7 @@ abstract class File { * * @param $path string * - * @return false|string False on failure + * @return bool|string False on failure */ static function sha1Base36( $path ) { wfDeprecated( __METHOD__, '1.19' ); diff --git a/includes/filerepo/file/UnregisteredLocalFile.php b/includes/filerepo/file/UnregisteredLocalFile.php index cd9d3d028d..7c5eab03dd 100644 --- a/includes/filerepo/file/UnregisteredLocalFile.php +++ b/includes/filerepo/file/UnregisteredLocalFile.php @@ -49,7 +49,7 @@ class UnregisteredLocalFile extends File { * A FileRepo object is not required here, unlike most other File classes. * * @throws MWException - * @param $title Title|false + * @param $title Title|bool * @param $repo FileRepo * @param $path string * @param $mime string diff --git a/includes/installer/DatabaseInstaller.php b/includes/installer/DatabaseInstaller.php index b086478bd3..33327ef7a2 100644 --- a/includes/installer/DatabaseInstaller.php +++ b/includes/installer/DatabaseInstaller.php @@ -50,7 +50,7 @@ abstract class DatabaseInstaller { public abstract function getName(); /** - * @return true if the client library is compiled in. + * @return bool Returns true if the client library is compiled in. */ public abstract function isCompiled(); diff --git a/includes/job/DoubleRedirectJob.php b/includes/job/DoubleRedirectJob.php index 2b7cd7c8f8..2a14445c63 100644 --- a/includes/job/DoubleRedirectJob.php +++ b/includes/job/DoubleRedirectJob.php @@ -139,7 +139,7 @@ class DoubleRedirectJob extends Job { * * @param $title Title * - * @return false if the specified title is not a redirect, or if it is a circular redirect + * @return bool if the specified title is not a redirect, or if it is a circular redirect */ public static function getFinalDestination( $title ) { $dbw = wfGetDB( DB_MASTER );