No yoda conditions
Replace if ( 42 === $foo ) by if ( $foo === 42 ) Change-Id: Ice320ef1ae64a59ed035c20134326b35d454f943
This commit is contained in:
parent
c77ecd6695
commit
3ee1560232
35 changed files with 78 additions and 78 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -471,7 +471,7 @@ function wfAppendQuery( $url, $query ) {
|
|||
}
|
||||
|
||||
// Add parameter
|
||||
if ( false === strpos( $url, '?' ) ) {
|
||||
if ( strpos( $url, '?' ) === false ) {
|
||||
$url .= '?';
|
||||
} else {
|
||||
$url .= '&';
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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 );
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
|
|
|
|||
|
|
@ -375,7 +375,7 @@ class LegacyLogger extends AbstractLogger {
|
|||
* @return string
|
||||
*/
|
||||
protected static function flatten( $item ) {
|
||||
if ( null === $item ) {
|
||||
if ( $item === null ) {
|
||||
return '[Null]';
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -689,7 +689,7 @@ class SqlBagOStuff extends BagOStuff {
|
|||
$decomp = gzinflate( $serial );
|
||||
Wikimedia\restoreWarnings();
|
||||
|
||||
if ( false !== $decomp ) {
|
||||
if ( $decomp !== false ) {
|
||||
$serial = $decomp;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 );
|
||||
|
|
|
|||
|
|
@ -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
|
||||
) {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -519,7 +519,7 @@ class SearchHighlighter {
|
|||
$extract = "";
|
||||
$contLang = MediaWikiServices::getInstance()->getContentLanguage();
|
||||
foreach ( $lines as $line ) {
|
||||
if ( 0 == $contextlines ) {
|
||||
if ( $contextlines == 0 ) {
|
||||
break;
|
||||
}
|
||||
++$lineno;
|
||||
|
|
|
|||
|
|
@ -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...
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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 ) ) {
|
||||
|
|
|
|||
|
|
@ -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 ) );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2192,7 +2192,7 @@ class Language {
|
|||
}
|
||||
|
||||
# No difference ? Return time unchanged
|
||||
if ( 0 == $minDiff ) {
|
||||
if ( $minDiff == 0 ) {
|
||||
return $ts;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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?" );
|
||||
|
|
|
|||
|
|
@ -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 ) ) {
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ class GenerateNormalizerDataAr extends Maintenance {
|
|||
$pairs = [];
|
||||
|
||||
$lineNum = 0;
|
||||
while ( false !== ( $line = fgets( $file ) ) ) {
|
||||
while ( ( $line = fgets( $file ) ) !== false ) {
|
||||
++$lineNum;
|
||||
|
||||
# Strip comments
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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?
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ class TestFileReader {
|
|||
}
|
||||
|
||||
private function execute() {
|
||||
while ( false !== ( $line = fgets( $this->fh ) ) ) {
|
||||
while ( ( $line = fgets( $this->fh ) ) !== false ) {
|
||||
$this->lineNum++;
|
||||
$matches = [];
|
||||
|
||||
|
|
|
|||
|
|
@ -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" );
|
||||
|
|
|
|||
|
|
@ -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" );
|
||||
|
|
|
|||
|
|
@ -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++;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
|
|||
|
|
@ -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" );
|
||||
|
|
|
|||
Loading…
Reference in a new issue