Normalising return statements
authorReedy <reedy@wikimedia.org>
Fri, 27 Apr 2012 15:40:14 +0000 (16:40 +0100)
committerReedy <reedy@wikimedia.org>
Fri, 27 Apr 2012 15:40:14 +0000 (16:40 +0100)
Add/improve parameter documentation

Change-Id: I4c7fa319be60a47b7fcd81131458577bccb009fb

includes/ChangesFeed.php
includes/Exception.php
includes/ImagePage.php
includes/api/ApiUpload.php
includes/filerepo/file/ArchivedFile.php
includes/installer/DatabaseUpdater.php
includes/specials/SpecialMergeHistory.php
includes/specials/SpecialSearch.php

index fa2188e..ba3bfd6 100644 (file)
@@ -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;
index 2d1772b..539d483 100644 (file)
@@ -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;
        }
 
        /**
index 7453baa..b2393f0 100644 (file)
@@ -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
index 5040c70..e58a1ca 100644 (file)
@@ -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.
index 9b0844b..05e1eb8 100644 (file)
@@ -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();
index fee4b2a..923b994 100644 (file)
@@ -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__ ) );
index f43b8f7..0aa8b30 100644 (file)
@@ -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 ) {
index 3fa8687..a6d75bb 100644 (file)
@@ -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 );
        }
 
        /**