jenkins-bot has submitted this change and it was merged. Change subject: phpcs: Fix some "Assignment expression not allowed" ......................................................................
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 --- M includes/Sanitizer.php M includes/resourceloader/ResourceLoader.php M includes/specials/SpecialContributions.php M includes/specials/SpecialDeletedContributions.php M includes/title/MediaWikiTitleCodec.php M includes/utils/MWCryptRand.php M maintenance/importDump.php 7 files changed, 24 insertions(+), 11 deletions(-) Approvals: Krinkle: Looks good to me, approved jenkins-bot: Verified diff --git a/includes/Sanitizer.php b/includes/Sanitizer.php index f88dd05..a856f1e 100644 --- a/includes/Sanitizer.php +++ b/includes/Sanitizer.php @@ -476,7 +476,8 @@ } $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 @@ 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 ) ); } diff --git a/includes/resourceloader/ResourceLoader.php b/includes/resourceloader/ResourceLoader.php index 5208c23..f7ba4d2 100644 --- a/includes/resourceloader/ResourceLoader.php +++ b/includes/resourceloader/ResourceLoader.php @@ -708,8 +708,11 @@ // 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 @@ $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(); diff --git a/includes/specials/SpecialContributions.php b/includes/specials/SpecialContributions.php index 9672580..f0a5aa6 100644 --- a/includes/specials/SpecialContributions.php +++ b/includes/specials/SpecialContributions.php @@ -107,7 +107,8 @@ )->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'] = ''; diff --git a/includes/specials/SpecialDeletedContributions.php b/includes/specials/SpecialDeletedContributions.php index 44352a7..6f8e786 100644 --- a/includes/specials/SpecialDeletedContributions.php +++ b/includes/specials/SpecialDeletedContributions.php @@ -413,7 +413,8 @@ $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'] = ''; diff --git a/includes/title/MediaWikiTitleCodec.php b/includes/title/MediaWikiTitleCodec.php index 6b2e877..0fb208e 100644 --- a/includes/title/MediaWikiTitleCodec.php +++ b/includes/title/MediaWikiTitleCodec.php @@ -255,7 +255,8 @@ $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; diff --git a/includes/utils/MWCryptRand.php b/includes/utils/MWCryptRand.php index 53c77c2..10606c1 100644 --- a/includes/utils/MWCryptRand.php +++ b/includes/utils/MWCryptRand.php @@ -97,7 +97,8 @@ } } // 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; diff --git a/maintenance/importDump.php b/maintenance/importDump.php index bf59495..8cea5a2 100644 --- a/maintenance/importDump.php +++ b/maintenance/importDump.php @@ -119,7 +119,8 @@ private function getNsIndex( $namespace ) { global $wgContLang; - if ( ( $result = $wgContLang->getNsIndex( $namespace ) ) !== false ) { + $result = $wgContLang->getNsIndex( $namespace ); + if ( $result !== false ) { return $result; } $ns = intval( $namespace ); -- To view, visit https://gerrit.wikimedia.org/r/250320 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I673f71fd0dfc8d6ba1ce6c3d5da21787ff95cb32 Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Umherirrender <[email protected]> Gerrit-Reviewer: Jackmcbarn <[email protected]> Gerrit-Reviewer: Krinkle <[email protected]> Gerrit-Reviewer: Legoktm <[email protected]> Gerrit-Reviewer: Parent5446 <[email protected]> Gerrit-Reviewer: TTO <[email protected]> Gerrit-Reviewer: Umherirrender <[email protected]> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
