From: Reedy Date: Fri, 27 Apr 2012 15:40:14 +0000 (+0100) Subject: Normalising return statements X-Git-Tag: 1.31.0-rc.0~23796^2 X-Git-Url: http://git.cyclocoop.org/%24self?a=commitdiff_plain;h=2edbe14e39c856868cf58fee163b08c16abc2b2d;p=lhc%2Fweb%2Fwiklou.git Normalising return statements Add/improve parameter documentation Change-Id: I4c7fa319be60a47b7fcd81131458577bccb009fb --- diff --git a/includes/ChangesFeed.php b/includes/ChangesFeed.php index fa2188e5f6..ba3bfd6f23 100644 --- a/includes/ChangesFeed.php +++ b/includes/ChangesFeed.php @@ -51,13 +51,13 @@ class ChangesFeed { * @param $rows ResultWrapper object with rows in recentchanges table * @param $lastmod Integer: timestamp of the last item in the recentchanges table (only used for the cache key) * @param $opts FormOptions as in SpecialRecentChanges::getDefaultOptions() - * @return null or true + * @return null|bool True or null */ public function execute( $feed, $rows, $lastmod, $opts ) { global $wgLang, $wgRenderHashAppend; if ( !FeedUtils::checkFeedOutput( $this->format ) ) { - return; + return null; } $optionsHash = md5( serialize( $opts->getAllValues() ) ) . $wgRenderHashAppend; diff --git a/includes/Exception.php b/includes/Exception.php index 2d1772b7b2..539d483534 100644 --- a/includes/Exception.php +++ b/includes/Exception.php @@ -53,11 +53,11 @@ class MWException extends Exception { global $wgExceptionHooks; if ( !isset( $wgExceptionHooks ) || !is_array( $wgExceptionHooks ) ) { - return; // Just silently ignore + return null; // Just silently ignore } if ( !array_key_exists( $name, $wgExceptionHooks ) || !is_array( $wgExceptionHooks[ $name ] ) ) { - return; + return null; } $hooks = $wgExceptionHooks[ $name ]; @@ -74,6 +74,7 @@ class MWException extends Exception { return $result; } } + return null; } /** diff --git a/includes/ImagePage.php b/includes/ImagePage.php index 7453baac5a..b2393f0dfc 100644 --- a/includes/ImagePage.php +++ b/includes/ImagePage.php @@ -87,7 +87,8 @@ class ImagePage extends Article { $diffOnly = $wgRequest->getBool( 'diffonly', $wgUser->getOption( 'diffonly' ) ); if ( $this->getTitle()->getNamespace() != NS_FILE || ( isset( $diff ) && $diffOnly ) ) { - return parent::view(); + parent::view(); + return; } $this->loadFile(); @@ -97,7 +98,8 @@ class ImagePage extends Article { // mTitle is the same as the redirect target so ask Article // to perform the redirect for us. $wgRequest->setVal( 'diffonly', 'true' ); - return parent::view(); + parent::view(); + return; } else { // mTitle is not the same as the redirect target so it is // probably the redirect page itself. Fake the redirect symbol diff --git a/includes/api/ApiUpload.php b/includes/api/ApiUpload.php index 5040c70dcd..e58a1ca075 100644 --- a/includes/api/ApiUpload.php +++ b/includes/api/ApiUpload.php @@ -173,7 +173,7 @@ class ApiUpload extends ApiBase { */ private function getChunkResult(){ $result = array(); - + $result['result'] = 'Continue'; $request = $this->getMain()->getRequest(); $chunkPath = $request->getFileTempname( 'chunk' ); @@ -185,7 +185,7 @@ class ApiUpload extends ApiBase { $this->mParams['offset']); if ( !$status->isGood() ) { $this->dieUsage( $status->getWikiText(), 'stashfailed' ); - return ; + return array(); } // Check we added the last chunk: @@ -194,7 +194,7 @@ class ApiUpload extends ApiBase { if ( !$status->isGood() ) { $this->dieUsage( $status->getWikiText(), 'stashfailed' ); - return ; + return array(); } // We have a new filekey for the fully concatenated file. diff --git a/includes/filerepo/file/ArchivedFile.php b/includes/filerepo/file/ArchivedFile.php index 9b0844b6fa..05e1eb866c 100644 --- a/includes/filerepo/file/ArchivedFile.php +++ b/includes/filerepo/file/ArchivedFile.php @@ -143,7 +143,7 @@ class ArchivedFile { array( 'ORDER BY' => 'fa_timestamp DESC' ) ); if ( $res == false || $dbr->numRows( $res ) == 0 ) { // this revision does not exist? - return; + return null; } $ret = $dbr->resultObject( $res ); $row = $ret->fetchObject(); diff --git a/includes/installer/DatabaseUpdater.php b/includes/installer/DatabaseUpdater.php index fee4b2a2cc..923b9941e1 100644 --- a/includes/installer/DatabaseUpdater.php +++ b/includes/installer/DatabaseUpdater.php @@ -230,6 +230,7 @@ abstract class DatabaseUpdater { * @since 1.20 * * @param $tableName string + * @return bool */ public function tableExists( $tableName ) { return ( $this->db->tableExists( $tableName, __METHOD__ ) ); diff --git a/includes/specials/SpecialMergeHistory.php b/includes/specials/SpecialMergeHistory.php index f43b8f7221..0aa8b30ed6 100644 --- a/includes/specials/SpecialMergeHistory.php +++ b/includes/specials/SpecialMergeHistory.php @@ -90,7 +90,8 @@ class SpecialMergeHistory extends SpecialPage { $this->outputHeader(); if( $this->mTargetID && $this->mDestID && $this->mAction == 'submit' && $this->mMerge ) { - return $this->merge(); + $this->merge(); + return; } if ( !$this->mSubmitted ) { diff --git a/includes/specials/SpecialSearch.php b/includes/specials/SpecialSearch.php index 3fa86875d6..a6d75bbe23 100644 --- a/includes/specials/SpecialSearch.php +++ b/includes/specials/SpecialSearch.php @@ -174,7 +174,8 @@ class SpecialSearch extends SpecialPage { $t = Title::newFromText( $term ); # If the string cannot be used to create a title if( is_null( $t ) ) { - return $this->showResults( $term ); + $this->showResults( $term ); + return; } # If there's an exact or very near match, jump right there. $t = SearchEngine::getNearMatch( $term ); @@ -201,7 +202,7 @@ class SpecialSearch extends SpecialPage { return; } } - return $this->showResults( $term ); + $this->showResults( $term ); } /**