No yoda conditions
authorFomafix <fomafix@googlemail.com>
Sat, 30 Jun 2018 09:43:00 +0000 (11:43 +0200)
committerFomafix <fomafix@googlemail.com>
Wed, 21 Nov 2018 16:54:39 +0000 (17:54 +0100)
Replace
  if ( 42 === $foo )
by
  if ( $foo === 42 )

Change-Id: Ice320ef1ae64a59ed035c20134326b35d454f943

35 files changed:
includes/EditPage.php
includes/GlobalFunctions.php
includes/Linker.php
includes/Title.php
includes/db/DatabaseOracle.php
includes/debug/logger/LegacyLogger.php
includes/filerepo/file/LocalFile.php
includes/installer/PostgresUpdater.php
includes/libs/rdbms/database/Database.php
includes/libs/rdbms/database/DatabasePostgres.php
includes/objectcache/SqlBagOStuff.php
includes/page/ImagePage.php
includes/parser/BlockLevelPass.php
includes/parser/Parser.php
includes/search/SearchHighlighter.php
includes/specials/SpecialLockdb.php
includes/specials/SpecialMovepage.php
includes/specials/SpecialNewpages.php
includes/specials/SpecialWhatlinkshere.php
includes/title/MediaWikiTitleCodec.php
includes/upload/UploadBase.php
includes/user/User.php
languages/Language.php
maintenance/createAndPromote.php
maintenance/language/generateCollationData.php
maintenance/language/generateNormalizerDataAr.php
maintenance/pruneFileCache.php
maintenance/rebuildFileCache.php
maintenance/storage/compressOld.php
tests/parser/TestFileReader.php
tests/phpunit/includes/RevisionTest.php
tests/phpunit/includes/Storage/SqlBlobStoreTest.php
tests/phpunit/includes/search/SearchResultSetTest.php
tests/phpunit/includes/specialpage/ChangesListSpecialPageTest.php
tests/phpunit/suites/ParserTestTopLevelSuite.php

index 5f4c3ae..6ca8593 100644 (file)
@@ -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;
index 26c4d0a..a5f4def 100644 (file)
@@ -471,7 +471,7 @@ function wfAppendQuery( $url, $query ) {
                }
 
                // Add parameter
-               if ( false === strpos( $url, '?' ) ) {
+               if ( strpos( $url, '?' ) === false ) {
                        $url .= '?';
                } else {
                        $url .= '&';
index 1d1ad06..b9084cc 100644 (file)
@@ -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 = '<div class="center">';
                        $postfix = '</div>';
                        $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;
 
index c151f4a..ff64407 100644 (file)
@@ -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 );
                        }
                }
index 696e81f..628b47b 100644 (file)
@@ -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";
index 6288a50..9f63ede 100644 (file)
@@ -375,7 +375,7 @@ class LegacyLogger extends AbstractLogger {
         * @return string
         */
        protected static function flatten( $item ) {
-               if ( null === $item ) {
+               if ( $item === null ) {
                        return '[Null]';
                }
 
index 95ee4f4..e4c2173 100644 (file)
@@ -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;
index 71c1a52..ce9df00 100644 (file)
@@ -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 {
index 2c40c72..3102d7c 100644 (file)
@@ -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";
index adcd899..5f04e39 100644 (file)
@@ -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 {
index a581ac8..d76738c 100644 (file)
@@ -689,7 +689,7 @@ class SqlBagOStuff extends BagOStuff {
                        $decomp = gzinflate( $serial );
                        Wikimedia\restoreWarnings();
 
-                       if ( false !== $decomp ) {
+                       if ( $decomp !== false ) {
                                $serial = $decomp;
                        }
                }
index c933c15..cbc5966 100644 (file)
@@ -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 );
index 0553db9..ecd8def 100644 (file)
@@ -105,13 +105,13 @@ class BlockLevelPass {
        private function openList( $char ) {
                $result = $this->closeParagraph();
 
-               if ( '*' === $char ) {
+               if ( $char === '*' ) {
                        $result .= "<ul><li>";
-               } elseif ( '#' === $char ) {
+               } elseif ( $char === '#' ) {
                        $result .= "<ol><li>";
-               } elseif ( ':' === $char ) {
+               } elseif ( $char === ':' ) {
                        $result .= "<dl><dd>";
-               } elseif ( ';' === $char ) {
+               } elseif ( $char === ';' ) {
                        $result .= "<dl><dt>";
                        $this->DTopen = true;
                } else {
@@ -128,14 +128,14 @@ class BlockLevelPass {
         * @return string
         */
        private function nextItem( $char ) {
-               if ( '*' === $char || '#' === $char ) {
+               if ( $char === '*' || $char === '#' ) {
                        return "</li>\n<li>";
-               } elseif ( ':' === $char || ';' === $char ) {
+               } elseif ( $char === ':' || $char === ';' ) {
                        $close = "</dd>\n";
                        if ( $this->DTopen ) {
                                $close = "</dt>\n";
                        }
-                       if ( ';' === $char ) {
+                       if ( $char === ';' ) {
                                $this->DTopen = true;
                                return $close . '<dt>';
                        } else {
@@ -153,11 +153,11 @@ class BlockLevelPass {
         * @return string
         */
        private function closeList( $char ) {
-               if ( '*' === $char ) {
+               if ( $char === '*' ) {
                        $text = "</li></ul>";
-               } elseif ( '#' === $char ) {
+               } elseif ( $char === '#' ) {
                        $text = "</li></ol>";
-               } elseif ( ':' === $char ) {
+               } elseif ( $char === ':' ) {
                        if ( $this->DTopen ) {
                                $this->DTopen = false;
                                $text = "</dt></dl>";
@@ -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
                                        ) {
index 11825fa..adda36c 100644 (file)
@@ -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
 
index 5dfc4df..469502f 100644 (file)
@@ -519,7 +519,7 @@ class SearchHighlighter {
                $extract = "";
                $contLang = MediaWikiServices::getInstance()->getContentLanguage();
                foreach ( $lines as $line ) {
-                       if ( 0 == $contextlines ) {
+                       if ( $contextlines == 0 ) {
                                break;
                        }
                        ++$lineno;
index a2c2530..c7c45b5 100644 (file)
@@ -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...
index 3ce786e..599ab31 100644 (file)
@@ -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();
index 5ba7c88..8051b0b 100644 (file)
@@ -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 ) ) {
index 8eee37c..766e190 100644 (file)
@@ -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 ) );
                }
index f6a4c06..e06bfb5 100644 (file)
@@ -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 );
                }
 
index ea805fb..c7dbf83 100644 (file)
@@ -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;
index 5f772a4..63300eb 100644 (file)
@@ -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
                }
 
index aa287e9..60b009f 100644 (file)
@@ -2192,7 +2192,7 @@ class Language {
                }
 
                # No difference ? Return time unchanged
-               if ( 0 == $minDiff ) {
+               if ( $minDiff == 0 ) {
                        return $ts;
                }
 
index 2072d7b..24ab3d2 100644 (file)
@@ -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?" );
index 210e907..f43d75f 100644 (file)
@@ -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 ) ) {
index d3e0655..336495a 100644 (file)
@@ -88,7 +88,7 @@ class GenerateNormalizerDataAr extends Maintenance {
                $pairs = [];
 
                $lineNum = 0;
-               while ( false !== ( $line = fgets( $file ) ) ) {
+               while ( ( $line = fgets( $file ) ) !== false ) {
                        ++$lineNum;
 
                        # Strip comments
index 74298cb..04319b3 100644 (file)
@@ -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
index 1f89426..cf398ff 100644 (file)
@@ -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?
                                }
index a9b9b9e..260ca98 100644 (file)
@@ -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;
index 8a11b4c..307bbb6 100644 (file)
@@ -155,7 +155,7 @@ class TestFileReader {
        }
 
        private function execute() {
-               while ( false !== ( $line = fgets( $this->fh ) ) ) {
+               while ( ( $line = fgets( $this->fh ) ) !== false ) {
                        $this->lineNum++;
                        $matches = [];
 
index c053104..2b6db93 100644 (file)
@@ -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" );
index a40f09c..5506940 100644 (file)
@@ -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" );
index 26a0672..774e023 100644 (file)
@@ -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++;
                }
index b8cee67..584b141 100644 (file)
@@ -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() {
index cc0f263..77461c5 100644 (file)
@@ -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" );