From d0a242abb4b161b8be9a31054ca86509601cd441 Mon Sep 17 00:00:00 2001 From: Reedy Date: Sun, 9 Dec 2012 02:59:04 +0000 Subject: [PATCH] Tidy up some unbalanced returns in methods Leave a TODO Change-Id: Ic49ac8630650b341aafb3c17abd22f3a07805d27 --- includes/ChangesList.php | 1 + includes/ConfEditor.php | 1 + includes/OutputPage.php | 1 + includes/QueryPage.php | 2 +- includes/UserMailer.php | 8 +++++--- includes/WebRequest.php | 4 +++- includes/db/LoadBalancer.php | 3 ++- includes/filebackend/lockmanager/MemcLockManager.php | 2 +- includes/filerepo/file/File.php | 3 ++- includes/installer/DatabaseUpdater.php | 2 +- includes/installer/MysqlUpdater.php | 3 +-- includes/installer/WebInstallerPage.php | 1 + includes/specials/SpecialUndelete.php | 2 +- 13 files changed, 21 insertions(+), 12 deletions(-) diff --git a/includes/ChangesList.php b/includes/ChangesList.php index 9ca64c5b6a..f8dbf3b02a 100644 --- a/includes/ChangesList.php +++ b/includes/ChangesList.php @@ -435,6 +435,7 @@ class ChangesList extends ContextSource { return Linker::commentBlock( $rc->mAttribs['rc_comment'], $rc->getTitle() ); } } + return ''; } /** diff --git a/includes/ConfEditor.php b/includes/ConfEditor.php index d304e65ee2..e563416c16 100644 --- a/includes/ConfEditor.php +++ b/includes/ConfEditor.php @@ -1060,6 +1060,7 @@ class ConfEditorParseError extends MWException { return "$line\n" .str_repeat( ' ', $this->colNum - 1 ) . "^\n"; } } + return ''; } } diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 7649b23ee9..868c7865eb 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -777,6 +777,7 @@ class OutputPage extends ContextSource { if ( isset( $this->mPageTitleActionText ) ) { return $this->mPageTitleActionText; } + return ''; } /** diff --git a/includes/QueryPage.php b/includes/QueryPage.php index 1f21584080..31df316881 100644 --- a/includes/QueryPage.php +++ b/includes/QueryPage.php @@ -652,7 +652,7 @@ abstract class QueryPage extends SpecialPage { if ( !$wgFeed ) { $this->getOutput()->addWikiMsg( 'feed-unavailable' ); - return; + return false; } global $wgFeedLimit; diff --git a/includes/UserMailer.php b/includes/UserMailer.php index 8d1ed6812f..f5e9568985 100644 --- a/includes/UserMailer.php +++ b/includes/UserMailer.php @@ -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', diff --git a/includes/WebRequest.php b/includes/WebRequest.php index e251ac5bb5..ec731b44a4 100644 --- a/includes/WebRequest.php +++ b/includes/WebRequest.php @@ -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; } /** diff --git a/includes/db/LoadBalancer.php b/includes/db/LoadBalancer.php index 7e5feea44b..8ba5f4f80b 100644 --- a/includes/db/LoadBalancer.php +++ b/includes/db/LoadBalancer.php @@ -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; } /** diff --git a/includes/filebackend/lockmanager/MemcLockManager.php b/includes/filebackend/lockmanager/MemcLockManager.php index 26a5e2da8e..b8e25e72a9 100644 --- a/includes/filebackend/lockmanager/MemcLockManager.php +++ b/includes/filebackend/lockmanager/MemcLockManager.php @@ -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... diff --git a/includes/filerepo/file/File.php b/includes/filerepo/file/File.php index c1abe61002..9adcc99635 100644 --- a/includes/filerepo/file/File.php +++ b/includes/filerepo/file/File.php @@ -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; } /** diff --git a/includes/installer/DatabaseUpdater.php b/includes/installer/DatabaseUpdater.php index b200dcf161..bdde9780f6 100644 --- a/includes/installer/DatabaseUpdater.php +++ b/includes/installer/DatabaseUpdater.php @@ -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, diff --git a/includes/installer/MysqlUpdater.php b/includes/installer/MysqlUpdater.php index 06ec158732..bbeb685c0a 100644 --- a/includes/installer/MysqlUpdater.php +++ b/includes/installer/MysqlUpdater.php @@ -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() { diff --git a/includes/installer/WebInstallerPage.php b/includes/installer/WebInstallerPage.php index a193afb714..f1340d79b7 100644 --- a/includes/installer/WebInstallerPage.php +++ b/includes/installer/WebInstallerPage.php @@ -422,6 +422,7 @@ class WebInstaller_Welcome extends WebInstallerPage { } else { $this->parent->showStatusMessage( $status ); } + return ''; } } diff --git a/includes/specials/SpecialUndelete.php b/includes/specials/SpecialUndelete.php index 0d2ac7eb8d..808f9b34a1 100644 --- a/includes/specials/SpecialUndelete.php +++ b/includes/specials/SpecialUndelete.php @@ -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() ) ); -- 2.20.1