Tidy up some unbalanced returns in methods
authorReedy <reedy@wikimedia.org>
Sun, 9 Dec 2012 02:59:04 +0000 (02:59 +0000)
committerReedy <reedy@wikimedia.org>
Sun, 9 Dec 2012 02:59:04 +0000 (02:59 +0000)
Leave a TODO

Change-Id: Ic49ac8630650b341aafb3c17abd22f3a07805d27

13 files changed:
includes/ChangesList.php
includes/ConfEditor.php
includes/OutputPage.php
includes/QueryPage.php
includes/UserMailer.php
includes/WebRequest.php
includes/db/LoadBalancer.php
includes/filebackend/lockmanager/MemcLockManager.php
includes/filerepo/file/File.php
includes/installer/DatabaseUpdater.php
includes/installer/MysqlUpdater.php
includes/installer/WebInstallerPage.php
includes/specials/SpecialUndelete.php

index 9ca64c5..f8dbf3b 100644 (file)
@@ -435,6 +435,7 @@ class ChangesList extends ContextSource {
                                return Linker::commentBlock( $rc->mAttribs['rc_comment'], $rc->getTitle() );
                        }
                }
+               return '';
        }
 
        /**
index d304e65..e563416 100644 (file)
@@ -1060,6 +1060,7 @@ class ConfEditorParseError extends MWException {
                                return "$line\n" .str_repeat( ' ', $this->colNum - 1 ) . "^\n";
                        }
                }
+               return '';
        }
 
 }
index 7649b23..868c786 100644 (file)
@@ -777,6 +777,7 @@ class OutputPage extends ContextSource {
                if ( isset( $this->mPageTitleActionText ) ) {
                        return $this->mPageTitleActionText;
                }
+               return '';
        }
 
        /**
index 1f21584..31df316 100644 (file)
@@ -652,7 +652,7 @@ abstract class QueryPage extends SpecialPage {
 
                if ( !$wgFeed ) {
                        $this->getOutput()->addWikiMsg( 'feed-unavailable' );
-                       return;
+                       return false;
                }
 
                global $wgFeedLimit;
index 8d1ed68..f5e9568 100644 (file)
@@ -780,13 +780,15 @@ class EmailNotification {
        /**
         * Same as sendPersonalised but does impersonal mail suitable for bulk
         * mailing.  Takes an array of MailAddress objects.
-        * @return Status
+        * @param $addresses array
+        * @return Status|null
         */
        function sendImpersonal( $addresses ) {
                global $wgContLang;
 
-               if ( empty( $addresses ) )
-                       return;
+               if ( empty( $addresses ) ) {
+                       return null;
+               }
 
                $body = str_replace(
                                array( '$WATCHINGUSERNAME',
index e251ac5..ec731b4 100644 (file)
@@ -1335,8 +1335,10 @@ class FauxRequest extends WebRequest {
         * @return mixed
         */
        public function getSessionData( $key ) {
-               if( isset( $this->session[$key] ) )
+               if( isset( $this->session[$key] ) ) {
                        return $this->session[$key];
+               }
+               return null;
        }
 
        /**
index 7e5feea..8ba5f4f 100644 (file)
@@ -954,10 +954,11 @@ class LoadBalancer {
         * @return bool
         */
        function allowLagged( $mode = null ) {
-               if ( $mode === null) {
+               if ( $mode === null ) {
                        return $this->mAllowLagged;
                }
                $this->mAllowLagged = $mode;
+               return $this->mAllowLagged;
        }
 
        /**
index 26a5e2d..b8e25e7 100644 (file)
@@ -111,7 +111,7 @@ class MemcLockManager extends QuorumLockManager {
                        foreach ( $paths as $path ) {
                                $status->fatal( 'lockmanager-fail-acquirelock', $path );
                        }
-                       return;
+                       return; // FIXME: Should return a Status object
                }
 
                // Fetch all the existing lock records...
index c1abe61..9adcc99 100644 (file)
@@ -1800,7 +1800,7 @@ abstract class File {
        }
 
        /**
-        * @return Title
+        * @return Title|null
         */
        function getRedirectedTitle() {
                if ( $this->redirected ) {
@@ -1809,6 +1809,7 @@ abstract class File {
                        }
                        return $this->redirectTitle;
                }
+               return null;
        }
 
        /**
index b200dcf..bdde978 100644 (file)
@@ -817,7 +817,7 @@ abstract class DatabaseUpdater {
        protected function doUpdateTranscacheField() {
                if ( $this->updateRowExists( 'convert transcache field' ) ) {
                        $this->output( "...transcache tc_time already converted.\n" );
-                       return;
+                       return true;
                }
 
                return $this->applyPatch( 'patch-tc-timestamp.sql', false,
index 06ec158..bbeb685 100644 (file)
@@ -790,9 +790,8 @@ class MysqlUpdater extends DatabaseUpdater {
                } elseif ( $this->db->fieldExists( 'profiling', 'pf_memory', __METHOD__ ) ) {
                        $this->output( "...profiling table has pf_memory field.\n" );
                        return true;
-               } else {
-                       $this->applyPatch( 'patch-profiling-memory.sql', false, "Adding pf_memory field to table profiling" );
                }
+               return $this->applyPatch( 'patch-profiling-memory.sql', false, "Adding pf_memory field to table profiling" );
        }
 
        protected function doFilearchiveIndicesUpdate() {
index a193afb..f1340d7 100644 (file)
@@ -422,6 +422,7 @@ class WebInstaller_Welcome extends WebInstallerPage {
                } else {
                        $this->parent->showStatusMessage( $status );
                }
+               return '';
        }
 
 }
index 0d2ac7e..808f9b3 100644 (file)
@@ -826,7 +826,7 @@ class SpecialUndelete extends SpecialPage {
 
                if( $result->numRows() == 0 ) {
                        $out->addWikiMsg( 'undelete-no-results' );
-                       return;
+                       return false;
                }
 
                $out->addWikiMsg( 'undeletepagetext', $this->getLanguage()->formatNum( $result->numRows() ) );