phpcs: Fix some "Assignment expression not allowed"

Found by new version of mediawiki/codesniffer
https://integration.wikimedia.org/ci/job/mediawiki-core-phpcs/1939/consoleFull

Change-Id: I673f71fd0dfc8d6ba1ce6c3d5da21787ff95cb32
This commit is contained in:
umherirrender 2015-11-01 20:56:20 +01:00
parent 1b14b25a07
commit 96473ea6e4
7 changed files with 24 additions and 11 deletions

View file

@ -476,7 +476,8 @@ class Sanitizer {
}
$badtag = false;
if ( isset( $htmlelements[$t = strtolower( $t )] ) ) {
$t = strtolower( $t );
if ( isset( $htmlelements[$t] ) ) {
# Check our stack
if ( $slash && isset( $htmlsingleonly[$t] ) ) {
$badtag = true;
@ -596,7 +597,8 @@ class Sanitizer {
list( /* $qbar */, $slash, $t, $params, $brace, $rest ) = $regs;
$badtag = false;
if ( isset( $htmlelements[$t = strtolower( $t )] ) ) {
$t = strtolower( $t );
if ( isset( $htmlelements[$t] ) ) {
if ( is_callable( $processCallback ) ) {
call_user_func_array( $processCallback, array( &$params, $args ) );
}

View file

@ -708,8 +708,11 @@ class ResourceLoader implements LoggerAwareInterface {
// Capture any PHP warnings from the output buffer and append them to the
// error list if we're in debug mode.
if ( $context->getDebug() && strlen( $warnings = ob_get_contents() ) ) {
$this->errors[] = $warnings;
if ( $context->getDebug() ) {
$warnings = ob_get_contents();
if ( strlen( $warnings ) ) {
$this->errors[] = $warnings;
}
}
// Save response to file cache unless there are errors
@ -877,8 +880,11 @@ class ResourceLoader implements LoggerAwareInterface {
$response = $fileCache->fetchText();
// Capture any PHP warnings from the output buffer and append them to the
// response in a comment if we're in debug mode.
if ( $context->getDebug() && strlen( $warnings = ob_get_contents() ) ) {
$response = self::makeComment( $warnings ) . $response;
if ( $context->getDebug() ) {
$warnings = ob_get_contents();
if ( strlen( $warnings ) ) {
$response = self::makeComment( $warnings ) . $response;
}
}
// Remove the output buffer and output the response
ob_end_clean();

View file

@ -107,7 +107,8 @@ class SpecialContributions extends IncludableSpecialPage {
)->inContentLanguage() );
}
if ( ( $ns = $request->getVal( 'namespace', null ) ) !== null && $ns !== '' ) {
$ns = $request->getVal( 'namespace', null );
if ( $ns !== null && $ns !== '' ) {
$this->opts['namespace'] = intval( $ns );
} else {
$this->opts['namespace'] = '';

View file

@ -413,7 +413,8 @@ class DeletedContributionsPage extends SpecialPage {
$target = $userObj->getName();
$out->addSubtitle( $this->getSubTitle( $userObj ) );
if ( ( $ns = $request->getVal( 'namespace', null ) ) !== null && $ns !== '' ) {
$ns = $request->getVal( 'namespace', null );
if ( $ns !== null && $ns !== '' ) {
$options['namespace'] = intval( $ns );
} else {
$options['namespace'] = '';

View file

@ -255,7 +255,8 @@ class MediaWikiTitleCodec implements TitleFormatter, TitleParser {
$m = array();
if ( preg_match( $prefixRegexp, $dbkey, $m ) ) {
$p = $m[1];
if ( ( $ns = $this->language->getNsIndex( $p ) ) !== false ) {
$ns = $this->language->getNsIndex( $p );
if ( $ns !== false ) {
# Ordinary namespace
$dbkey = $m[2];
$parts['namespace'] = $ns;

View file

@ -97,7 +97,8 @@ class MWCryptRand {
}
}
// The absolute filename itself will differ from install to install so don't leave it out
if ( ( $path = realpath( $file ) ) !== false ) {
$path = realpath( $file );
if ( $path !== false ) {
$state .= $path;
} else {
$state .= $file;

View file

@ -119,7 +119,8 @@ TEXT;
private function getNsIndex( $namespace ) {
global $wgContLang;
if ( ( $result = $wgContLang->getNsIndex( $namespace ) ) !== false ) {
$result = $wgContLang->getNsIndex( $namespace );
if ( $result !== false ) {
return $result;
}
$ns = intval( $namespace );