phpcs: Fix some "Assignment expression not allowed"
authorumherirrender <umherirrender_de.wp@web.de>
Sun, 1 Nov 2015 19:56:20 +0000 (20:56 +0100)
committerumherirrender <umherirrender_de.wp@web.de>
Sun, 1 Nov 2015 20:07:00 +0000 (21:07 +0100)
Found by new version of mediawiki/codesniffer
https://integration.wikimedia.org/ci/job/mediawiki-core-phpcs/1939/consoleFull

Change-Id: I673f71fd0dfc8d6ba1ce6c3d5da21787ff95cb32

includes/Sanitizer.php
includes/resourceloader/ResourceLoader.php
includes/specials/SpecialContributions.php
includes/specials/SpecialDeletedContributions.php
includes/title/MediaWikiTitleCodec.php
includes/utils/MWCryptRand.php
maintenance/importDump.php

index f88dd05..a856f1e 100644 (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 ) );
                                                }
index 5208c23..f7ba4d2 100644 (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();
index 9672580..f0a5aa6 100644 (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'] = '';
index 44352a7..6f8e786 100644 (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'] = '';
index 6b2e877..0fb208e 100644 (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;
index 53c77c2..10606c1 100644 (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;
index bf59495..8cea5a2 100644 (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 );