From 8bfd19b451649c88225670fe657b4a7aebf18f5d Mon Sep 17 00:00:00 2001 From: Sam Reed Date: Fri, 17 Jun 2011 16:05:35 +0000 Subject: [PATCH] Swap else if for elseif Trimming trailing whitespace also Doing in 3 commits (3/3), so hopefully reviewable in CR... --- includes/Title.php | 16 ++++++++-------- includes/User.php | 8 ++++---- includes/WebRequest.php | 16 ++++++++-------- includes/Wiki.php | 8 ++++---- includes/Xml.php | 14 +++++++------- includes/specials/SpecialRevisiondelete.php | 4 ++-- includes/specials/SpecialUndelete.php | 4 ++-- includes/specials/SpecialUnlockdb.php | 2 +- languages/Language.php | 18 +++++++++--------- languages/classes/LanguageEo.php | 2 +- languages/classes/LanguageSr.php | 2 +- languages/classes/LanguageWa.php | 4 ++-- maintenance/Maintenance.php | 2 +- maintenance/fuzz-tester.php | 10 +++++----- maintenance/importImages.php | 4 ++-- maintenance/language/checkDupeMessages.php | 10 +++++----- maintenance/populateLogSearch.php | 6 +++--- maintenance/updateRestrictions.php | 2 +- tests/RunSeleniumTests.php | 2 +- tests/parser/parserTestsStaticParserHook.php | 2 +- tests/phpunit/includes/TitlePermissionTest.php | 2 +- 21 files changed, 69 insertions(+), 69 deletions(-) diff --git a/includes/Title.php b/includes/Title.php index 441f2917db..d06b322d3e 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -1283,13 +1283,13 @@ class Title { if ( is_array( $result ) && count( $result ) && !is_array( $result[0] ) ) { // A single array representing an error $errors[] = $result; - } else if ( is_array( $result ) && is_array( $result[0] ) ) { + } elseif ( is_array( $result ) && is_array( $result[0] ) ) { // A nested array representing multiple errors $errors = array_merge( $errors, $result ); - } else if ( $result !== '' && is_string( $result ) ) { + } elseif ( $result !== '' && is_string( $result ) ) { // A string representing a message-id $errors[] = array( $result ); - } else if ( $result === false ) { + } elseif ( $result === false ) { // a generic "We don't want them to do that" $errors[] = array( 'badaccess-group0' ); } @@ -1377,7 +1377,7 @@ class Title { && !preg_match( '/^' . preg_quote( $user->getName(), '/' ) . '\//', $this->mTextform ) ) { if ( $this->isCssSubpage() && !$user->isAllowed( 'editusercss' ) ) { $errors[] = array( 'customcssprotected' ); - } else if ( $this->isJsSubpage() && !$user->isAllowed( 'edituserjs' ) ) { + } elseif ( $this->isJsSubpage() && !$user->isAllowed( 'edituserjs' ) ) { $errors[] = array( 'customjsprotected' ); } } @@ -2022,7 +2022,7 @@ class Title { if ( isset( $this->mCascadeSources ) && $getPages ) { return array( $this->mCascadeSources, $this->mCascadingRestrictions ); - } else if ( isset( $this->mHasCascadingRestrictions ) && !$getPages ) { + } elseif ( isset( $this->mHasCascadingRestrictions ) && !$getPages ) { return array( $this->mHasCascadingRestrictions, $pagerestrictions ); } @@ -2617,7 +2617,7 @@ class Title { if ( $wgContLang->getNsIndex( $x[1] ) ) { # Disallow Talk:File:x type titles... return false; - } else if ( Interwiki::isValidInterwiki( $x[1] ) ) { + } elseif ( Interwiki::isValidInterwiki( $x[1] ) ) { # Disallow Talk:Interwiki:x type titles... return false; } @@ -3163,7 +3163,7 @@ class Title { $u->doUpdate(); $dbw->commit(); - + # Update site_stats if ( $this->isContentPage() && !$nt->isContentPage() ) { # No longer a content page @@ -3656,7 +3656,7 @@ class Title { * @return String: MW timestamp */ public function getEarliestRevTime( $flags = 0 ) { - $rev = $this->getFirstRevision( $flags ); + $rev = $this->getFirstRevision( $flags ); return $rev ? $rev->getTimestamp() : null; } diff --git a/includes/User.php b/includes/User.php index d21693a901..80c2962138 100644 --- a/includes/User.php +++ b/includes/User.php @@ -925,7 +925,7 @@ class User { return false; } $wgRequest->setSessionData( 'wsUserID', $sId ); - } else if ( $sessId !== null && $sessId != 0 ) { + } elseif ( $sessId !== null && $sessId != 0 ) { $sId = $sessId; } else { $this->loadDefaults(); @@ -934,7 +934,7 @@ class User { if ( $wgRequest->getSessionData( 'wsUserName' ) !== null ) { $sName = $wgRequest->getSessionData( 'wsUserName' ); - } else if ( $wgRequest->getCookie( 'UserName' ) !== null ) { + } elseif ( $wgRequest->getCookie( 'UserName' ) !== null ) { $sName = $wgRequest->getCookie( 'UserName' ); $wgRequest->setSessionData( 'wsUserName', $sName ); } else { @@ -959,7 +959,7 @@ class User { if ( $wgRequest->getSessionData( 'wsToken' ) !== null ) { $passwordCorrect = $proposedUser->getToken() === $wgRequest->getSessionData( 'wsToken' ); $from = 'session'; - } else if ( $wgRequest->getCookie( 'Token' ) !== null ) { + } elseif ( $wgRequest->getCookie( 'Token' ) !== null ) { $passwordCorrect = $proposedUser->getToken() === $wgRequest->getCookie( 'Token' ); $from = 'cookie'; } else { @@ -1492,7 +1492,7 @@ class User { // User is already an IP? if( IP::isIPAddress( $this->getName() ) ) { $ip = $this->getName(); - } else if( !$ip ) { + } elseif( !$ip ) { $ip = wfGetIP(); } $blocked = false; diff --git a/includes/WebRequest.php b/includes/WebRequest.php index 5a883eb7e5..b338261095 100644 --- a/includes/WebRequest.php +++ b/includes/WebRequest.php @@ -806,7 +806,7 @@ class WebRequest { } /** - * Check if Internet Explorer will detect an incorrect cache extension in + * Check if Internet Explorer will detect an incorrect cache extension in * PATH_INFO or QUERY_STRING. If the request can't be allowed, show an error * message or redirect to a safer URL. Returns true if the URL is OK, and * false if an error message has been shown and the request should be aborted. @@ -825,14 +825,14 @@ class WebRequest { } wfHttpError( 403, 'Forbidden', 'Invalid file extension found in the path info or query string.' ); - + return false; } return true; } /** - * Attempt to redirect to a URL with a QUERY_STRING that's not dangerous in + * Attempt to redirect to a URL with a QUERY_STRING that's not dangerous in * IE 6. Returns true if it was successful, false otherwise. */ protected function doSecurityRedirect( $url ) { @@ -847,11 +847,11 @@ class WebRequest {

Security redirect

-We can't serve non-HTML content from the URL you have requested, because +We can't serve non-HTML content from the URL you have requested, because Internet Explorer would interpret it as an incorrect and potentially dangerous content type.

-

Instead, please use this URL, which is the same as the URL you have requested, except that -"&*" is appended. This prevents Internet Explorer from seeing a bogus file +

Instead, please use this URL, which is the same as the URL you have requested, except that +"&*" is appended. This prevents Internet Explorer from seeing a bogus file extension.

@@ -877,7 +877,7 @@ HTML; * QUERY_STRING, since IE 6 and earlier will use this to get the file type * if there was no dot before the question mark (bug 28235). * - * @deprecated Use checkUrlExtension(). + * @deprecated Use checkUrlExtension(). */ public function isPathInfoBad( $extWhitelist = array() ) { global $wgScriptExtension; @@ -916,7 +916,7 @@ HTML; foreach ( $langs as $lang => $val ) { if ( $val === '' ) { $langs[$lang] = 1; - } else if ( $val == 0 ) { + } elseif ( $val == 0 ) { unset($langs[$lang]); } } diff --git a/includes/Wiki.php b/includes/Wiki.php index 8e71aac32f..3a1d88127e 100644 --- a/includes/Wiki.php +++ b/includes/Wiki.php @@ -126,10 +126,10 @@ class MediaWiki { // If the user is not logged in, the Namespace:title of the article must be in // the Read array in order for the user to see it. (We have to check here to // catch special pages etc. We check again in Article::view()) - } else if ( !$title->userCanRead() ) { + } elseif ( !$title->userCanRead() ) { $output->loginToUse(); // Interwiki redirects - } else if ( $title->getInterwiki() != '' ) { + } elseif ( $title->getInterwiki() != '' ) { $rdfrom = $request->getVal( 'rdfrom' ); if ( $rdfrom ) { $url = $title->getFullURL( 'rdfrom=' . urlencode( $rdfrom ) ); @@ -148,7 +148,7 @@ class MediaWiki { throw new ErrorPageError( 'badtitle', 'badtitletext' ); } // Redirect loops, no title in URL, $wgUsePathInfo URLs, and URLs with a variant - } else if ( $request->getVal( 'action', 'view' ) == 'view' && !$request->wasPosted() + } elseif ( $request->getVal( 'action', 'view' ) == 'view' && !$request->wasPosted() && ( $request->getVal( 'title' ) === null || $title->getPrefixedDBKey() != $request->getVal( 'title' ) ) && !count( array_diff( array_keys( $request->getValues() ), array( 'action', 'title' ) ) ) ) { @@ -186,7 +186,7 @@ class MediaWiki { $output->redirect( $targetUrl, '301' ); } // Special pages - } else if ( NS_SPECIAL == $title->getNamespace() ) { + } elseif ( NS_SPECIAL == $title->getNamespace() ) { // actions that need to be made when we have a special pages SpecialPageFactory::executePath( $title, $this->context ); } else { diff --git a/includes/Xml.php b/includes/Xml.php index e25d436f81..b0b0938c24 100644 --- a/includes/Xml.php +++ b/includes/Xml.php @@ -191,7 +191,7 @@ class Xml { } if( $year ) { $encYear = intval( $year ); - } else if( $encMonth ) { + } elseif( $encMonth ) { $thisMonth = intval( gmdate( 'n' ) ); $thisYear = intval( gmdate( 'Y' ) ); if( intval($encMonth) > $thisMonth ) { @@ -351,9 +351,9 @@ class Xml { * Convenience function to build an HTML form label * @param $label String text of the label * @param $id - * @param $attribs Array an attribute array. This will usuall be + * @param $attribs Array an attribute array. This will usuall be * the same array as is passed to the corresponding input element, - * so this function will cherry-pick appropriate attributes to + * so this function will cherry-pick appropriate attributes to * apply to the label as well; currently only class is applied. * @return string HTML */ @@ -646,8 +646,8 @@ class Xml { } /** - * Create a call to a JavaScript function. The supplied arguments will be - * encoded using Xml::encodeJsVar(). + * Create a call to a JavaScript function. The supplied arguments will be + * encoded using Xml::encodeJsVar(). * * @param $name String The name of the function to call, or a JavaScript expression * which evaluates to a function object which is called. @@ -904,8 +904,8 @@ class XmlSelect { } /** - * A wrapper class which causes Xml::encodeJsVar() and Xml::encodeJsCall() to - * interpret a given string as being a JavaScript expression, instead of string + * A wrapper class which causes Xml::encodeJsVar() and Xml::encodeJsCall() to + * interpret a given string as being a JavaScript expression, instead of string * data. * * Example: diff --git a/includes/specials/SpecialRevisiondelete.php b/includes/specials/SpecialRevisiondelete.php index 1798b64a04..99226027c4 100644 --- a/includes/specials/SpecialRevisiondelete.php +++ b/includes/specials/SpecialRevisiondelete.php @@ -116,7 +116,7 @@ class SpecialRevisionDelete extends UnlistedSpecialPage { if( !$user->isAllowed( 'deletedhistory' ) ) { $output->permissionRequired( 'deletedhistory' ); return; - } else if( wfReadOnly() ) { + } elseif( wfReadOnly() ) { $output->readOnlyPage(); return; } @@ -588,7 +588,7 @@ class SpecialRevisionDelete extends UnlistedSpecialPage { foreach( $bitPars as $const => $val ) { if( $val == 1 ) { $newBits |= $const; // $const is the *_deleted const - } else if( $val == -1 ) { + } elseif( $val == -1 ) { $newBits |= ($oldfield & $const); // use existing } } diff --git a/includes/specials/SpecialUndelete.php b/includes/specials/SpecialUndelete.php index 028b28d2ef..943de948ea 100644 --- a/includes/specials/SpecialUndelete.php +++ b/includes/specials/SpecialUndelete.php @@ -691,7 +691,7 @@ class SpecialUndelete extends SpecialPage { if ( !$file->exists() ) { $wgOut->addWikiMsg( 'filedelete-nofile', $this->mFilename ); return; - } else if( !$file->userCan( File::DELETED_FILE ) ) { + } elseif( !$file->userCan( File::DELETED_FILE ) ) { if( $file->isDeleted( File::DELETED_RESTRICTED ) ) { $wgOut->permissionRequired( 'suppressrevision' ); } else { @@ -1253,7 +1253,7 @@ class SpecialUndelete extends SpecialPage { if( !$rev->userCan( Revision::DELETED_TEXT ) ) { $pageLink = htmlspecialchars( $wgLang->timeanddate( $ts, true ) ); $last = wfMsgHtml( 'diff' ); - } else if( $remaining > 0 || ( $earliestLiveTime && $ts > $earliestLiveTime ) ) { + } elseif( $remaining > 0 || ( $earliestLiveTime && $ts > $earliestLiveTime ) ) { $pageLink = $this->getPageLink( $rev, $titleObj, $ts, $sk ); $last = $sk->linkKnown( $titleObj, diff --git a/includes/specials/SpecialUnlockdb.php b/includes/specials/SpecialUnlockdb.php index 88cd50e1b4..5fbf38aa2d 100644 --- a/includes/specials/SpecialUnlockdb.php +++ b/includes/specials/SpecialUnlockdb.php @@ -48,7 +48,7 @@ class SpecialUnlockdb extends SpecialPage { if ( $action == 'success' ) { $this->showSuccess(); - } else if ( $action == 'submit' && $wgRequest->wasPosted() && + } elseif ( $action == 'submit' && $wgRequest->wasPosted() && $wgUser->matchEditToken( $wgRequest->getVal( 'wpEditToken' ) ) ) { $this->doSubmit(); } else { diff --git a/languages/Language.php b/languages/Language.php index cc0062b0ff..7ada2cab5f 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -778,7 +778,7 @@ class Language { if ( isset( $wgLocalTZoffset ) ) { $minDiff = $wgLocalTZoffset; } - } else if ( $data[0] == 'Offset' ) { + } elseif ( $data[0] == 'Offset' ) { $minDiff = intval( $data[1] ); } else { $data = explode( ':', $tz ); @@ -1469,9 +1469,9 @@ class Language { $c = intval( ( $Mar + 3 * ( $year - 1 ) + 5 * $b + 5 ) % 7 ); if ( $c == 0 && $a > 11 && $m >= 0.89772376543210 ) { $Mar++; - } else if ( $c == 1 && $a > 6 && $m >= 0.63287037037037 ) { + } elseif ( $c == 1 && $a > 6 && $m >= 0.63287037037037 ) { $Mar += 2; - } else if ( $c == 2 || $c == 4 || $c == 6 ) { + } elseif ( $c == 2 || $c == 4 || $c == 6 ) { $Mar++; } @@ -1501,12 +1501,12 @@ class Language { # Add 543 years to the Gregorian calendar # Months and days are identical $gy_offset = $gy + 543; - } else if ( ( !strcmp( $cName, 'minguo' ) ) || !strcmp( $cName, 'juche' ) ) { + } elseif ( ( !strcmp( $cName, 'minguo' ) ) || !strcmp( $cName, 'juche' ) ) { # Minguo dates # Deduct 1911 years from the Gregorian calendar # Months and days are identical $gy_offset = $gy - 1911; - } else if ( !strcmp( $cName, 'tenno' ) ) { + } elseif ( !strcmp( $cName, 'tenno' ) ) { # Nengō dates up to Meiji period # Deduct years from the Gregorian calendar # depending on the nengo periods @@ -1519,7 +1519,7 @@ class Language { $gy_offset = '元'; } $gy_offset = '明治' . $gy_offset; - } else if ( + } elseif ( ( ( $gy == 1912 ) && ( $gm == 7 ) && ( $gd == 31 ) ) || ( ( $gy == 1912 ) && ( $gm >= 8 ) ) || ( ( $gy > 1912 ) && ( $gy < 1926 ) ) || @@ -1534,7 +1534,7 @@ class Language { $gy_offset = '元'; } $gy_offset = '大正' . $gy_offset; - } else if ( + } elseif ( ( ( $gy == 1926 ) && ( $gm == 12 ) && ( $gd >= 26 ) ) || ( ( $gy > 1926 ) && ( $gy < 1989 ) ) || ( ( $gy == 1989 ) && ( $gm == 1 ) && ( $gd < 8 ) ) @@ -2586,7 +2586,7 @@ class Language { for ( $i = $m; $i >= 0; $i-- ) { if ( $i == $m ) { $s = $l[$i]; - } else if ( $i == $m - 1 ) { + } elseif ( $i == $m - 1 ) { $s = $l[$i] . $this->getMessageFromDB( 'and' ) . $this->getMessageFromDB( 'word-separator' ) . $s; } else { $s = $l[$i] . $this->getMessageFromDB( 'comma-separator' ) . $s; @@ -2898,7 +2898,7 @@ class Language { if ( $tag != '' ) { if ( $tagType == 0 && $lastCh != '/' ) { $openTags[] = $tag; // tag opened (didn't close itself) - } else if ( $tagType == 1 ) { + } elseif ( $tagType == 1 ) { if ( $openTags && $tag == $openTags[count( $openTags ) - 1] ) { array_pop( $openTags ); // tag closed } diff --git a/languages/classes/LanguageEo.php b/languages/classes/LanguageEo.php index 07fe6fd97d..af058a3e63 100644 --- a/languages/classes/LanguageEo.php +++ b/languages/classes/LanguageEo.php @@ -42,7 +42,7 @@ class LanguageEo extends Language { return preg_replace_callback ( '/([cghjsu]x?)((?:xx)*)(?!x)/i', array( $this, 'strrtxuCallback' ), $string ); - } else if ( strcasecmp( $in, 'UTF-8' ) == 0 && strcasecmp( $out, 'x' ) == 0 ) { + } elseif ( strcasecmp( $in, 'UTF-8' ) == 0 && strcasecmp( $out, 'x' ) == 0 ) { # Double Xs only if they follow cxapelutaj literoj. return preg_replace_callback( '/((?:[cghjsu]|\xc4[\x88\x89\x9c\x9d\xa4\xa5\xb4\xb5]|\xc5[\x9c\x9d\xac\xad])x*)/i', diff --git a/languages/classes/LanguageSr.php b/languages/classes/LanguageSr.php index 466887d572..2c1f7acdf0 100644 --- a/languages/classes/LanguageSr.php +++ b/languages/classes/LanguageSr.php @@ -191,7 +191,7 @@ class SrConverter extends LanguageConverter { if( $variant == 'sr-ec' ) { return $numCyrillic > $numLatin; - } else if( $variant == 'sr-el' ) { + } elseif( $variant == 'sr-el' ) { return $numLatin > $numCyrillic; } else { return false; diff --git a/languages/classes/LanguageWa.php b/languages/classes/LanguageWa.php index 25e52aefc9..4a18663807 100644 --- a/languages/classes/LanguageWa.php +++ b/languages/classes/LanguageWa.php @@ -62,10 +62,10 @@ class LanguageWa extends Language { if ( $n == 1 ) { $d = "1î d' " . $this->getMonthName( $m ) . " " . substr( $ts, 0, 4 ); - } else if ( $n == 2 || $n == 3 || $n == 20 || $n == 22 || $n == 23 ) { + } elseif ( $n == 2 || $n == 3 || $n == 20 || $n == 22 || $n == 23 ) { $d = ( 0 + $n ) . " d' " . $this->getMonthName( $m ) . " " . substr( $ts, 0, 4 ); - } else if ( $m == 4 || $m == 8 || $m == 10 ) { + } elseif ( $m == 4 || $m == 8 || $m == 10 ) { $d = ( 0 + $n ) . " d' " . $this->getMonthName( $m ) . " " . substr( $ts, 0, 4 ); } else { diff --git a/maintenance/Maintenance.php b/maintenance/Maintenance.php index 7aff84d579..aac62e0f7f 100644 --- a/maintenance/Maintenance.php +++ b/maintenance/Maintenance.php @@ -933,7 +933,7 @@ abstract class Maintenance { if ( isset( $this->mOptions['conf'] ) ) { $settingsFile = $this->mOptions['conf']; - } else if ( defined("MW_CONFIG_FILE") ) { + } elseif ( defined("MW_CONFIG_FILE") ) { $settingsFile = MW_CONFIG_FILE; } else { $settingsFile = "$IP/LocalSettings.php"; diff --git a/maintenance/fuzz-tester.php b/maintenance/fuzz-tester.php index aadb935ef5..18af4de45d 100644 --- a/maintenance/fuzz-tester.php +++ b/maintenance/fuzz-tester.php @@ -823,7 +823,7 @@ class wikiFuzz { static private function stringEscape( $matches ) { return sprintf( "\\x%02x", ord( $matches[1] ) ); } - + /** ** Strips out the stuff that Mediawiki balks at in a page's title. ** Implementation copied/pasted from cleanupTable.inc & cleanupImages.php @@ -1369,7 +1369,7 @@ class viewPageTest extends pageTest { // Tidy does not know how to valid atom or rss, so exclude from testing for the time being. if ( $this->params["feed"] == "atom" ) { unset( $this->params["feed"] ); } - else if ( $this->params["feed"] == "rss" ) { unset( $this->params["feed"] ); } + elseif ( $this->params["feed"] == "rss" ) { unset( $this->params["feed"] ); } // Raw pages cannot really be validated if ( $this->params["action"] == "raw" ) unset( $this->params["action"] ); @@ -1416,7 +1416,7 @@ class specialNewpagesPageTest extends pageTest { // Tidy does not know how to valid atom or rss, so exclude from testing for the time being. if ( $this->params["feed"] == "atom" ) { unset( $this->params["feed"] ); } - else if ( $this->params["feed"] == "rss" ) { unset( $this->params["feed"] ); } + elseif ( $this->params["feed"] == "rss" ) { unset( $this->params["feed"] ); } } } @@ -2702,7 +2702,7 @@ if ( !is_dir( DIRECTORY ) ) { mkdir ( DIRECTORY, 0700 ); } // otherwise, we first retest the things that we have found in previous runs -else if ( RERUN_OLD_TESTS ) { +elseif ( RERUN_OLD_TESTS ) { rerunPreviousTests(); } @@ -2750,7 +2750,7 @@ for ( $count = 0; true; $count++ ) { } saveTest( $test, $testname ); $num_errors += 1; - } else if ( KEEP_PASSED_TESTS ) { + } elseif ( KEEP_PASSED_TESTS ) { // print current time, with microseconds (matches "strace" format), and the test name. print " " . date( "H:i:s." ) . substr( current( explode( " ", microtime() ) ), 2 ) . " " . $testname; saveTest( $test, $testname ); diff --git a/maintenance/importImages.php b/maintenance/importImages.php index 47dc3cc064..f3b10ea948 100644 --- a/maintenance/importImages.php +++ b/maintenance/importImages.php @@ -96,7 +96,7 @@ if ( count( $args ) > 0 ) { die( "failed to read comment file: {$options['comment-file']}\n" ); } } - else if ( isset( $options['comment'] ) ) { + elseif ( isset( $options['comment'] ) ) { $comment = $options['comment']; } @@ -241,7 +241,7 @@ if ( count( $args ) > 0 ) { if ( isset( $options['dry'] ) ) { echo( "done.\n" ); - } else if ( $image->recordUpload( $archive->value, $commentText, $license ) ) { + } elseif ( $image->recordUpload( $archive->value, $commentText, $license ) ) { # We're done! echo( "done.\n" ); if ( $doProtect ) { diff --git a/maintenance/language/checkDupeMessages.php b/maintenance/language/checkDupeMessages.php index 5c79fe11d4..ea5b1870b9 100644 --- a/maintenance/language/checkDupeMessages.php +++ b/maintenance/language/checkDupeMessages.php @@ -34,9 +34,9 @@ if ( isset( $options['lang'] ) && isset( $options['clang'] ) ) { } else { if ( !strcmp( $options['mode'], 'wiki' ) ) { $runMode = 'wiki'; - } else if ( !strcmp( $options['mode'], 'php' ) ) { + } elseif ( !strcmp( $options['mode'], 'php' ) ) { $runMode = 'php'; - } else if ( !strcmp( $options['mode'], 'raw' ) ) { + } elseif ( !strcmp( $options['mode'], 'raw' ) ) { $runMode = 'raw'; } else { } @@ -77,7 +77,7 @@ if ( $runTest ) { if ( $run ) { if ( !strcmp( $runMode, 'wiki' ) ) { $runMode = 'wiki'; - } else if ( !strcmp( $runMode, 'raw' ) ) { + } elseif ( !strcmp( $runMode, 'raw' ) ) { $runMode = 'raw'; } include( $messagesFile ); @@ -102,9 +102,9 @@ if ( $run ) { if ( ( !strcmp( $key, $ckey ) ) && ( !strcmp( $value, $cvalue ) ) ) { if ( !strcmp( $runMode, 'raw' ) ) { print( "$key\n" ); - } else if ( !strcmp( $runMode, 'php' ) ) { + } elseif ( !strcmp( $runMode, 'php' ) ) { print( "'$key' => '',\n" ); - } else if ( !strcmp( $runMode, 'wiki' ) ) { + } elseif ( !strcmp( $runMode, 'wiki' ) ) { $uKey = ucfirst( $key ); print( "* MediaWiki:$uKey/$langCode\n" ); } else { diff --git a/maintenance/populateLogSearch.php b/maintenance/populateLogSearch.php index b6f8c2db69..f13873cb76 100644 --- a/maintenance/populateLogSearch.php +++ b/maintenance/populateLogSearch.php @@ -97,14 +97,14 @@ class PopulateLogSearch extends Maintenance { foreach ( $sres as $srow ) { if ( $srow->$userField > 0 ) $userIds[] = intval( $srow->$userField ); - else if ( $srow->$userTextField != '' ) + elseif ( $srow->$userTextField != '' ) $userIPs[] = $srow->$userTextField; } // Add item author relations... $log->addRelations( 'target_author_id', $userIds, $row->log_id ); $log->addRelations( 'target_author_ip', $userIPs, $row->log_id ); // RevisionDelete logs - log events - } else if ( LogEventsList::typeAction( $row, $delTypes, 'event' ) ) { + } elseif ( LogEventsList::typeAction( $row, $delTypes, 'event' ) ) { $params = LogPage::extractParams( $row->log_params ); // Param format: [ ] if ( count( $params ) < 1 ) continue; // bad row @@ -121,7 +121,7 @@ class PopulateLogSearch extends Maintenance { foreach ( $sres as $srow ) { if ( $srow->log_user > 0 ) $userIds[] = intval( $srow->log_user ); - else if ( IP::isIPAddress( $srow->log_user_text ) ) + elseif ( IP::isIPAddress( $srow->log_user_text ) ) $userIPs[] = $srow->log_user_text; } $log->addRelations( 'target_author_id', $userIds, $row->log_id ); diff --git a/maintenance/updateRestrictions.php b/maintenance/updateRestrictions.php index f1d613958d..ffbdb2baaa 100644 --- a/maintenance/updateRestrictions.php +++ b/maintenance/updateRestrictions.php @@ -64,7 +64,7 @@ class UpdateRestrictions extends Maintenance { // old old format should be treated as edit/move restriction $oldRestrictions["edit"] = trim( $temp[0] ); $oldRestrictions["move"] = trim( $temp[0] ); - } else if ( $temp[1] ) { + } elseif ( $temp[1] ) { $oldRestrictions[$temp[0]] = trim( $temp[1] ); } } diff --git a/tests/RunSeleniumTests.php b/tests/RunSeleniumTests.php index dd97c15ed1..9cadd759f6 100644 --- a/tests/RunSeleniumTests.php +++ b/tests/RunSeleniumTests.php @@ -164,7 +164,7 @@ class SeleniumTester extends Maintenance { $seleniumBrowsers, $seleniumTestSuites, $configFile ); - } else if ( !isset( $wgHooks['SeleniumSettings'] ) ) { + } elseif ( !isset( $wgHooks['SeleniumSettings'] ) ) { $this->output("No command line, configuration file or configuration hook found.\n"); SeleniumConfig::getSeleniumSettings( $seleniumSettings, $seleniumBrowsers, diff --git a/tests/parser/parserTestsStaticParserHook.php b/tests/parser/parserTestsStaticParserHook.php index a7ce5a4e85..e82f7f3fd2 100644 --- a/tests/parser/parserTestsStaticParserHook.php +++ b/tests/parser/parserTestsStaticParserHook.php @@ -36,7 +36,7 @@ class ParserTestStaticParserHook { if ( ! count( $argv ) ) { $parser->static_tag_buf = $in; return ''; - } else if ( count( $argv ) === 1 && isset( $argv['action'] ) + } elseif ( count( $argv ) === 1 && isset( $argv['action'] ) && $argv['action'] === 'flush' && $in === null ) { // Clear the buffer, we probably don't need to diff --git a/tests/phpunit/includes/TitlePermissionTest.php b/tests/phpunit/includes/TitlePermissionTest.php index 67913c627c..d1dfa57e38 100644 --- a/tests/phpunit/includes/TitlePermissionTest.php +++ b/tests/phpunit/includes/TitlePermissionTest.php @@ -65,7 +65,7 @@ class TitlePermissionTest extends MediaWikiTestCase { function setUser( $userName = null ) { if ( $userName === 'anon' ) { $this->user = $this->anonUser; - } else if ( $userName === null || $userName === $this->userName ) { + } elseif ( $userName === null || $userName === $this->userName ) { $this->user = $this->userUser; } else { $this->user = $this->altUser; -- 2.20.1