r113103 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r113102‎ | r113103 | r113104 >
Date:23:05, 5 March 2012
Author:reedy
Status:ok
Tags:
Comment:
Normalise method returns, and returned value usage


Documentation fixes
Modified paths:
  • /trunk/phase3/includes/specials/SpecialUserlogin.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/specials/SpecialUserlogin.php
@@ -167,11 +167,14 @@
168168 return;
169169 } elseif( $this->mPosted ) {
170170 if( $this->mCreateaccount ) {
171 - return $this->addNewAccount();
 171+ $this->addNewAccount();
 172+ return;
172173 } elseif ( $this->mCreateaccountMail ) {
173 - return $this->addNewAccountMailPassword();
 174+ $this->addNewAccountMailPassword();
 175+ return;
174176 } elseif ( ( 'submitlogin' == $this->mAction ) || $this->mLoginattempt ) {
175 - return $this->processLogin();
 177+ $this->processLogin();
 178+ return;
176179 }
177180 }
178181 $this->mainLoginForm( '' );
@@ -213,7 +216,7 @@
214217
215218 /**
216219 * @private
217 - * @return bool|void
 220+ * @return bool
218221 */
219222 function addNewAccount() {
220223 global $wgUser, $wgEmailAuthentication, $wgLoginLanguageSelector;
@@ -221,7 +224,7 @@
222225 # Create the account and abort if there's a problem doing so
223226 $u = $this->addNewAccountInternal();
224227 if( $u == null ) {
225 - return;
 228+ return false;
226229 }
227230
228231 # If we showed up language selection links, and one was in use, be
@@ -258,9 +261,9 @@
259262 wfRunHooks( 'AddNewAccount', array( $u, false ) );
260263 $u->addNewUserLogEntry();
261264 if( $this->hasSessionCookie() ) {
262 - return $this->successfulCreation();
 265+ $this->successfulCreation();
263266 } else {
264 - return $this->cookieRedirectCheck( 'new' );
 267+ $this->cookieRedirectCheck( 'new' );
265268 }
266269 } else {
267270 # Confirm that the account was created
@@ -269,8 +272,8 @@
270273 $out->returnToMain( false, $this->getTitle() );
271274 wfRunHooks( 'AddNewAccount', array( $u, false ) );
272275 $u->addNewUserLogEntry( false, $this->mReason );
273 - return true;
274276 }
 277+ return true;
275278 }
276279
277280 /**
@@ -746,9 +749,9 @@
747750 $userLang = Language::factory( $code );
748751 $wgLang = $userLang;
749752 $this->getContext()->setLanguage( $userLang );
750 - return $this->successfulLogin();
 753+ $this->successfulLogin();
751754 } else {
752 - return $this->cookieRedirectCheck( 'login' );
 755+ $this->cookieRedirectCheck( 'login' );
753756 }
754757 break;
755758
@@ -768,7 +771,7 @@
769772 case self::NOT_EXISTS:
770773 if( $this->getUser()->isAllowed( 'createaccount' ) ) {
771774 $this->mainLoginForm( $this->msg( 'nosuchuser',
772 - wfEscapeWikiText( $this->mUsername ) )->parse() );
 775+ wfEscapeWikiText( $this->mUsername ) )->parse() );
773776 } else {
774777 $this->mainLoginForm( $this->msg( 'nosuchusershort',
775778 wfEscapeWikiText( $this->mUsername ) )->text() );
@@ -899,6 +902,8 @@
900903
901904 /**
902905 * Display a "login successful" page.
 906+ * @param $msgname string
 907+ * @param $injected_html string
903908 */
904909 private function displaySuccessfulLogin( $msgname, $injected_html ) {
905910 $out = $this->getOutput();
@@ -1185,7 +1190,6 @@
11861191
11871192 /**
11881193 * @private
1189 - * @return void
11901194 */
11911195 function cookieRedirectCheck( $type ) {
11921196 $titleObj = SpecialPage::getTitleFor( 'Userlogin' );
@@ -1195,7 +1199,7 @@
11961200 }
11971201 $check = $titleObj->getFullURL( $query );
11981202
1199 - return $this->getOutput()->redirect( $check );
 1203+ $this->getOutput()->redirect( $check );
12001204 }
12011205
12021206 /**
@@ -1204,15 +1208,15 @@
12051209 function onCookieRedirectCheck( $type ) {
12061210 if ( !$this->hasSessionCookie() ) {
12071211 if ( $type == 'new' ) {
1208 - return $this->mainLoginForm( $this->msg( 'nocookiesnew' )->parse() );
 1212+ $this->mainLoginForm( $this->msg( 'nocookiesnew' )->parse() );
12091213 } elseif ( $type == 'login' ) {
1210 - return $this->mainLoginForm( $this->msg( 'nocookieslogin' )->parse() );
 1214+ $this->mainLoginForm( $this->msg( 'nocookieslogin' )->parse() );
12111215 } else {
12121216 # shouldn't happen
1213 - return $this->mainLoginForm( $this->msg( 'error' )->text() );
 1217+ $this->mainLoginForm( $this->msg( 'error' )->text() );
12141218 }
12151219 } else {
1216 - return $this->successfulLogin();
 1220+ $this->successfulLogin();
12171221 }
12181222 }
12191223

Status & tagging log