From 76246b9bf545d75e6d5fa53f4908199c3a11bbc3 Mon Sep 17 00:00:00 2001 From: Sam Reed Date: Thu, 9 Feb 2012 21:33:27 +0000 Subject: [PATCH] More return documentation --- includes/Action.php | 1 + includes/AjaxResponse.php | 1 + includes/Article.php | 1 + includes/AuthPlugin.php | 1 + includes/BacklinkCache.php | 2 ++ includes/Category.php | 5 ++- includes/CategoryPage.php | 1 + includes/CategoryViewer.php | 3 +- includes/ChangesList.php | 5 +++ includes/ConfEditor.php | 12 +++++++ includes/Cookie.php | 2 ++ includes/Export.php | 3 ++ includes/ExternalStoreDB.php | 1 + includes/Feed.php | 1 + includes/FeedUtils.php | 1 + includes/FileDeleteForm.php | 1 + includes/ForkController.php | 1 + includes/FormOptions.php | 10 ++++-- includes/GlobalFunctions.php | 36 +++++++++++++++---- includes/HttpFunctions.php | 1 + includes/ImageGallery.php | 2 ++ includes/ImagePage.php | 1 + includes/Import.php | 1 + includes/actions/HistoryAction.php | 1 + includes/api/ApiUpload.php | 8 +++-- includes/cache/MessageCache.php | 1 + includes/db/Database.php | 1 + includes/db/DatabaseIbm_db2.php | 18 +++++++++- includes/db/DatabaseMssql.php | 15 ++++++++ includes/db/DatabaseOracle.php | 8 +++++ includes/db/DatabasePostgres.php | 13 +++++++ includes/db/DatabaseSqlite.php | 2 ++ includes/debug/Debug.php | 1 + includes/diff/DifferenceEngine.php | 3 ++ includes/filerepo/FileRepo.php | 4 +++ includes/filerepo/ForeignAPIRepo.php | 12 +++++-- includes/filerepo/ForeignDBRepo.php | 1 + includes/filerepo/ForeignDBViaLBRepo.php | 1 + includes/filerepo/LocalRepo.php | 3 ++ includes/filerepo/RepoGroup.php | 4 +++ includes/filerepo/backend/FSFileBackend.php | 14 ++++++++ includes/filerepo/backend/FileBackend.php | 24 ++++++++++++- .../backend/FileBackendMultiWrite.php | 4 +++ .../filerepo/backend/SwiftFileBackend.php | 15 ++++++++ .../backend/lockmanager/DBLockManager.php | 2 ++ includes/filerepo/file/File.php | 8 +++++ includes/filerepo/file/ForeignAPIFile.php | 2 ++ includes/filerepo/file/LocalFile.php | 21 +++++++++++ includes/filerepo/file/OldLocalFile.php | 1 + 49 files changed, 262 insertions(+), 18 deletions(-) diff --git a/includes/Action.php b/includes/Action.php index 328ce977ea..66f3513589 100644 --- a/includes/Action.php +++ b/includes/Action.php @@ -501,6 +501,7 @@ abstract class FormlessAction extends Action { /** * We don't want an HTMLForm + * @return bool */ protected function getFormFields() { return false; diff --git a/includes/AjaxResponse.php b/includes/AjaxResponse.php index 31d9478f3f..e9463972fb 100644 --- a/includes/AjaxResponse.php +++ b/includes/AjaxResponse.php @@ -141,6 +141,7 @@ class AjaxResponse { * possible. If sucessful, the AjaxResponse is disabled so that * any future call to AjaxResponse::printText() have no effect. The method * returns true iff the response code was set to 304 Not Modified. + * @return bool */ function checkLastModified ( $timestamp ) { global $wgCachePages, $wgCacheEpoch, $wgUser; diff --git a/includes/Article.php b/includes/Article.php index b21f71fecc..636115543a 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -1770,6 +1770,7 @@ class Article extends Page { * * @param $fname String Name of called method * @param $args Array Arguments to the method + * @return mixed */ public function __call( $fname, $args ) { if ( is_callable( array( $this->mPage, $fname ) ) ) { diff --git a/includes/AuthPlugin.php b/includes/AuthPlugin.php index 2fdba79718..07a614aeff 100644 --- a/includes/AuthPlugin.php +++ b/includes/AuthPlugin.php @@ -103,6 +103,7 @@ class AuthPlugin { * forget the & on your function declaration. * * @param $user User object + * @return bool */ public function updateUser( &$user ) { # Override this and do something diff --git a/includes/BacklinkCache.php b/includes/BacklinkCache.php index 152c5f033d..c028352b32 100644 --- a/includes/BacklinkCache.php +++ b/includes/BacklinkCache.php @@ -179,6 +179,7 @@ class BacklinkCache { /** * Get the field name prefix for a given table * @param $table String + * @return null|string */ protected function getPrefix( $table ) { static $prefixes = array( @@ -206,6 +207,7 @@ class BacklinkCache { * Get the SQL condition array for selecting backlinks, with a join * on the page table. * @param $table String + * @return array|null */ protected function getConditions( $table ) { $prefix = $this->getPrefix( $table ); diff --git a/includes/Category.php b/includes/Category.php index c51a7c46da..0be4830e97 100644 --- a/includes/Category.php +++ b/includes/Category.php @@ -231,7 +231,10 @@ class Category { ); } - /** Generic accessor */ + /** + * Generic accessor + * @return bool + */ private function getX( $key ) { if ( !$this->initialize() ) { return false; diff --git a/includes/CategoryPage.php b/includes/CategoryPage.php index eab7a35685..3c7d89e250 100644 --- a/includes/CategoryPage.php +++ b/includes/CategoryPage.php @@ -29,6 +29,7 @@ class CategoryPage extends Article { /** * Constructor from a page id * @param $id Int article ID to load + * @return CategoryPage|null */ public static function newFromID( $id ) { $t = Title::newFromID( $id ); diff --git a/includes/CategoryViewer.php b/includes/CategoryViewer.php index e8e9142352..dff38028cd 100644 --- a/includes/CategoryViewer.php +++ b/includes/CategoryViewer.php @@ -172,7 +172,8 @@ class CategoryViewer extends ContextSource { * * @param Title $title * @param string $sortkey The human-readable sortkey (before transforming to icu or whatever). - */ + * @return string + */ function getSubcategorySortChar( $title, $sortkey ) { global $wgContLang; diff --git a/includes/ChangesList.php b/includes/ChangesList.php index ff07969816..8a1f375285 100644 --- a/includes/ChangesList.php +++ b/includes/ChangesList.php @@ -364,6 +364,7 @@ class ChangesList extends ContextSource { * Insert a formatted action * * @param $rc RecentChange + * @return string */ public function insertLogEntry( $rc ) { $formatter = LogFormatter::newFromRow( $rc->mAttribs ); @@ -375,6 +376,7 @@ class ChangesList extends ContextSource { /** * Insert a formatted comment * @param $rc RecentChange + * @return string */ public function insertComment( $rc ) { if( $rc->mAttribs['rc_type'] != RC_MOVE && $rc->mAttribs['rc_type'] != RC_MOVE_OVER_REDIRECT ) { @@ -397,6 +399,7 @@ class ChangesList extends ContextSource { /** * Returns the string which indicates the number of watching users + * @return string */ protected function numberofWatchingusers( $count ) { static $cache = array(); @@ -514,6 +517,7 @@ class OldChangesList extends ChangesList { * Format a line using the old system (aka without any javascript). * * @param $rc RecentChange + * @return string */ public function recentChangesLine( &$rc, $watched = false, $linenumber = null ) { global $wgRCShowChangedSize; @@ -779,6 +783,7 @@ class EnhancedChangesList extends ChangesList { /** * Enhanced RC group + * @return string */ protected function recentChangesBlockGroup( $block ) { global $wgRCShowChangedSize; diff --git a/includes/ConfEditor.php b/includes/ConfEditor.php index 42a7173d5e..4aecb3d0ac 100644 --- a/includes/ConfEditor.php +++ b/includes/ConfEditor.php @@ -139,6 +139,7 @@ class ConfEditor { * insert * Insert a new element at the start of the array. * + * @return string */ public function edit( $ops ) { $this->parse(); @@ -371,6 +372,7 @@ class ConfEditor { * Finds the source byte region which you would want to delete, if $pathName * was to be deleted. Includes the leading spaces and tabs, the trailing line * break, and any comments in between. + * @return array */ function findDeletionRegion( $pathName ) { if ( !isset( $this->pathInfo[$pathName] ) ) { @@ -428,6 +430,7 @@ class ConfEditor { * or semicolon. * * The end position is the past-the-end (end + 1) value as per convention. + * @return array */ function findValueRegion( $pathName ) { if ( !isset( $this->pathInfo[$pathName] ) ) { @@ -444,6 +447,7 @@ class ConfEditor { * Find the path name of the last element in the array. * If the array is empty, this will return the \@extra interstitial element. * If the specified path is not found or is not an array, it will return false. + * @return bool|int|string */ function findLastArrayElement( $path ) { // Try for a real element @@ -480,6 +484,7 @@ class ConfEditor { * Find the path name of first element in the array. * If the array is empty, this will return the \@extra interstitial element. * If the specified path is not found or is not an array, it will return false. + * @return bool|int|string */ function findFirstArrayElement( $path ) { // Try for an ordinary element @@ -504,6 +509,7 @@ class ConfEditor { /** * Get the indent string which sits after a given start position. * Returns false if the position is not at the start of the line. + * @return array */ function getIndent( $pos, $key = false, $arrowPos = false ) { $arrowIndent = ' '; @@ -725,6 +731,7 @@ class ConfEditor { /** * Create a ConfEditorToken from an element of token_get_all() + * @return \ConfEditorToken */ function newTokenObj( $internalToken ) { if ( is_array( $internalToken ) ) { @@ -776,6 +783,7 @@ class ConfEditor { /** * Get the token $offset steps ahead of the current position. * $offset may be negative, to get tokens behind the current position. + * @return \ConfEditorToken */ function getTokenAhead( $offset ) { $pos = $this->pos + $offset; @@ -821,6 +829,7 @@ class ConfEditor { /** * Pop a state from the state stack. + * @return mixed */ function popState() { return array_pop( $this->stateStack ); @@ -829,6 +838,7 @@ class ConfEditor { /** * Returns true if the user input path is valid. * This exists to allow "/" and "@" to be reserved for string path keys + * @return bool */ function validatePath( $path ) { return strpos( $path, '/' ) === false && substr( $path, 0, 1 ) != '@'; @@ -949,6 +959,7 @@ class ConfEditor { /** * Get a readable name for the given token type. + * @return string */ function getTypeName( $type ) { if ( is_int( $type ) ) { @@ -962,6 +973,7 @@ class ConfEditor { * Looks ahead to see if the given type is the next token type, starting * from the current position plus the given offset. Skips any intervening * whitespace. + * @return bool */ function isAhead( $type, $offset = 0 ) { $ahead = $offset; diff --git a/includes/Cookie.php b/includes/Cookie.php index 76739ccc39..b76212ecbf 100644 --- a/includes/Cookie.php +++ b/includes/Cookie.php @@ -193,6 +193,7 @@ class CookieJar { /** * @see Cookie::serializeToHttpRequest + * @return string */ public function serializeToHttpRequest( $path, $domain ) { $cookies = array(); @@ -213,6 +214,7 @@ class CookieJar { * * @param $cookie String * @param $domain String: cookie's domain + * @return null */ public function parseCookieResponseHeader ( $cookie, $domain ) { $len = strlen( 'Set-Cookie:' ); diff --git a/includes/Export.php b/includes/Export.php index 7773d03c29..73fa39ea26 100644 --- a/includes/Export.php +++ b/includes/Export.php @@ -507,6 +507,7 @@ class XmlDumpWriter { * Closes a section on the output stream. * * @access private + * @return string */ function closePage() { return " \n"; @@ -633,6 +634,7 @@ class XmlDumpWriter { /** * Warning! This data is potentially inconsistent. :( + * @return string */ function writeUploads( $row, $dumpContents = false ) { if ( $row->page_namespace == NS_IMAGE ) { @@ -773,6 +775,7 @@ class DumpOutput { /** * Returns the name of the file or files which are * being written to, if there are any. + * @return null */ function getFilenames() { return NULL; diff --git a/includes/ExternalStoreDB.php b/includes/ExternalStoreDB.php index 4920a91ce3..e11a53db53 100644 --- a/includes/ExternalStoreDB.php +++ b/includes/ExternalStoreDB.php @@ -73,6 +73,7 @@ class ExternalStoreDB { /** * Fetch data from given URL * @param $url String: an url of the form DB://cluster/id or DB://cluster/id/itemid for concatened storage. + * @return mixed */ function fetchFromURL( $url ) { $path = explode( '/', $url ); diff --git a/includes/Feed.php b/includes/Feed.php index 351f35729d..950b437832 100644 --- a/includes/Feed.php +++ b/includes/Feed.php @@ -334,6 +334,7 @@ class RSSFeed extends ChannelFeed { class AtomFeed extends ChannelFeed { /** * @todo document + * @return string */ function formatTime( $ts ) { // need to use RFC 822 time format at least for rss2.0 diff --git a/includes/FeedUtils.php b/includes/FeedUtils.php index cf42329b72..0e1c8f1842 100644 --- a/includes/FeedUtils.php +++ b/includes/FeedUtils.php @@ -165,6 +165,7 @@ class FeedUtils { * @param $title Title object: used to generate the diff URL * @param $newid Integer newid for this diff * @param $oldid Integer|null oldid for the diff. Null means it is a new article + * @return string */ protected static function getDiffLink( Title $title, $newid, $oldid = null ) { $queryParameters = ($oldid == null) diff --git a/includes/FileDeleteForm.php b/includes/FileDeleteForm.php index 11f9aea518..661edaa790 100644 --- a/includes/FileDeleteForm.php +++ b/includes/FileDeleteForm.php @@ -122,6 +122,7 @@ class FileDeleteForm { * @param $reason String: reason of the deletion * @param $suppress Boolean: whether to mark all deleted versions as restricted * @param $user User object performing the request + * @return bool|Status */ public static function doDelete( &$title, &$file, &$oldimage, $reason, $suppress, User $user = null ) { if ( $user === null ) { diff --git a/includes/ForkController.php b/includes/ForkController.php index 9cacef5497..2ada714183 100644 --- a/includes/ForkController.php +++ b/includes/ForkController.php @@ -49,6 +49,7 @@ class ForkController { * This will return 'child' in the child processes. In the parent process, * it will run until all the child processes exit or a TERM signal is * received. It will then return 'done'. + * @return string */ public function start() { // Trap SIGTERM diff --git a/includes/FormOptions.php b/includes/FormOptions.php index 50068fc9f1..d1a5fd3e47 100644 --- a/includes/FormOptions.php +++ b/includes/FormOptions.php @@ -291,11 +291,17 @@ class FormOptions implements ArrayAccess { * @see http://php.net/manual/en/class.arrayaccess.php */ /* @{ */ - /** Whether option exist*/ + /** + * Whether option exist + * @return bool + */ public function offsetExists( $name ) { return isset( $this->options[$name] ); } - /** Retrieve an option value */ + /** + * Retrieve an option value + * @return Mixed + */ public function offsetGet( $name ) { return $this->getValue( $name ); } diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 7ef6f32d40..dca4e141f9 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -20,33 +20,48 @@ if ( !defined( 'MEDIAWIKI' ) ) { */ if( !function_exists( 'iconv' ) ) { - /** @codeCoverageIgnore */ + /** + * @codeCoverageIgnore + * @return string + */ function iconv( $from, $to, $string ) { return Fallback::iconv( $from, $to, $string ); } } if ( !function_exists( 'mb_substr' ) ) { - /** @codeCoverageIgnore */ + /** + * @codeCoverageIgnore + * @return string + */ function mb_substr( $str, $start, $count='end' ) { return Fallback::mb_substr( $str, $start, $count ); } - /** @codeCoverageIgnore */ + /** + * @codeCoverageIgnore + * @return int + */ function mb_substr_split_unicode( $str, $splitPos ) { return Fallback::mb_substr_split_unicode( $str, $splitPos ); } } if ( !function_exists( 'mb_strlen' ) ) { - /** @codeCoverageIgnore */ + /** + * @codeCoverageIgnore + * @return int + */ function mb_strlen( $str, $enc = '' ) { return Fallback::mb_strlen( $str, $enc ); } } if( !function_exists( 'mb_strpos' ) ) { - /** @codeCoverageIgnore */ + /** + * @codeCoverageIgnore + * @return int + */ function mb_strpos( $haystack, $needle, $offset = 0, $encoding = '' ) { return Fallback::mb_strpos( $haystack, $needle, $offset, $encoding ); } @@ -54,7 +69,10 @@ if( !function_exists( 'mb_strpos' ) ) { } if( !function_exists( 'mb_strrpos' ) ) { - /** @codeCoverageIgnore */ + /** + * @codeCoverageIgnore + * @return int + */ function mb_strrpos( $haystack, $needle, $offset = 0, $encoding = '' ) { return Fallback::mb_strrpos( $haystack, $needle, $offset, $encoding ); } @@ -63,7 +81,10 @@ if( !function_exists( 'mb_strrpos' ) ) { // Support for Wietse Venema's taint feature if ( !function_exists( 'istainted' ) ) { - /** @codeCoverageIgnore */ + /** + * @codeCoverageIgnore + * @return int + */ function istainted( $var ) { return 0; } @@ -885,6 +906,7 @@ function wfDebug( $text, $logonly = false ) { /** * Returns true if debug logging should be suppressed if $wgDebugRawPage = false + * @return bool */ function wfIsDebugRawPage() { static $cache; diff --git a/includes/HttpFunctions.php b/includes/HttpFunctions.php index 8a8249aac9..4f720e95d2 100644 --- a/includes/HttpFunctions.php +++ b/includes/HttpFunctions.php @@ -376,6 +376,7 @@ class MWHttpRequest { * * @param $fh handle * @param $content String + * @return int */ public function read( $fh, $content ) { $this->content .= $content; diff --git a/includes/ImageGallery.php b/includes/ImageGallery.php index a3c6e0de08..5a8fb8e4f8 100644 --- a/includes/ImageGallery.php +++ b/includes/ImageGallery.php @@ -168,6 +168,7 @@ class ImageGallery { /** * isEmpty() returns true if the gallery contains no images + * @return bool */ function isEmpty() { return empty( $this->mImages ); @@ -215,6 +216,7 @@ class ImageGallery { * - the additional text provided when adding the image * - the size of the image * + * @return string */ function toHTML() { global $wgLang; diff --git a/includes/ImagePage.php b/includes/ImagePage.php index e1cc6e75f2..cc2d5dfc40 100644 --- a/includes/ImagePage.php +++ b/includes/ImagePage.php @@ -30,6 +30,7 @@ class ImagePage extends Article { /** * Constructor from a page id * @param $id Int article ID to load + * @returnImagePage|null */ public static function newFromID( $id ) { $t = Title::newFromID( $id ); diff --git a/includes/Import.php b/includes/Import.php index d53810b54c..497f46ca82 100644 --- a/includes/Import.php +++ b/includes/Import.php @@ -396,6 +396,7 @@ class WikiImporter { /** * Primary entry point + * @return bool */ public function doImport() { $this->reader->read(); diff --git a/includes/actions/HistoryAction.php b/includes/actions/HistoryAction.php index 254a5db4ea..d64d3cb4bc 100644 --- a/includes/actions/HistoryAction.php +++ b/includes/actions/HistoryAction.php @@ -782,6 +782,7 @@ class HistoryPager extends ReverseChronologicalPager { /** * Get the "prevent clickjacking" flag + * @return bool */ function getPreventClickjacking() { return $this->preventClickjacking; diff --git a/includes/api/ApiUpload.php b/includes/api/ApiUpload.php index fdc1eff080..9136e8ceaa 100644 --- a/includes/api/ApiUpload.php +++ b/includes/api/ApiUpload.php @@ -113,6 +113,7 @@ class ApiUpload extends ApiBase { } /** * Get an uplaod result based on upload context + * @return array */ private function getContextResult(){ $warnings = $this->getApiWarnings(); @@ -131,7 +132,8 @@ class ApiUpload extends ApiBase { return $this->performUpload(); } /** - * Get Stash Result, throws an expetion if the file could not be stashed. + * Get Stash Result, throws an expetion if the file could not be stashed. + * @return array */ private function getStashResult(){ $result = array (); @@ -149,6 +151,7 @@ class ApiUpload extends ApiBase { /** * Get Warnings Result * @param $warnings Array of Api upload warnings + * @return array */ private function getWarningsResult( $warnings ){ $result = array(); @@ -165,7 +168,8 @@ class ApiUpload extends ApiBase { return $result; } /** - * Get the result of a chunk upload. + * Get the result of a chunk upload. + * @return array */ private function getChunkResult(){ $result = array(); diff --git a/includes/cache/MessageCache.php b/includes/cache/MessageCache.php index 88933732fe..424b3fdc89 100644 --- a/includes/cache/MessageCache.php +++ b/includes/cache/MessageCache.php @@ -260,6 +260,7 @@ class MessageCache { * is disabled. * * @param $code String: language to which load messages + * @return bool */ function load( $code = false ) { global $wgUseLocalMessageCache; diff --git a/includes/db/Database.php b/includes/db/Database.php index 205409f53e..7cc9328e3e 100644 --- a/includes/db/Database.php +++ b/includes/db/Database.php @@ -641,6 +641,7 @@ abstract class DatabaseBase implements DatabaseType { * Same as new factory( ... ), kept for backward compatibility * @deprecated since 1.18 * @see Database::factory() + * @return DatabaseBase */ public final static function newFromType( $dbType, $p = array() ) { wfDeprecated( __METHOD__, '1.18' ); diff --git a/includes/db/DatabaseIbm_db2.php b/includes/db/DatabaseIbm_db2.php index 613e348b58..e524752ce8 100644 --- a/includes/db/DatabaseIbm_db2.php +++ b/includes/db/DatabaseIbm_db2.php @@ -313,6 +313,7 @@ class DatabaseIbm_db2 extends DatabaseBase { /** * Returns true if this database supports (and uses) cascading deletes + * @return bool */ function cascadingDeletes() { return true; @@ -321,6 +322,7 @@ class DatabaseIbm_db2 extends DatabaseBase { /** * Returns true if this database supports (and uses) triggers (e.g. on the * page table) + * @return bool */ function cleanupTriggers() { return true; @@ -330,6 +332,7 @@ class DatabaseIbm_db2 extends DatabaseBase { * Returns true if this database is strict about what can be put into an * IP field. * Specifically, it uses a NULL value instead of an empty string. + * @return bool */ function strictIPs() { return true; @@ -337,13 +340,15 @@ class DatabaseIbm_db2 extends DatabaseBase { /** * Returns true if this database uses timestamps rather than integers - */ + * @return bool + */ function realTimestamps() { return true; } /** * Returns true if this database does an implicit sort when doing GROUP BY + * @return bool */ function implicitGroupby() { return false; @@ -353,6 +358,7 @@ class DatabaseIbm_db2 extends DatabaseBase { * Returns true if this database does an implicit order by when the column * has an index * For example: SELECT page_title FROM page LIMIT 1 + * @return bool */ function implicitOrderby() { return false; @@ -361,6 +367,7 @@ class DatabaseIbm_db2 extends DatabaseBase { /** * Returns true if this database can do a native search on IP columns * e.g. this works as expected: .. WHERE rc_ip = '127.42.12.102/32'; + * @return bool */ function searchableIPs() { return true; @@ -368,6 +375,7 @@ class DatabaseIbm_db2 extends DatabaseBase { /** * Returns true if this database can use functional indexes + * @return bool */ function functionalIndexes() { return true; @@ -375,6 +383,7 @@ class DatabaseIbm_db2 extends DatabaseBase { /** * Returns a unique string representing the wiki on the server + * @return string */ public function getWikiID() { if( $this->mSchema ) { @@ -546,6 +555,7 @@ class DatabaseIbm_db2 extends DatabaseBase { /** * Closes a database connection, if it is open * Returns success, true if already closed + * @return bool */ public function close() { $this->mOpened = false; @@ -562,6 +572,7 @@ class DatabaseIbm_db2 extends DatabaseBase { /** * Retrieves the most current database error * Forces a database rollback + * @return bool|string */ public function lastError() { $connerr = db2_conn_errormsg(); @@ -836,6 +847,7 @@ class DatabaseIbm_db2 extends DatabaseBase { * LIST_SET - comma separated with field names, like a SET clause * LIST_NAMES - comma separated field names * LIST_SET_PREPARED - like LIST_SET, except with ? tokens as values + * @return string */ function makeList( $a, $mode = LIST_COMMA ) { if ( !is_array( $a ) ) { @@ -873,6 +885,7 @@ class DatabaseIbm_db2 extends DatabaseBase { * @param $sql string SQL query we will append the limit too * @param $limit integer the SQL limit * @param $offset integer the SQL offset (default false) + * @return string */ public function limitResult( $sql, $limit, $offset=false ) { if( !is_numeric( $limit ) ) { @@ -1153,6 +1166,7 @@ class DatabaseIbm_db2 extends DatabaseBase { * DELETE query wrapper * * Use $conds == "*" to delete all rows + * @return bool|\ResultWrapper */ public function delete( $table, $conds, $fname = 'DatabaseIbm_db2::delete' ) { if ( !$conds ) { @@ -1640,6 +1654,7 @@ SQL; * in the appropriate places. * @param $query String * @param $args ... + * @return Resource */ public function safeQuery( $query, $args = null ) { // copied verbatim from Database.php @@ -1674,6 +1689,7 @@ SQL; /** * Switches module between regular and install modes + * @return string */ public function setMode( $mode ) { $old = $this->mMode; diff --git a/includes/db/DatabaseMssql.php b/includes/db/DatabaseMssql.php index 38be4cbb71..cf5ee940ba 100644 --- a/includes/db/DatabaseMssql.php +++ b/includes/db/DatabaseMssql.php @@ -46,6 +46,7 @@ class DatabaseMssql extends DatabaseBase { /** * Usually aborts on failure + * @return bool|DatabaseBase|null */ function open( $server, $user, $password, $dbName ) { # Test for driver support, to avoid suppressed fatal error @@ -107,6 +108,7 @@ class DatabaseMssql extends DatabaseBase { /** * Closes a database connection, if it is open * Returns success, true if already closed + * @return bool */ function close() { $this->mOpened = false; @@ -226,6 +228,7 @@ class DatabaseMssql extends DatabaseBase { /** * This must be called after nextSequenceVal + * @return null */ function insertId() { return $this->mInsertId; @@ -310,6 +313,7 @@ class DatabaseMssql extends DatabaseBase { * This is not necessarily an accurate estimate, so use sparingly * Returns -1 if count cannot be found * Takes same arguments as Database::select() + * @return int */ function estimateRowCount( $table, $vars = '*', $conds = '', $fname = 'DatabaseMssql::estimateRowCount', $options = array() ) { $options['EXPLAIN'] = true;// http://msdn2.microsoft.com/en-us/library/aa259203.aspx @@ -326,6 +330,7 @@ class DatabaseMssql extends DatabaseBase { /** * Returns information about an index * If errors are explicitly ignored, returns NULL on failure + * @return array|bool|null */ function indexInfo( $table, $index, $fname = 'DatabaseMssql::indexExists' ) { # This does not return the same info as MYSQL would, but that's OK because MediaWiki never uses the @@ -365,6 +370,7 @@ class DatabaseMssql extends DatabaseBase { * * Usually aborts on failure * If errors are explicitly ignored, returns success + * @return bool */ function insert( $table, $arrToInsert, $fname = 'DatabaseMssql::insert', $options = array() ) { # No rows to insert, easy just return now @@ -494,6 +500,7 @@ class DatabaseMssql extends DatabaseBase { * Source items may be literals rather than field names, but strings should be quoted with Database::addQuotes() * $conds may be "*" to copy the whole table * srcTable may be an array of tables. + * @return null|\ResultWrapper */ function insertSelect( $destTable, $srcTable, $varMap, $conds, $fname = 'DatabaseMssql::insertSelect', $insertOptions = array(), $selectOptions = array() ) { @@ -511,6 +518,7 @@ class DatabaseMssql extends DatabaseBase { /** * Return the next in a sequence, save the value for retrieval via insertId() + * @return */ function nextSequenceValue( $seqName ) { if ( !$this->tableExists( 'sequence_' . $seqName ) ) { @@ -527,6 +535,7 @@ class DatabaseMssql extends DatabaseBase { /** * Return the current value of a sequence. Assumes it has ben nextval'ed in this session. + * @return */ function currentSequenceValue( $seqName ) { $ret = sqlsrv_query( $this->mConn, "SELECT TOP 1 id FROM [sequence_$seqName] ORDER BY id DESC" ); @@ -559,6 +568,7 @@ class DatabaseMssql extends DatabaseBase { * $sql string SQL query we will append the limit too * $limit integer the SQL limit * $offset integer the SQL offset (default false) + * @return mixed|string */ function limitResult( $sql, $limit, $offset = false ) { if ( $offset === false || $offset == 0 ) { @@ -647,6 +657,7 @@ class DatabaseMssql extends DatabaseBase { /** * Query whether a given column exists in the mediawiki schema + * @return bool */ function fieldExists( $table, $field, $fname = 'DatabaseMssql::fieldExists' ) { $table = $this->tableName( $table ); @@ -707,6 +718,7 @@ class DatabaseMssql extends DatabaseBase { * Escapes a identifier for use inm SQL. * Throws an exception if it is invalid. * Reference: http://msdn.microsoft.com/en-us/library/aa224033%28v=SQL.80%29.aspx + * @return string */ private function escapeIdentifier( $identifier ) { if ( strlen( $identifier ) == 0 ) { @@ -795,6 +807,7 @@ class DatabaseMssql extends DatabaseBase { /** * @private + * @return string */ function tableNamesWithUseIndexOrJOIN( $tables, $use_index = array(), $join_conds = array() ) { $ret = array(); @@ -893,6 +906,7 @@ class DatabaseMssql extends DatabaseBase { /** * Get the type of the DBMS, as it appears in $wgDBtype. + * @return string */ function getType(){ return 'mssql'; @@ -909,6 +923,7 @@ class DatabaseMssql extends DatabaseBase { /** * Since MSSQL doesn't recognize the infinity keyword, set date manually. * @todo Remove magic date + * @return string */ public function getInfinity() { return '3000-01-31 00:00:00.000'; diff --git a/includes/db/DatabaseOracle.php b/includes/db/DatabaseOracle.php index 855fc83165..8a35ad5bbd 100644 --- a/includes/db/DatabaseOracle.php +++ b/includes/db/DatabaseOracle.php @@ -226,6 +226,7 @@ class DatabaseOracle extends DatabaseBase { /** * Usually aborts on failure + * @return DatabaseBase|null */ function open( $server, $user, $password, $dbName ) { if ( !function_exists( 'oci_connect' ) ) { @@ -285,6 +286,7 @@ class DatabaseOracle extends DatabaseBase { /** * Closes a database connection, if it is open * Returns success, true if already closed + * @return bool */ function close() { $this->mOpened = false; @@ -401,6 +403,7 @@ class DatabaseOracle extends DatabaseBase { /** * This must be called after nextSequenceVal + * @return null */ function insertId() { return $this->mInsertId; @@ -439,6 +442,7 @@ class DatabaseOracle extends DatabaseBase { /** * Returns information about an index * If errors are explicitly ignored, returns NULL on failure + * @return bool */ function indexInfo( $table, $index, $fname = 'DatabaseOracle::indexExists' ) { return false; @@ -679,6 +683,7 @@ class DatabaseOracle extends DatabaseBase { } /** * Return the next in a sequence, save the value for retrieval via insertId() + * @return null */ function nextSequenceValue( $seqName ) { $res = $this->query( "SELECT $seqName.nextval FROM dual" ); @@ -689,6 +694,7 @@ class DatabaseOracle extends DatabaseBase { /** * Return sequence_name if table has a sequence + * @return bool */ private function getSequenceData( $table ) { if ( $this->sequenceData == null ) { @@ -836,6 +842,7 @@ class DatabaseOracle extends DatabaseBase { /** * Query whether a given index exists + * @return bool */ function indexExists( $table, $index, $fname = 'DatabaseOracle::indexExists' ) { $table = $this->tableName( $table ); @@ -855,6 +862,7 @@ class DatabaseOracle extends DatabaseBase { /** * Query whether a given table exists (in the given schema, or the default mw one if not given) + * @return int */ function tableExists( $table, $fname = __METHOD__ ) { $table = $this->tableName( $table ); diff --git a/includes/db/DatabasePostgres.php b/includes/db/DatabasePostgres.php index 2b0c0a3397..71a84b4406 100644 --- a/includes/db/DatabasePostgres.php +++ b/includes/db/DatabasePostgres.php @@ -145,6 +145,7 @@ class DatabasePostgres extends DatabaseBase { /** * Usually aborts on failure + * @return DatabaseBase|null */ function open( $server, $user, $password, $dbName ) { # Test for Postgres support, to avoid suppressed fatal error @@ -237,6 +238,7 @@ class DatabasePostgres extends DatabaseBase { /** * Closes a database connection, if it is open * Returns success, true if already closed + * @return bool */ function close() { $this->mOpened = false; @@ -331,6 +333,7 @@ class DatabasePostgres extends DatabaseBase { /** * This must be called after nextSequenceVal + * @return null */ function insertId() { return $this->mInsertId; @@ -371,6 +374,7 @@ class DatabasePostgres extends DatabaseBase { * This is not necessarily an accurate estimate, so use sparingly * Returns -1 if count cannot be found * Takes same arguments as Database::select() + * @return int */ function estimateRowCount( $table, $vars = '*', $conds='', $fname = 'DatabasePostgres::estimateRowCount', $options = array() ) { $options['EXPLAIN'] = true; @@ -389,6 +393,7 @@ class DatabasePostgres extends DatabaseBase { /** * Returns information about an index * If errors are explicitly ignored, returns NULL on failure + * @return bool|null */ function indexInfo( $table, $index, $fname = 'DatabasePostgres::indexInfo' ) { $sql = "SELECT indexname FROM pg_indexes WHERE tablename='$table'"; @@ -555,6 +560,7 @@ class DatabasePostgres extends DatabaseBase { * $conds may be "*" to copy the whole table * srcTable may be an array of tables. * @todo FIXME: Implement this a little better (seperate select/insert)? + * @return bool */ function insertSelect( $destTable, $srcTable, $varMap, $conds, $fname = 'DatabasePostgres::insertSelect', $insertOptions = array(), $selectOptions = array() ) @@ -637,6 +643,7 @@ class DatabasePostgres extends DatabaseBase { /** * Return the next in a sequence, save the value for retrieval via insertId() + * @return null */ function nextSequenceValue( $seqName ) { $safeseq = str_replace( "'", "''", $seqName ); @@ -648,6 +655,7 @@ class DatabasePostgres extends DatabaseBase { /** * Return the current value of a sequence. Assumes it has been nextval'ed in this session. + * @return */ function currentSequenceValue( $seqName ) { $safeseq = str_replace( "'", "''", $seqName ); @@ -747,6 +755,7 @@ class DatabasePostgres extends DatabaseBase { /** * Query whether a given relation exists (in the given schema, or the * default mw one if not given) + * @return bool */ function relationExists( $table, $types, $schema = false ) { global $wgDBmwschema; @@ -770,6 +779,7 @@ class DatabasePostgres extends DatabaseBase { /** * For backward compatibility, this function checks both tables and * views. + * @return bool */ function tableExists( $table, $fname = __METHOD__, $schema = false ) { return $this->relationExists( $table, array( 'r', 'v' ), $schema ); @@ -833,6 +843,7 @@ SQL; /** * Query whether a given schema exists. Returns true if it does, false if it doesn't. + * @return bool */ function schemaExists( $schema ) { $exists = $this->selectField( '"pg_catalog"."pg_namespace"', 1, @@ -842,6 +853,7 @@ SQL; /** * Returns true if a given role (i.e. user) exists, false otherwise. + * @return bool */ function roleExists( $roleName ) { $exists = $this->selectField( '"pg_catalog"."pg_roles"', 1, @@ -855,6 +867,7 @@ SQL; /** * pg_field_type() wrapper + * @return string */ function fieldType( $res, $index ) { if ( $res instanceof ResultWrapper ) { diff --git a/includes/db/DatabaseSqlite.php b/includes/db/DatabaseSqlite.php index fb0e499f9a..169da2b584 100644 --- a/includes/db/DatabaseSqlite.php +++ b/includes/db/DatabaseSqlite.php @@ -497,6 +497,7 @@ class DatabaseSqlite extends DatabaseBase { /** * Based on generic method (parent) with some prior SQLite-sepcific adjustments + * @return bool */ function insert( $table, $a, $fname = 'DatabaseSqlite::insert', $options = array() ) { if ( !count( $a ) ) { @@ -723,6 +724,7 @@ class DatabaseSqlite extends DatabaseBase { /** * No-op version of deadlockLoop + * @return mixed */ public function deadlockLoop( /*...*/ ) { $args = func_get_args(); diff --git a/includes/debug/Debug.php b/includes/debug/Debug.php index 376402f74d..eaf8828861 100644 --- a/includes/debug/Debug.php +++ b/includes/debug/Debug.php @@ -87,6 +87,7 @@ class MWDebug { /** * Returns internal log array + * @return array */ public static function getLog() { return self::$log; diff --git a/includes/diff/DifferenceEngine.php b/includes/diff/DifferenceEngine.php index 439e3204ec..a4d0c65602 100644 --- a/includes/diff/DifferenceEngine.php +++ b/includes/diff/DifferenceEngine.php @@ -672,6 +672,7 @@ class DifferenceEngine extends ContextSource { * * @param $otext String: old text, must be already segmented * @param $ntext String: new text, must be already segmented + * @return bool|string */ function generateDiffBody( $otext, $ntext ) { global $wgExternalDiffEngine, $wgContLang; @@ -747,6 +748,7 @@ class DifferenceEngine extends ContextSource { /** * Generate a debug comment indicating diff generating time, * server node, and generator backend. + * @return string */ protected function debug( $generator = "internal" ) { global $wgShowHostnames; @@ -768,6 +770,7 @@ class DifferenceEngine extends ContextSource { /** * Replace line numbers with the text in the user's language + * @return mixed */ function localiseLineNumbers( $text ) { return preg_replace_callback( '//', diff --git a/includes/filerepo/FileRepo.php b/includes/filerepo/FileRepo.php index 8cf443fe3d..4555d4db14 100644 --- a/includes/filerepo/FileRepo.php +++ b/includes/filerepo/FileRepo.php @@ -411,6 +411,7 @@ class FileRepo { * SHA-1 content hash. * * STUB + * @return array */ public function findBySha1( $hash ) { return array(); @@ -456,6 +457,7 @@ class FileRepo { * Get the name of an image from its title object * * @param $title Title + * @return String */ public function getNameFromTitle( Title $title ) { global $wgContLang; @@ -869,6 +871,7 @@ class FileRepo { * be archived, if there is one. Relative to the public zone root. * @param $flags Integer: bitfield, may be FileRepo::DELETE_SOURCE to indicate * that the source file should be deleted if possible + * @return FileRepoStatus */ public function publish( $srcPath, $dstRel, $archiveRel, $flags = 0 ) { $status = $this->publishBatch( array( array( $srcPath, $dstRel, $archiveRel ) ), $flags ); @@ -1422,6 +1425,7 @@ class FileRepo { * The parameters are the parts of the key, as for wfMemcKey(). * * STUB + * @return bool */ function getSharedCacheKey( /*...*/ ) { return false; diff --git a/includes/filerepo/ForeignAPIRepo.php b/includes/filerepo/ForeignAPIRepo.php index e544defb62..ea15a49c88 100644 --- a/includes/filerepo/ForeignAPIRepo.php +++ b/includes/filerepo/ForeignAPIRepo.php @@ -77,6 +77,7 @@ class ForeignAPIRepo extends FileRepo { /** * No-ops + * @return bool */ function storeBatch( $triplets, $flags = 0 ) { @@ -231,6 +232,7 @@ class ForeignAPIRepo extends FileRepo { * @param $width * @param $height * @param String $param Other rendering parameters (page number, etc) from handler's makeParamString. + * @return bool|string */ function getThumbUrlFromCache( $name, $width, $height, $params="" ) { global $wgMemc; @@ -312,6 +314,7 @@ class ForeignAPIRepo extends FileRepo { /** * @see FileRepo::getZoneUrl() + * @return String */ function getZoneUrl( $zone ) { switch ( $zone ) { @@ -326,6 +329,7 @@ class ForeignAPIRepo extends FileRepo { /** * Get the local directory corresponding to one of the basic zones + * @return bool|null|string */ function getZonePath( $zone ) { $supported = array( 'public', 'thumb' ); @@ -345,6 +349,7 @@ class ForeignAPIRepo extends FileRepo { /** * The user agent the ForeignAPIRepo will use. + * @return string */ public static function getUserAgent() { return Http::userAgent() . " ForeignAPIRepo/" . self::VERSION; @@ -353,6 +358,7 @@ class ForeignAPIRepo extends FileRepo { /** * Like a Http:get request, but with custom User-Agent. * @see Http:get + * @return bool|String */ public static function httpGet( $url, $timeout = 'default', $options = array() ) { $options['timeout'] = $timeout; @@ -362,7 +368,7 @@ class ForeignAPIRepo extends FileRepo { $options['method'] = "GET"; if ( !isset( $options['timeout'] ) ) { - $options['timeout'] = 'default'; + $options['timeout'] = 'default'; } $req = MWHttpRequest::factory( $url, $options ); @@ -370,9 +376,9 @@ class ForeignAPIRepo extends FileRepo { $status = $req->execute(); if ( $status->isOK() ) { - return $req->getContent(); + return $req->getContent(); } else { - return false; + return false; } } diff --git a/includes/filerepo/ForeignDBRepo.php b/includes/filerepo/ForeignDBRepo.php index 0311ebcd7d..8eab72f0c4 100644 --- a/includes/filerepo/ForeignDBRepo.php +++ b/includes/filerepo/ForeignDBRepo.php @@ -61,6 +61,7 @@ class ForeignDBRepo extends LocalRepo { * Get a key on the primary cache for this repository. * Returns false if the repository's cache is not accessible at this site. * The parameters are the parts of the key, as for wfMemcKey(). + * @return bool|mixed */ function getSharedCacheKey( /*...*/ ) { if ( $this->hasSharedCache() ) { diff --git a/includes/filerepo/ForeignDBViaLBRepo.php b/includes/filerepo/ForeignDBViaLBRepo.php index 28b48b5eb3..45dad1ae19 100644 --- a/includes/filerepo/ForeignDBViaLBRepo.php +++ b/includes/filerepo/ForeignDBViaLBRepo.php @@ -39,6 +39,7 @@ class ForeignDBViaLBRepo extends LocalRepo { * Get a key on the primary cache for this repository. * Returns false if the repository's cache is not accessible at this site. * The parameters are the parts of the key, as for wfMemcKey(). + * @return bool|string */ function getSharedCacheKey( /*...*/ ) { if ( $this->hasSharedCache() ) { diff --git a/includes/filerepo/LocalRepo.php b/includes/filerepo/LocalRepo.php index cc23fa315b..f607cd6524 100644 --- a/includes/filerepo/LocalRepo.php +++ b/includes/filerepo/LocalRepo.php @@ -189,6 +189,7 @@ class LocalRepo extends FileRepo { * We can't say Title object, what database it should use, so we duplicate that function here. * * @param $title Title + * @return bool|int|mixed */ protected function getArticleID( $title ) { if( !$title instanceof Title ) { @@ -233,6 +234,7 @@ class LocalRepo extends FileRepo { /** * Get a connection to the slave DB + * @return DatabaseBase */ function getSlaveDB() { return wfGetDB( DB_SLAVE ); @@ -240,6 +242,7 @@ class LocalRepo extends FileRepo { /** * Get a connection to the master DB + * @return DatabaseBase */ function getMasterDB() { return wfGetDB( DB_MASTER ); diff --git a/includes/filerepo/RepoGroup.php b/includes/filerepo/RepoGroup.php index 277364e8c2..809633632f 100644 --- a/includes/filerepo/RepoGroup.php +++ b/includes/filerepo/RepoGroup.php @@ -189,6 +189,7 @@ class RepoGroup { /** * Interface for FileRepo::checkRedirect() + * @return bool */ function checkRedirect( Title $title ) { if ( !$this->reposInitialised ) { @@ -251,6 +252,7 @@ class RepoGroup { /** * Get the repo instance with a given key. + * @return bool|LocalRepo */ function getRepo( $index ) { if ( !$this->reposInitialised ) { @@ -266,6 +268,7 @@ class RepoGroup { } /** * Get the repo instance by its name + * @return bool */ function getRepoByName( $name ) { if ( !$this->reposInitialised ) { @@ -294,6 +297,7 @@ class RepoGroup { * * @param $callback Callback: the function to call * @param $params Array: optional additional parameters to pass to the function + * @return bool */ function forEachForeignRepo( $callback, $params = array() ) { foreach( $this->foreignRepos as $repo ) { diff --git a/includes/filerepo/backend/FSFileBackend.php b/includes/filerepo/backend/FSFileBackend.php index 8b602905c2..f39f1f3c22 100644 --- a/includes/filerepo/backend/FSFileBackend.php +++ b/includes/filerepo/backend/FSFileBackend.php @@ -62,6 +62,7 @@ class FSFileBackend extends FileBackendStore { /** * @see FileBackendStore::resolveContainerPath() + * @return null|string */ protected function resolveContainerPath( $container, $relStoragePath ) { // Check that container has a root directory @@ -130,6 +131,7 @@ class FSFileBackend extends FileBackendStore { /** * @see FileBackendStore::isPathUsableInternal() + * @return bool */ public function isPathUsableInternal( $storagePath ) { $fsPath = $this->resolveToFSPath( $storagePath ); @@ -151,6 +153,7 @@ class FSFileBackend extends FileBackendStore { /** * @see FileBackendStore::doStoreInternal() + * @return Status */ protected function doStoreInternal( array $params ) { $status = Status::newGood(); @@ -191,6 +194,7 @@ class FSFileBackend extends FileBackendStore { /** * @see FileBackendStore::doCopyInternal() + * @return Status */ protected function doCopyInternal( array $params ) { $status = Status::newGood(); @@ -237,6 +241,7 @@ class FSFileBackend extends FileBackendStore { /** * @see FileBackendStore::doMoveInternal() + * @return Status */ protected function doMoveInternal( array $params ) { $status = Status::newGood(); @@ -285,6 +290,7 @@ class FSFileBackend extends FileBackendStore { /** * @see FileBackendStore::doDeleteInternal() + * @return Status */ protected function doDeleteInternal( array $params ) { $status = Status::newGood(); @@ -315,6 +321,7 @@ class FSFileBackend extends FileBackendStore { /** * @see FileBackendStore::doCreateInternal() + * @return Status */ protected function doCreateInternal( array $params ) { $status = Status::newGood(); @@ -355,6 +362,7 @@ class FSFileBackend extends FileBackendStore { /** * @see FileBackendStore::doPrepareInternal() + * @return Status */ protected function doPrepareInternal( $fullCont, $dirRel, array $params ) { $status = Status::newGood(); @@ -373,6 +381,7 @@ class FSFileBackend extends FileBackendStore { /** * @see FileBackendStore::doSecureInternal() + * @return Status */ protected function doSecureInternal( $fullCont, $dirRel, array $params ) { $status = Status::newGood(); @@ -407,6 +416,7 @@ class FSFileBackend extends FileBackendStore { /** * @see FileBackendStore::doCleanInternal() + * @return Status */ protected function doCleanInternal( $fullCont, $dirRel, array $params ) { $status = Status::newGood(); @@ -423,6 +433,7 @@ class FSFileBackend extends FileBackendStore { /** * @see FileBackendStore::doFileExists() + * @return array|bool|null */ protected function doGetFileStat( array $params ) { $source = $this->resolveToFSPath( $params['src'] ); @@ -455,6 +466,7 @@ class FSFileBackend extends FileBackendStore { /** * @see FileBackendStore::getFileListInternal() + * @return array|FSFileBackendFileList|null */ public function getFileListInternal( $fullCont, $dirRel, array $params ) { list( $b, $shortCont, $r ) = FileBackend::splitStoragePath( $params['dir'] ); @@ -479,6 +491,7 @@ class FSFileBackend extends FileBackendStore { /** * @see FileBackendStore::getLocalReference() + * @return FSFile|null */ public function getLocalReference( array $params ) { $source = $this->resolveToFSPath( $params['src'] ); @@ -490,6 +503,7 @@ class FSFileBackend extends FileBackendStore { /** * @see FileBackendStore::getLocalCopy() + * @return null|TempFSFile */ public function getLocalCopy( array $params ) { $source = $this->resolveToFSPath( $params['src'] ); diff --git a/includes/filerepo/backend/FileBackend.php b/includes/filerepo/backend/FileBackend.php index 7cbfb919d6..bca35b7a40 100644 --- a/includes/filerepo/backend/FileBackend.php +++ b/includes/filerepo/backend/FileBackend.php @@ -885,6 +885,7 @@ abstract class FileBackendStore extends FileBackend { /** * @see FileBackendStore::moveInternal() + * @return Status */ protected function doMoveInternal( array $params ) { // Copy source to dest @@ -899,6 +900,7 @@ abstract class FileBackendStore extends FileBackend { /** * @see FileBackend::concatenate() + * @return Status */ final public function concatenate( array $params ) { wfProfileIn( __METHOD__ ); @@ -917,6 +919,7 @@ abstract class FileBackendStore extends FileBackend { /** * @see FileBackendStore::concatenate() + * @return Status */ protected function doConcatenate( array $params ) { $status = Status::newGood(); @@ -972,6 +975,7 @@ abstract class FileBackendStore extends FileBackend { /** * @see FileBackend::doPrepare() + * @return Status */ final protected function doPrepare( array $params ) { wfProfileIn( __METHOD__ ); @@ -1000,6 +1004,7 @@ abstract class FileBackendStore extends FileBackend { /** * @see FileBackendStore::doPrepare() + * @return Status */ protected function doPrepareInternal( $container, $dir, array $params ) { return Status::newGood(); @@ -1007,6 +1012,7 @@ abstract class FileBackendStore extends FileBackend { /** * @see FileBackend::doSecure() + * @return Status */ final protected function doSecure( array $params ) { wfProfileIn( __METHOD__ ); @@ -1035,6 +1041,7 @@ abstract class FileBackendStore extends FileBackend { /** * @see FileBackendStore::doSecure() + * @return Status */ protected function doSecureInternal( $container, $dir, array $params ) { return Status::newGood(); @@ -1042,6 +1049,7 @@ abstract class FileBackendStore extends FileBackend { /** * @see FileBackend::doClean() + * @return Status */ final protected function doClean( array $params ) { wfProfileIn( __METHOD__ ); @@ -1078,6 +1086,7 @@ abstract class FileBackendStore extends FileBackend { /** * @see FileBackendStore::doClean() + * @return Status */ protected function doCleanInternal( $container, $dir, array $params ) { return Status::newGood(); @@ -1085,6 +1094,7 @@ abstract class FileBackendStore extends FileBackend { /** * @see FileBackend::fileExists() + * @return bool|null */ final public function fileExists( array $params ) { wfProfileIn( __METHOD__ ); @@ -1095,6 +1105,7 @@ abstract class FileBackendStore extends FileBackend { /** * @see FileBackend::getFileTimestamp() + * @return bool */ final public function getFileTimestamp( array $params ) { wfProfileIn( __METHOD__ ); @@ -1105,6 +1116,7 @@ abstract class FileBackendStore extends FileBackend { /** * @see FileBackend::getFileSize() + * @return bool */ final public function getFileSize( array $params ) { wfProfileIn( __METHOD__ ); @@ -1115,6 +1127,7 @@ abstract class FileBackendStore extends FileBackend { /** * @see FileBackend::getFileStat() + * @return bool|void */ final public function getFileStat( array $params ) { wfProfileIn( __METHOD__ ); @@ -1148,6 +1161,7 @@ abstract class FileBackendStore extends FileBackend { /** * @see FileBackend::getFileContents() + * @return bool|string */ public function getFileContents( array $params ) { wfProfileIn( __METHOD__ ); @@ -1165,6 +1179,7 @@ abstract class FileBackendStore extends FileBackend { /** * @see FileBackend::getFileSha1Base36() + * @return bool */ final public function getFileSha1Base36( array $params ) { wfProfileIn( __METHOD__ ); @@ -1184,6 +1199,7 @@ abstract class FileBackendStore extends FileBackend { /** * @see FileBackendStore::getFileSha1Base36() + * @return bool */ protected function doGetFileSha1Base36( array $params ) { $fsFile = $this->getLocalReference( $params ); @@ -1196,6 +1212,7 @@ abstract class FileBackendStore extends FileBackend { /** * @see FileBackend::getFileProps() + * @return Array */ final public function getFileProps( array $params ) { wfProfileIn( __METHOD__ ); @@ -1207,6 +1224,7 @@ abstract class FileBackendStore extends FileBackend { /** * @see FileBackend::getLocalReference() + * @return null|\TempFSFile */ public function getLocalReference( array $params ) { wfProfileIn( __METHOD__ ); @@ -1226,6 +1244,7 @@ abstract class FileBackendStore extends FileBackend { /** * @see FileBackend::streamFile() + * @return Status */ final public function streamFile( array $params ) { wfProfileIn( __METHOD__ ); @@ -1253,6 +1272,7 @@ abstract class FileBackendStore extends FileBackend { /** * @see FileBackendStore::streamFile() + * @return Status */ protected function doStreamFile( array $params ) { $status = Status::newGood(); @@ -1268,7 +1288,8 @@ abstract class FileBackendStore extends FileBackend { } /** - * @copydoc FileBackend::getFileList() + * @copydoc FileBackend::getFileList() + * @return Array|FileBackendStoreShardListIterator|null|Traversable */ final public function getFileList( array $params ) { list( $fullCont, $dir, $shard ) = $this->resolveStoragePath( $params['dir'] ); @@ -1349,6 +1370,7 @@ abstract class FileBackendStore extends FileBackend { /** * @see FileBackend::doOperationsInternal() + * @return Status */ protected function doOperationsInternal( array $ops, array $opts ) { wfProfileIn( __METHOD__ ); diff --git a/includes/filerepo/backend/FileBackendMultiWrite.php b/includes/filerepo/backend/FileBackendMultiWrite.php index c0f1ac57d7..95e0eeb0b8 100644 --- a/includes/filerepo/backend/FileBackendMultiWrite.php +++ b/includes/filerepo/backend/FileBackendMultiWrite.php @@ -76,6 +76,7 @@ class FileBackendMultiWrite extends FileBackend { /** * @see FileBackend::doOperationsInternal() + * @return Status */ final protected function doOperationsInternal( array $ops, array $opts ) { $status = Status::newGood(); @@ -277,6 +278,7 @@ class FileBackendMultiWrite extends FileBackend { /** * @see FileBackend::doPrepare() + * @return Status */ public function doPrepare( array $params ) { $status = Status::newGood(); @@ -289,6 +291,7 @@ class FileBackendMultiWrite extends FileBackend { /** * @see FileBackend::doSecure() + * @return Status */ public function doSecure( array $params ) { $status = Status::newGood(); @@ -301,6 +304,7 @@ class FileBackendMultiWrite extends FileBackend { /** * @see FileBackend::doClean() + * @return Status */ public function doClean( array $params ) { $status = Status::newGood(); diff --git a/includes/filerepo/backend/SwiftFileBackend.php b/includes/filerepo/backend/SwiftFileBackend.php index b0a94c5c63..fa7a409ac2 100644 --- a/includes/filerepo/backend/SwiftFileBackend.php +++ b/includes/filerepo/backend/SwiftFileBackend.php @@ -68,6 +68,7 @@ class SwiftFileBackend extends FileBackendStore { /** * @see FileBackendStore::resolveContainerPath() + * @return null */ protected function resolveContainerPath( $container, $relStoragePath ) { if ( strlen( urlencode( $relStoragePath ) ) > 1024 ) { @@ -78,6 +79,7 @@ class SwiftFileBackend extends FileBackendStore { /** * @see FileBackendStore::isPathUsableInternal() + * @return bool */ public function isPathUsableInternal( $storagePath ) { list( $container, $rel ) = $this->resolveStoragePathReal( $storagePath ); @@ -99,6 +101,7 @@ class SwiftFileBackend extends FileBackendStore { /** * @see FileBackendStore::doCreateInternal() + * @return Status */ protected function doCreateInternal( array $params ) { $status = Status::newGood(); @@ -161,6 +164,7 @@ class SwiftFileBackend extends FileBackendStore { /** * @see FileBackendStore::doStoreInternal() + * @return Status */ protected function doStoreInternal( array $params ) { $status = Status::newGood(); @@ -229,6 +233,7 @@ class SwiftFileBackend extends FileBackendStore { /** * @see FileBackendStore::doCopyInternal() + * @return Status */ protected function doCopyInternal( array $params ) { $status = Status::newGood(); @@ -284,6 +289,7 @@ class SwiftFileBackend extends FileBackendStore { /** * @see FileBackendStore::doDeleteInternal() + * @return Status */ protected function doDeleteInternal( array $params ) { $status = Status::newGood(); @@ -315,6 +321,7 @@ class SwiftFileBackend extends FileBackendStore { /** * @see FileBackendStore::doPrepareInternal() + * @return Status */ protected function doPrepareInternal( $fullCont, $dir, array $params ) { $status = Status::newGood(); @@ -360,6 +367,7 @@ class SwiftFileBackend extends FileBackendStore { /** * @see FileBackendStore::doSecureInternal() + * @return Status */ protected function doSecureInternal( $fullCont, $dir, array $params ) { $status = Status::newGood(); @@ -394,6 +402,7 @@ class SwiftFileBackend extends FileBackendStore { /** * @see FileBackendStore::doCleanInternal() + * @return Status */ protected function doCleanInternal( $fullCont, $dir, array $params ) { $status = Status::newGood(); @@ -438,6 +447,7 @@ class SwiftFileBackend extends FileBackendStore { /** * @see FileBackendStore::doFileExists() + * @return array|bool|null */ protected function doGetFileStat( array $params ) { list( $srcCont, $srcRel ) = $this->resolveStoragePathReal( $params['src'] ); @@ -499,6 +509,7 @@ class SwiftFileBackend extends FileBackendStore { /** * @see FileBackend::getFileContents() + * @return bool|null|string */ public function getFileContents( array $params ) { list( $srcCont, $srcRel ) = $this->resolveStoragePathReal( $params['src'] ); @@ -526,6 +537,7 @@ class SwiftFileBackend extends FileBackendStore { /** * @see FileBackendStore::getFileListInternal() + * @return SwiftFileBackendFileList */ public function getFileListInternal( $fullCont, $dir, array $params ) { return new SwiftFileBackendFileList( $this, $fullCont, $dir ); @@ -559,6 +571,7 @@ class SwiftFileBackend extends FileBackendStore { /** * @see FileBackendStore::doGetFileSha1base36() + * @return bool */ public function doGetFileSha1base36( array $params ) { $stat = $this->getFileStat( $params ); @@ -571,6 +584,7 @@ class SwiftFileBackend extends FileBackendStore { /** * @see FileBackendStore::doStreamFile() + * @return Status */ protected function doStreamFile( array $params ) { $status = Status::newGood(); @@ -610,6 +624,7 @@ class SwiftFileBackend extends FileBackendStore { /** * @see FileBackendStore::getLocalCopy() + * @return null|TempFSFile */ public function getLocalCopy( array $params ) { list( $srcCont, $srcRel ) = $this->resolveStoragePathReal( $params['src'] ); diff --git a/includes/filerepo/backend/lockmanager/DBLockManager.php b/includes/filerepo/backend/lockmanager/DBLockManager.php index 8682eb687f..641e5965d7 100644 --- a/includes/filerepo/backend/lockmanager/DBLockManager.php +++ b/includes/filerepo/backend/lockmanager/DBLockManager.php @@ -90,6 +90,7 @@ class DBLockManager extends LockManager { /** * @see LockManager::doLock() + * @return Status */ protected function doLock( array $paths, $type ) { $status = Status::newGood(); @@ -140,6 +141,7 @@ class DBLockManager extends LockManager { /** * @see LockManager::doUnlock() + * @return Status */ protected function doUnlock( array $paths, $type ) { $status = Status::newGood(); diff --git a/includes/filerepo/file/File.php b/includes/filerepo/file/File.php index 1bc79fa7c7..88c8a55b40 100644 --- a/includes/filerepo/file/File.php +++ b/includes/filerepo/file/File.php @@ -433,6 +433,7 @@ abstract class File { * Get handler-specific metadata * Overridden by LocalFile, UnregisteredLocalFile * STUB + * @return bool */ public function getMetadata() { return false; @@ -462,6 +463,7 @@ abstract class File { * Return the bit depth of the file * Overridden by LocalFile * STUB + * @return int */ public function getBitDepth() { return 0; @@ -471,6 +473,7 @@ abstract class File { * Return the size of the image file, in bytes * Overridden by LocalFile, UnregisteredLocalFile * STUB + * @return bool */ public function getSize() { return false; @@ -492,6 +495,7 @@ abstract class File { * Use the value returned by this function with the MEDIATYPE_xxx constants. * Overridden by LocalFile, * STUB + * @return string */ function getMediaType() { return MEDIATYPE_UNKNOWN; @@ -518,6 +522,7 @@ abstract class File { /** * Accessor for __get() + * @return bool */ protected function getCanRender() { return $this->canRender(); @@ -938,6 +943,7 @@ abstract class File { * Get all thumbnail names previously generated for this file * STUB * Overridden by LocalFile + * @return array */ function getThumbnails() { return array(); @@ -1004,6 +1010,7 @@ abstract class File { * * STUB * Overridden in LocalFile + * @return bool */ public function nextHistoryLine() { return false; @@ -1360,6 +1367,7 @@ abstract class File { /** * Return the deletion bitfield * STUB + * @return int */ function getVisibility() { return 0; diff --git a/includes/filerepo/file/ForeignAPIFile.php b/includes/filerepo/file/ForeignAPIFile.php index af45e2d8c6..e1350ae456 100644 --- a/includes/filerepo/file/ForeignAPIFile.php +++ b/includes/filerepo/file/ForeignAPIFile.php @@ -68,6 +68,7 @@ class ForeignAPIFile extends File { /** * Get the property string for iiprop and aiprop + * @return string */ static function getProps() { return 'timestamp|user|comment|url|size|sha1|metadata|mime'; @@ -183,6 +184,7 @@ class ForeignAPIFile extends File { /** * Only useful if we're locally caching thumbs anyway... + * @return null|string */ function getThumbPath( $suffix = '' ) { if ( $this->repo->canCacheThumbs() ) { diff --git a/includes/filerepo/file/LocalFile.php b/includes/filerepo/file/LocalFile.php index 47943b34ba..d0533184bf 100644 --- a/includes/filerepo/file/LocalFile.php +++ b/includes/filerepo/file/LocalFile.php @@ -121,6 +121,7 @@ class LocalFile extends File { /** * Fields in the image table + * @return array */ static function selectFields() { return array( @@ -160,6 +161,7 @@ class LocalFile extends File { /** * Get the memcached key for the main data for this file, or false if * there is no access to the shared cache. + * @return bool */ function getCacheKey() { $hashedName = md5( $this->getName() ); @@ -169,6 +171,7 @@ class LocalFile extends File { /** * Try to load file metadata from memcached. Returns true on success. + * @return bool */ function loadFromCache() { global $wgMemc; @@ -286,6 +289,7 @@ class LocalFile extends File { /** * Decode a row from the database (either object or array) to an array * with timestamps and MIME types decoded, and the field prefix removed. + * @return array */ function decodeRow( $row, $prefix = 'img_' ) { $array = (array)$row; @@ -474,6 +478,7 @@ class LocalFile extends File { * Return the width of the image * * Returns false on error + * @return bool */ public function getWidth( $page = 1 ) { $this->load(); @@ -494,6 +499,7 @@ class LocalFile extends File { * Return the height of the image * * Returns false on error + * @return bool */ public function getHeight( $page = 1 ) { $this->load(); @@ -527,6 +533,7 @@ class LocalFile extends File { /** * Get handler-specific metadata + * @return string */ function getMetadata() { $this->load(); @@ -824,6 +831,7 @@ class LocalFile extends File { * 0 return line for current version * 1 query for old versions, return first one * 2, ... return next old version from above query + * @return bool */ public function nextHistoryLine() { # Polymorphic function name to distinguish foreign and local fetches @@ -920,6 +928,7 @@ class LocalFile extends File { /** * Record a file upload in the upload log and the image table + * @return bool */ function recordUpload( $oldver, $desc, $license = '', $copyStatus = '', $source = '', $watch = false, $timestamp = false ) @@ -939,6 +948,7 @@ class LocalFile extends File { /** * Record a file upload in the upload log and the image table + * @return bool */ function recordUpload2( $oldver, $comment, $pageText, $props = false, $timestamp = false, $user = null @@ -1336,6 +1346,7 @@ class LocalFile extends File { /** * Get the URL of the file description page. + * @return String */ function getDescriptionUrl() { return $this->title->getLocalUrl(); @@ -1345,6 +1356,7 @@ class LocalFile extends File { * Get the HTML text of the description page * This is not used by ImagePage for local files, since (among other things) * it skips the parser cache. + * @return bool|mixed */ function getDescriptionText() { global $wgParser; @@ -1634,6 +1646,7 @@ class LocalFileDeleteBatch { /** * Run the transaction + * @return \FileRepoStatus */ function execute() { global $wgUseSquid; @@ -1724,6 +1737,7 @@ class LocalFileDeleteBatch { /** * Removes non-existent files from a deletion batch. + * @return array */ function removeNonexistentFiles( $batch ) { $files = $newBatch = array(); @@ -1793,6 +1807,7 @@ class LocalFileRestoreBatch { * rows and there's no need to keep the image row locked while it's acquiring those locks * The caller may have its own transaction open. * So we save the batch and let the caller call cleanup() + * @return \FileRepoStatus */ function execute() { global $wgLang; @@ -2015,6 +2030,7 @@ class LocalFileRestoreBatch { /** * Removes non-existent files from a store batch. + * @return array */ function removeNonexistentFiles( $triplets ) { $files = $filteredTriplets = array(); @@ -2034,6 +2050,7 @@ class LocalFileRestoreBatch { /** * Removes non-existent files from a cleanup batch. + * @return array */ function removeNonexistentFromCleanup( $batch ) { $files = $newBatch = array(); @@ -2058,6 +2075,7 @@ class LocalFileRestoreBatch { /** * Delete unused files in the deleted zone. * This should be called from outside the transaction in which execute() was called. + * @return \FileRepoStatus|void */ function cleanup() { if ( !$this->cleanupBatch ) { @@ -2178,6 +2196,7 @@ class LocalFileMoveBatch { /** * Perform the move. + * @return \FileRepoStatus */ function execute() { $repo = $this->file->repo; @@ -2268,6 +2287,7 @@ class LocalFileMoveBatch { /** * Generate triplets for FileRepo::storeBatch(). + * @return array */ function getMoveTriplets() { $moves = array_merge( array( $this->cur ), $this->olds ); @@ -2285,6 +2305,7 @@ class LocalFileMoveBatch { /** * Removes non-existent files from move batch. + * @return array */ function removeNonexistentFiles( $triplets ) { $files = array(); diff --git a/includes/filerepo/file/OldLocalFile.php b/includes/filerepo/file/OldLocalFile.php index ebd83c4df0..3256a75b95 100644 --- a/includes/filerepo/file/OldLocalFile.php +++ b/includes/filerepo/file/OldLocalFile.php @@ -64,6 +64,7 @@ class OldLocalFile extends LocalFile { /** * Fields in the oldimage table + * @return array */ static function selectFields() { return array( -- 2.20.1