From: Fomafix Date: Sat, 30 Jun 2018 09:43:00 +0000 (+0200) Subject: No yoda conditions X-Git-Tag: 1.34.0-rc.0~3304^2 X-Git-Url: https://git.cyclocoop.org/%242?a=commitdiff_plain;h=3ee15602329dae0bb6e17c726408ad46d949f524;p=lhc%2Fweb%2Fwiklou.git No yoda conditions Replace if ( 42 === $foo ) by if ( $foo === 42 ) Change-Id: Ice320ef1ae64a59ed035c20134326b35d454f943 --- diff --git a/includes/EditPage.php b/includes/EditPage.php index 5f4c3aeb87..6ca8593fc1 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -680,7 +680,7 @@ class EditPage { # that edit() already checked just in case someone tries to sneak # in the back door with a hand-edited submission URL. - if ( 'save' == $this->formtype ) { + if ( $this->formtype == 'save' ) { $resultDetails = null; $status = $this->attemptSave( $resultDetails ); if ( !$this->handleStatus( $status, $resultDetails ) ) { @@ -690,7 +690,7 @@ class EditPage { # First time through: get contents, set time for conflict # checking, etc. - if ( 'initial' == $this->formtype || $this->firsttime ) { + if ( $this->formtype == 'initial' || $this->firsttime ) { if ( $this->initialiseForm() === false ) { $out = $this->context->getOutput(); if ( $out->getRedirect() === '' ) { // mcrundo hack redirects, don't override it @@ -2849,7 +2849,7 @@ ERROR; // Put these up at the top to ensure they aren't lost on early form submission $this->showFormBeforeText(); - if ( $this->wasDeletedSinceLastEdit() && 'save' == $this->formtype ) { + if ( $this->wasDeletedSinceLastEdit() && $this->formtype == 'save' ) { $username = $this->lastDelete->user_name; $comment = CommentStore::getStore() ->getComment( 'log_comment', $this->lastDelete )->text; diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 26c4d0aee4..a5f4def18f 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -471,7 +471,7 @@ function wfAppendQuery( $url, $query ) { } // Add parameter - if ( false === strpos( $url, '?' ) ) { + if ( strpos( $url, '?' ) === false ) { $url .= '?'; } else { $url .= '&'; diff --git a/includes/Linker.php b/includes/Linker.php index 1d1ad0696f..b9084cc6b5 100644 --- a/includes/Linker.php +++ b/includes/Linker.php @@ -227,7 +227,7 @@ class Linker { */ private static function fnamePart( $url ) { $basename = strrchr( $url, '/' ); - if ( false === $basename ) { + if ( $basename === false ) { $basename = $url; } else { $basename = substr( $basename, 1 ); @@ -334,7 +334,7 @@ class Linker { $prefix = $postfix = ''; - if ( 'center' == $frameParams['align'] ) { + if ( $frameParams['align'] == 'center' ) { $prefix = '
'; $postfix = '
'; $frameParams['align'] = 'none'; @@ -916,7 +916,7 @@ class Linker { $userId, $userText, $redContribsWhenNoEdits = false, $flags = 0, $edits = null ) { global $wgUser, $wgDisableAnonTalk, $wgLang; - $talkable = !( $wgDisableAnonTalk && 0 == $userId ); + $talkable = !( $wgDisableAnonTalk && $userId == 0 ); $blockable = !( $flags & self::TOOL_LINKS_NOBLOCK ); $addEmailLink = $flags & self::TOOL_LINKS_EMAIL && $userId; diff --git a/includes/Title.php b/includes/Title.php index c151f4a7e5..ff64407831 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -1659,7 +1659,7 @@ class Title implements LinkTarget { $p = $this->mInterwiki . ':'; } - if ( 0 != $this->mNamespace ) { + if ( $this->mNamespace != 0 ) { $nsText = $this->getNsText(); if ( $nsText === false ) { @@ -3587,7 +3587,7 @@ class Title implements LinkTarget { $this->mArticleID = $linkCache->addLinkObj( $this ); $linkCache->forUpdate( $oldUpdate ); } else { - if ( -1 == $this->mArticleID ) { + if ( $this->mArticleID == -1 ) { $this->mArticleID = $linkCache->addLinkObj( $this ); } } diff --git a/includes/db/DatabaseOracle.php b/includes/db/DatabaseOracle.php index 696e81f50c..628b47bd53 100644 --- a/includes/db/DatabaseOracle.php +++ b/includes/db/DatabaseOracle.php @@ -972,7 +972,7 @@ class DatabaseOracle extends Database { if ( $sl < 0 ) { continue; } - if ( '-' == $line[0] && '-' == $line[1] ) { + if ( $line[0] == '-' && $line[1] == '-' ) { continue; } @@ -986,7 +986,7 @@ class DatabaseOracle extends Database { $dollarquote = true; } } elseif ( !$dollarquote ) { - if ( ';' == $line[$sl] && ( $sl < 2 || ';' != $line[$sl - 1] ) ) { + if ( $line[$sl] == ';' && ( $sl < 2 || $line[$sl - 1] != ';' ) ) { $done = true; $line = substr( $line, 0, $sl ); } @@ -1017,7 +1017,7 @@ class DatabaseOracle extends Database { call_user_func( $resultCallback, $res, $this ); } - if ( false === $res ) { + if ( $res === false ) { $err = $this->lastError(); return "Query \"{$cmd}\" failed with error code \"$err\".\n"; diff --git a/includes/debug/logger/LegacyLogger.php b/includes/debug/logger/LegacyLogger.php index 6288a504cc..9f63eded09 100644 --- a/includes/debug/logger/LegacyLogger.php +++ b/includes/debug/logger/LegacyLogger.php @@ -375,7 +375,7 @@ class LegacyLogger extends AbstractLogger { * @return string */ protected static function flatten( $item ) { - if ( null === $item ) { + if ( $item === null ) { return '[Null]'; } diff --git a/includes/filerepo/file/LocalFile.php b/includes/filerepo/file/LocalFile.php index 95ee4f4e56..e4c2173664 100644 --- a/includes/filerepo/file/LocalFile.php +++ b/includes/filerepo/file/LocalFile.php @@ -1242,7 +1242,7 @@ class LocalFile extends File { $fileQuery['joins'] ); - if ( 0 == $dbr->numRows( $this->historyRes ) ) { + if ( $dbr->numRows( $this->historyRes ) == 0 ) { $this->historyRes = null; return false; diff --git a/includes/installer/PostgresUpdater.php b/includes/installer/PostgresUpdater.php index 71c1a52286..ce9df00ddf 100644 --- a/includes/installer/PostgresUpdater.php +++ b/includes/installer/PostgresUpdater.php @@ -955,7 +955,7 @@ END; } if ( $fi->isNullable() ) { # # It's NULL - does it need to be NOT NULL? - if ( 'NOT NULL' === $null ) { + if ( $null === 'NOT NULL' ) { $this->output( "Changing '$table.$field' to not allow NULLs\n" ); if ( $update ) { $this->db->query( "UPDATE $table SET $field = DEFAULT WHERE $field IS NULL" ); @@ -966,7 +966,7 @@ END; } } else { # # It's NOT NULL - does it need to be NULL? - if ( 'NULL' === $null ) { + if ( $null === 'NULL' ) { $this->output( "Changing '$table.$field' to allow NULLs\n" ); $this->db->query( "ALTER TABLE $table ALTER $field DROP NOT NULL" ); } else { diff --git a/includes/libs/rdbms/database/Database.php b/includes/libs/rdbms/database/Database.php index 2c40c72bc1..3102d7c8be 100644 --- a/includes/libs/rdbms/database/Database.php +++ b/includes/libs/rdbms/database/Database.php @@ -4276,7 +4276,7 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware $fp = fopen( $filename, 'r' ); Wikimedia\restoreWarnings(); - if ( false === $fp ) { + if ( $fp === false ) { throw new RuntimeException( "Could not open \"{$filename}\".\n" ); } @@ -4327,7 +4327,7 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware continue; } - if ( '-' == $line[0] && '-' == $line[1] ) { + if ( $line[0] == '-' && $line[1] == '-' ) { continue; } @@ -4357,7 +4357,7 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware $resultCallback( $res, $this ); } - if ( false === $res ) { + if ( $res === false ) { $err = $this->lastError(); return "Query \"{$cmd}\" failed with error code \"$err\".\n"; diff --git a/includes/libs/rdbms/database/DatabasePostgres.php b/includes/libs/rdbms/database/DatabasePostgres.php index adcd899902..5f04e39718 100644 --- a/includes/libs/rdbms/database/DatabasePostgres.php +++ b/includes/libs/rdbms/database/DatabasePostgres.php @@ -916,22 +916,22 @@ __INDEXATTR__; * @return string[] */ private function pg_array_parse( $text, &$output, $limit = false, $offset = 1 ) { - if ( false === $limit ) { + if ( $limit === false ) { $limit = strlen( $text ) - 1; $output = []; } - if ( '{}' == $text ) { + if ( $text == '{}' ) { return $output; } do { - if ( '{' != $text[$offset] ) { + if ( $text[$offset] != '{' ) { preg_match( "/(\\{?\"([^\"\\\\]|\\\\.)*\"|[^,{}]+)+([,}]+)/", $text, $match, 0, $offset ); $offset += strlen( $match[0] ); - $output[] = ( '"' != $match[1][0] + $output[] = ( $match[1][0] != '"' ? $match[1] : stripcslashes( substr( $match[1], 1, -1 ) ) ); - if ( '},' == $match[3] ) { + if ( $match[3] == '},' ) { return $output; } } else { diff --git a/includes/objectcache/SqlBagOStuff.php b/includes/objectcache/SqlBagOStuff.php index a581ac8f8c..d76738c328 100644 --- a/includes/objectcache/SqlBagOStuff.php +++ b/includes/objectcache/SqlBagOStuff.php @@ -689,7 +689,7 @@ class SqlBagOStuff extends BagOStuff { $decomp = gzinflate( $serial ); Wikimedia\restoreWarnings(); - if ( false !== $decomp ) { + if ( $decomp !== false ) { $serial = $decomp; } } diff --git a/includes/page/ImagePage.php b/includes/page/ImagePage.php index c933c15f7d..cbc5966c48 100644 --- a/includes/page/ImagePage.php +++ b/includes/page/ImagePage.php @@ -281,7 +281,7 @@ class ImagePage extends Article { */ public function getEmptyPageParserOutput( ParserOptions $options ) { $this->loadFile(); - if ( $this->mPage->getFile() && !$this->mPage->getFile()->isLocal() && 0 == $this->getId() ) { + if ( $this->mPage->getFile() && !$this->mPage->getFile()->isLocal() && $this->getId() == 0 ) { return new ParserOutput(); } return parent::getEmptyPageParserOutput( $options ); diff --git a/includes/parser/BlockLevelPass.php b/includes/parser/BlockLevelPass.php index 0553db9ea6..ecd8defbbc 100644 --- a/includes/parser/BlockLevelPass.php +++ b/includes/parser/BlockLevelPass.php @@ -105,13 +105,13 @@ class BlockLevelPass { private function openList( $char ) { $result = $this->closeParagraph(); - if ( '*' === $char ) { + if ( $char === '*' ) { $result .= ""; - } elseif ( '#' === $char ) { + } elseif ( $char === '#' ) { $text = ""; - } elseif ( ':' === $char ) { + } elseif ( $char === ':' ) { if ( $this->DTopen ) { $this->DTopen = false; $text = ""; @@ -271,7 +271,7 @@ class BlockLevelPass { $char = $prefix[$commonPrefixLength]; $output .= $this->openList( $char ); - if ( ';' === $char ) { + if ( $char === ';' ) { # @todo FIXME: This is dupe of code above if ( $this->findColonNoLinks( $t, $term, $t2 ) !== false ) { $t = $t2; @@ -288,7 +288,7 @@ class BlockLevelPass { } # If we have no prefixes, go to paragraph mode. - if ( 0 == $prefixLength ) { + if ( $prefixLength == 0 ) { # No prefix (not in list)--go to paragraph mode # @todo consider using a stack for nestable elements like span, table and div @@ -339,7 +339,7 @@ class BlockLevelPass { } $inBlockElem = !$closeMatch; } elseif ( !$inBlockElem && !$this->inPre ) { - if ( ' ' == substr( $t, 0, 1 ) + if ( substr( $t, 0, 1 ) == ' ' && ( $this->lastSection === 'pre' || trim( $t ) != '' ) && !$inBlockquote ) { diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index 11825fa443..adda36cec3 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -3146,7 +3146,7 @@ class Parser { # $args is a list of argument nodes, starting from index 0, not including $part1 # @todo FIXME: If piece['parts'] is null then the call to getLength() # below won't work b/c this $args isn't an object - $args = ( null == $piece['parts'] ) ? [] : $piece['parts']; + $args = ( $piece['parts'] == null ) ? [] : $piece['parts']; $profileSection = null; // profile templates diff --git a/includes/search/SearchHighlighter.php b/includes/search/SearchHighlighter.php index 5dfc4dfe40..469502fd43 100644 --- a/includes/search/SearchHighlighter.php +++ b/includes/search/SearchHighlighter.php @@ -519,7 +519,7 @@ class SearchHighlighter { $extract = ""; $contLang = MediaWikiServices::getInstance()->getContentLanguage(); foreach ( $lines as $line ) { - if ( 0 == $contextlines ) { + if ( $contextlines == 0 ) { break; } ++$lineno; diff --git a/includes/specials/SpecialLockdb.php b/includes/specials/SpecialLockdb.php index a2c25305ca..c7c45b5510 100644 --- a/includes/specials/SpecialLockdb.php +++ b/includes/specials/SpecialLockdb.php @@ -84,7 +84,7 @@ class SpecialLockdb extends FormSpecialPage { $fp = fopen( $this->getConfig()->get( 'ReadOnlyFile' ), 'w' ); Wikimedia\restoreWarnings(); - if ( false === $fp ) { + if ( $fp === false ) { # This used to show a file not found error, but the likeliest reason for fopen() # to fail at this point is insufficient permission to write to the file...good old # is_writable() is plain wrong in some cases, it seems... diff --git a/includes/specials/SpecialMovepage.php b/includes/specials/SpecialMovepage.php index 3ce786e21b..599ab31135 100644 --- a/includes/specials/SpecialMovepage.php +++ b/includes/specials/SpecialMovepage.php @@ -122,7 +122,7 @@ class MovePageForm extends UnlistedSpecialPage { $this->moveOverShared = $request->getBool( 'wpMoveOverSharedFile' ); $this->watch = $request->getCheck( 'wpWatch' ) && $user->isLoggedIn(); - if ( 'submit' == $request->getVal( 'action' ) && $request->wasPosted() + if ( $request->getVal( 'action' ) == 'submit' && $request->wasPosted() && $user->matchEditToken( $request->getVal( 'wpEditToken' ) ) ) { $this->doSubmit(); diff --git a/includes/specials/SpecialNewpages.php b/includes/specials/SpecialNewpages.php index 5ba7c88e01..8051b0b4e4 100644 --- a/includes/specials/SpecialNewpages.php +++ b/includes/specials/SpecialNewpages.php @@ -76,19 +76,19 @@ class SpecialNewpages extends IncludableSpecialPage { protected function parseParams( $par ) { $bits = preg_split( '/\s*,\s*/', trim( $par ) ); foreach ( $bits as $bit ) { - if ( 'shownav' == $bit ) { + if ( $bit === 'shownav' ) { $this->showNavigation = true; } - if ( 'hideliu' === $bit ) { + if ( $bit === 'hideliu' ) { $this->opts->setValue( 'hideliu', true ); } - if ( 'hidepatrolled' == $bit ) { + if ( $bit === 'hidepatrolled' ) { $this->opts->setValue( 'hidepatrolled', true ); } - if ( 'hidebots' == $bit ) { + if ( $bit === 'hidebots' ) { $this->opts->setValue( 'hidebots', true ); } - if ( 'showredirs' == $bit ) { + if ( $bit === 'showredirs' ) { $this->opts->setValue( 'hideredirs', false ); } if ( is_numeric( $bit ) ) { diff --git a/includes/specials/SpecialWhatlinkshere.php b/includes/specials/SpecialWhatlinkshere.php index 8eee37cab8..766e190250 100644 --- a/includes/specials/SpecialWhatlinkshere.php +++ b/includes/specials/SpecialWhatlinkshere.php @@ -200,7 +200,7 @@ class SpecialWhatLinksHere extends IncludableSpecialPage { && ( $hidetrans || !$tlRes->numRows() ) && ( $hideimages || !$ilRes->numRows() ) ) { - if ( 0 == $level ) { + if ( $level == 0 ) { if ( !$this->including() ) { $out->addHTML( $this->whatlinkshereForm() ); @@ -461,11 +461,11 @@ class SpecialWhatLinksHere extends IncludableSpecialPage { $changed = $this->opts->getChangedValues(); unset( $changed['target'] ); // Already in the request title - if ( 0 != $prevId ) { + if ( $prevId != 0 ) { $overrides = [ 'from' => $this->opts->getValue( 'back' ) ]; $prev = $this->makeSelfLink( $prev, array_merge( $changed, $overrides ) ); } - if ( 0 != $nextId ) { + if ( $nextId != 0 ) { $overrides = [ 'from' => $nextId, 'back' => $prevId ]; $next = $this->makeSelfLink( $next, array_merge( $changed, $overrides ) ); } diff --git a/includes/title/MediaWikiTitleCodec.php b/includes/title/MediaWikiTitleCodec.php index f6a4c06522..e06bfb53d8 100644 --- a/includes/title/MediaWikiTitleCodec.php +++ b/includes/title/MediaWikiTitleCodec.php @@ -325,7 +325,7 @@ class MediaWikiTitleCodec implements TitleFormatter, TitleParser { # Redundant interwiki prefix to the local wiki foreach ( $this->localInterwikis as $localIW ) { - if ( 0 == strcasecmp( $parts['interwiki'], $localIW ) ) { + if ( strcasecmp( $parts['interwiki'], $localIW ) == 0 ) { if ( $dbkey == '' ) { # Empty self-links should point to the Main Page, to ensure # compatibility with cross-wiki transclusions and the like. @@ -363,7 +363,7 @@ class MediaWikiTitleCodec implements TitleFormatter, TitleParser { } while ( true ); $fragment = strstr( $dbkey, '#' ); - if ( false !== $fragment ) { + if ( $fragment !== false ) { $parts['fragment'] = str_replace( '_', ' ', substr( $fragment, 1 ) ); $dbkey = substr( $dbkey, 0, strlen( $dbkey ) - strlen( $fragment ) ); # remove whitespace again: prevents "Foo_bar_#" @@ -438,7 +438,7 @@ class MediaWikiTitleCodec implements TitleFormatter, TitleParser { } // Any remaining initial :s are illegal. - if ( $dbkey !== '' && ':' == $dbkey[0] ) { + if ( $dbkey !== '' && $dbkey[0] == ':' ) { throw new MalformedTitleException( 'title-invalid-leading-colon', $text ); } diff --git a/includes/upload/UploadBase.php b/includes/upload/UploadBase.php index ea805fb970..c7dbf835b9 100644 --- a/includes/upload/UploadBase.php +++ b/includes/upload/UploadBase.php @@ -1344,7 +1344,7 @@ abstract class UploadBase { } foreach ( $tags as $tag ) { - if ( false !== strpos( $chunk, $tag ) ) { + if ( strpos( $chunk, $tag ) !== false ) { wfDebug( __METHOD__ . ": found something that may make it be mistaken for html: $tag\n" ); return true; diff --git a/includes/user/User.php b/includes/user/User.php index 5f772a4531..63300eb474 100644 --- a/includes/user/User.php +++ b/includes/user/User.php @@ -1831,7 +1831,7 @@ class User implements IDBAccessObject, UserIdentity { private function getBlockedStatus( $bFromReplica = true ) { global $wgProxyWhitelist, $wgUser, $wgApplyIpBlocksToXff, $wgSoftBlockRanges; - if ( -1 != $this->mBlockedby ) { + if ( $this->mBlockedby != -1 ) { return; } @@ -4114,7 +4114,7 @@ class User implements IDBAccessObject, UserIdentity { */ public function setCookies( $request = null, $secure = null, $rememberMe = false ) { $this->load(); - if ( 0 == $this->mId ) { + if ( $this->mId == 0 ) { return; } @@ -4208,7 +4208,7 @@ class User implements IDBAccessObject, UserIdentity { } $this->load(); - if ( 0 == $this->mId ) { + if ( $this->mId == 0 ) { return; // anon } diff --git a/languages/Language.php b/languages/Language.php index aa287e926a..60b009f264 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -2192,7 +2192,7 @@ class Language { } # No difference ? Return time unchanged - if ( 0 == $minDiff ) { + if ( $minDiff == 0 ) { return $ts; } diff --git a/maintenance/createAndPromote.php b/maintenance/createAndPromote.php index 2072d7b54d..24ab3d21fc 100644 --- a/maintenance/createAndPromote.php +++ b/maintenance/createAndPromote.php @@ -66,7 +66,7 @@ class CreateAndPromote extends Maintenance { $this->fatalError( "invalid username." ); } - $exists = ( 0 !== $user->idForName() ); + $exists = ( $user->idForName() !== 0 ); if ( $exists && !$force ) { $this->fatalError( "Account exists. Perhaps you want the --force option?" ); diff --git a/maintenance/language/generateCollationData.php b/maintenance/language/generateCollationData.php index 210e907264..f43d75f2ea 100644 --- a/maintenance/language/generateCollationData.php +++ b/maintenance/language/generateCollationData.php @@ -202,7 +202,7 @@ class GenerateCollationData extends Maintenance { // For each character with an entry in allkeys.txt, overwrite the implicit // entry in $this->weights that came from the UCD. // Also gather a list of tertiary weights, for use in selecting the group header - while ( false !== ( $line = fgets( $file ) ) ) { + while ( ( $line = fgets( $file ) ) !== false ) { // We're only interested in single-character weights, pick them out with a regex $line = trim( $line ); if ( !preg_match( '/^([0-9A-F]+)\s*;\s*([^#]*)/', $line, $m ) ) { diff --git a/maintenance/language/generateNormalizerDataAr.php b/maintenance/language/generateNormalizerDataAr.php index d3e065563a..336495af5f 100644 --- a/maintenance/language/generateNormalizerDataAr.php +++ b/maintenance/language/generateNormalizerDataAr.php @@ -88,7 +88,7 @@ class GenerateNormalizerDataAr extends Maintenance { $pairs = []; $lineNum = 0; - while ( false !== ( $line = fgets( $file ) ) ) { + while ( ( $line = fgets( $file ) ) !== false ) { ++$lineNum; # Strip comments diff --git a/maintenance/pruneFileCache.php b/maintenance/pruneFileCache.php index 74298cb9ee..04319b33bc 100644 --- a/maintenance/pruneFileCache.php +++ b/maintenance/pruneFileCache.php @@ -81,7 +81,7 @@ class PruneFileCache extends Maintenance { protected function prune_directory( $dir, $report = false ) { $tsNow = time(); $dirHandle = opendir( $dir ); - while ( false !== ( $file = readdir( $dirHandle ) ) ) { + while ( ( $file = readdir( $dirHandle ) ) !== false ) { // Skip ".", "..", and also any dirs or files like ".svn" or ".htaccess" if ( $file[0] != "." ) { $path = $dir . '/' . $file; // absolute diff --git a/maintenance/rebuildFileCache.php b/maintenance/rebuildFileCache.php index 1f89426e7a..cf398ff607 100644 --- a/maintenance/rebuildFileCache.php +++ b/maintenance/rebuildFileCache.php @@ -113,7 +113,7 @@ class RebuildFileCache extends Maintenance { $rebuilt = false; $title = Title::makeTitleSafe( $row->page_namespace, $row->page_title ); - if ( null == $title ) { + if ( $title === null ) { $this->output( "Page {$row->page_id} has bad title\n" ); continue; // broken title? } diff --git a/maintenance/storage/compressOld.php b/maintenance/storage/compressOld.php index a9b9b9ed39..260ca98d42 100644 --- a/maintenance/storage/compressOld.php +++ b/maintenance/storage/compressOld.php @@ -184,8 +184,8 @@ class CompressOld extends Maintenance { * @return bool */ private function compressPage( $row, $extdb ) { - if ( false !== strpos( $row->old_flags, 'gzip' ) - || false !== strpos( $row->old_flags, 'object' ) + if ( strpos( $row->old_flags, 'gzip' ) !== false + || strpos( $row->old_flags, 'object' ) !== false ) { # print "Already compressed row {$row->old_id}\n"; return false; diff --git a/tests/parser/TestFileReader.php b/tests/parser/TestFileReader.php index 8a11b4c16d..307bbb6fb9 100644 --- a/tests/parser/TestFileReader.php +++ b/tests/parser/TestFileReader.php @@ -155,7 +155,7 @@ class TestFileReader { } private function execute() { - while ( false !== ( $line = fgets( $this->fh ) ) ) { + while ( ( $line = fgets( $this->fh ) ) !== false ) { $this->lineNum++; $matches = []; diff --git a/tests/phpunit/includes/RevisionTest.php b/tests/phpunit/includes/RevisionTest.php index c053104d6f..2b6db93b0b 100644 --- a/tests/phpunit/includes/RevisionTest.php +++ b/tests/phpunit/includes/RevisionTest.php @@ -560,9 +560,9 @@ class RevisionTest extends MediaWikiTestCase { $row = new stdClass; $row->old_text = "Wiki est l'\xc3\xa9cole superieur !"; $row->old_flags = Revision::compressRevisionText( $row->old_text ); - $this->assertTrue( false !== strpos( $row->old_flags, 'utf-8' ), + $this->assertTrue( strpos( $row->old_flags, 'utf-8' ) !== false, "Flags should contain 'utf-8'" ); - $this->assertFalse( false !== strpos( $row->old_flags, 'gzip' ), + $this->assertFalse( strpos( $row->old_flags, 'gzip' ) !== false, "Flags should not contain 'gzip'" ); $this->assertEquals( "Wiki est l'\xc3\xa9cole superieur !", $row->old_text, "Direct check" ); @@ -583,9 +583,9 @@ class RevisionTest extends MediaWikiTestCase { $row = new stdClass; $row->old_text = "Wiki est l'\xc3\xa9cole superieur !"; $row->old_flags = Revision::compressRevisionText( $row->old_text ); - $this->assertTrue( false !== strpos( $row->old_flags, 'utf-8' ), + $this->assertTrue( strpos( $row->old_flags, 'utf-8' ) !== false, "Flags should contain 'utf-8'" ); - $this->assertTrue( false !== strpos( $row->old_flags, 'gzip' ), + $this->assertTrue( strpos( $row->old_flags, 'gzip' ) !== false, "Flags should contain 'gzip'" ); $this->assertEquals( "Wiki est l'\xc3\xa9cole superieur !", gzinflate( $row->old_text ), "Direct check" ); diff --git a/tests/phpunit/includes/Storage/SqlBlobStoreTest.php b/tests/phpunit/includes/Storage/SqlBlobStoreTest.php index a40f09c21f..55069403d6 100644 --- a/tests/phpunit/includes/Storage/SqlBlobStoreTest.php +++ b/tests/phpunit/includes/Storage/SqlBlobStoreTest.php @@ -184,9 +184,9 @@ class SqlBlobStoreTest extends MediaWikiTestCase { $row = new stdClass; $row->old_text = "Wiki est l'\xc3\xa9cole superieur !"; $row->old_flags = $store->compressData( $row->old_text ); - $this->assertTrue( false !== strpos( $row->old_flags, 'utf-8' ), + $this->assertTrue( strpos( $row->old_flags, 'utf-8' ) !== false, "Flags should contain 'utf-8'" ); - $this->assertFalse( false !== strpos( $row->old_flags, 'gzip' ), + $this->assertFalse( strpos( $row->old_flags, 'gzip' ) !== false, "Flags should not contain 'gzip'" ); $this->assertEquals( "Wiki est l'\xc3\xa9cole superieur !", $row->old_text, "Direct check" ); @@ -202,9 +202,9 @@ class SqlBlobStoreTest extends MediaWikiTestCase { $row = new stdClass; $row->old_text = "Wiki est l'\xc3\xa9cole superieur !"; $row->old_flags = $store->compressData( $row->old_text ); - $this->assertTrue( false !== strpos( $row->old_flags, 'utf-8' ), + $this->assertTrue( strpos( $row->old_flags, 'utf-8' ) !== false, "Flags should contain 'utf-8'" ); - $this->assertTrue( false !== strpos( $row->old_flags, 'gzip' ), + $this->assertTrue( strpos( $row->old_flags, 'gzip' ) !== false, "Flags should contain 'gzip'" ); $this->assertEquals( "Wiki est l'\xc3\xa9cole superieur !", gzinflate( $row->old_text ), "Direct check" ); diff --git a/tests/phpunit/includes/search/SearchResultSetTest.php b/tests/phpunit/includes/search/SearchResultSetTest.php index 26a0672922..774e023738 100644 --- a/tests/phpunit/includes/search/SearchResultSetTest.php +++ b/tests/phpunit/includes/search/SearchResultSetTest.php @@ -21,7 +21,7 @@ class SearchResultSetTest extends MediaWikiTestCase { $this->hideDeprecated( 'SearchResultSet::next' ); $resultSet->rewind(); $count = 0; - while ( false !== ( $iterResult = $resultSet->next() ) ) { + while ( ( $iterResult = $resultSet->next() ) !== false ) { $this->assertEquals( $result, $iterResult ); $count++; } diff --git a/tests/phpunit/includes/specialpage/ChangesListSpecialPageTest.php b/tests/phpunit/includes/specialpage/ChangesListSpecialPageTest.php index b8cee67a00..584b141c2c 100644 --- a/tests/phpunit/includes/specialpage/ChangesListSpecialPageTest.php +++ b/tests/phpunit/includes/specialpage/ChangesListSpecialPageTest.php @@ -116,7 +116,7 @@ class ChangesListSpecialPageTest extends AbstractChangesListSpecialPageTestCase /** return false if condition begins with 'rc_timestamp ' */ private static function filterOutRcTimestampCondition( $var ) { - return ( is_array( $var ) || false === strpos( $var, 'rc_timestamp ' ) ); + return ( is_array( $var ) || strpos( $var, 'rc_timestamp ' ) === false ); } public function testRcNsFilter() { diff --git a/tests/phpunit/suites/ParserTestTopLevelSuite.php b/tests/phpunit/suites/ParserTestTopLevelSuite.php index cc0f26369e..77461c5af2 100644 --- a/tests/phpunit/suites/ParserTestTopLevelSuite.php +++ b/tests/phpunit/suites/ParserTestTopLevelSuite.php @@ -86,7 +86,7 @@ class ParserTestTopLevelSuite extends PHPUnit_Framework_TestSuite { # Filter out .txt files $files = ParserTestRunner::getParserTestFiles(); foreach ( $files as $extName => $parserTestFile ) { - $isCore = ( 0 === strpos( $parserTestFile, $mwTestDir ) ); + $isCore = ( strpos( $parserTestFile, $mwTestDir ) === 0 ); if ( $isCore && $wantsCore ) { self::debug( "included core parser tests: $parserTestFile" );