jenkins-bot has submitted this change and it was merged.
Change subject: Combine nested if()s
......................................................................
Combine nested if()s
Change-Id: I1ffdae52ce99efd6aa8b8458aa94580527ddd097
---
M MediaWikiMessageChecker.php
M ffs/GettextFFS.php
M scripts/populateFuzzy.php
M specials/SpecialLanguageStats.php
M specials/SpecialTranslationStats.php
M tag/PageTranslationHooks.php
6 files changed, 32 insertions(+), 31 deletions(-)
Approvals:
Nikerabbit: Looks good to me, approved
jenkins-bot: Verified
diff --git a/MediaWikiMessageChecker.php b/MediaWikiMessageChecker.php
index 8da9d2d..43df31d 100644
--- a/MediaWikiMessageChecker.php
+++ b/MediaWikiMessageChecker.php
@@ -298,13 +298,13 @@
$subcheck = 'namespace';
$namespaces = 'help|project|\{\{ns:project}}|mediawiki';
$matches = array();
- if ( preg_match( "/^($namespaces):[\w\s]+$/ui",
$definition, $matches ) ) {
- if ( !preg_match( "/^{$matches[1]}:.+$/u",
$translation ) ) {
- $warnings[$key][] = array(
- array( 'pagename', $subcheck,
$key, $code ),
- 'translate-checks-pagename',
- );
- }
+ if ( preg_match( "/^($namespaces):[\w\s]+$/ui",
$definition, $matches ) &&
+ !preg_match( "/^{$matches[1]}:.+$/u",
$translation )
+ ) {
+ $warnings[$key][] = array(
+ array( 'pagename', $subcheck, $key,
$code ),
+ 'translate-checks-pagename',
+ );
}
}
}
diff --git a/ffs/GettextFFS.php b/ffs/GettextFFS.php
index cb8f783..1bd86e7 100644
--- a/ffs/GettextFFS.php
+++ b/ffs/GettextFFS.php
@@ -127,10 +127,10 @@
/* At this stage we are only interested how many plurals forms
we should
* be expecting when parsing the rest of this file. */
$pluralCount = false;
- if ( isset( $headers['Plural-Forms'] ) ) {
- if ( preg_match( '/nplurals=([0-9]+).*;/',
$headers['Plural-Forms'], $matches ) ) {
- $pluralCount = $metadata['plural'] =
$matches[1];
- }
+ if ( isset( $headers['Plural-Forms'] ) &&
+ preg_match( '/nplurals=([0-9]+).*;/',
$headers['Plural-Forms'], $matches )
+ ) {
+ $pluralCount = $metadata['plural'] = $matches[1];
}
// Then parse the messages
diff --git a/scripts/populateFuzzy.php b/scripts/populateFuzzy.php
index 401e4b4..b2d03a8 100644
--- a/scripts/populateFuzzy.php
+++ b/scripts/populateFuzzy.php
@@ -34,12 +34,13 @@
global $wgTranslateMessageNamespaces;
$namespace = $this->getOption( 'namespace',
$wgTranslateMessageNamespaces );
- if ( is_string( $namespace ) ) {
- if ( !MWNamespace::exists( $namespace ) ) {
- $namespace = MWNamespace::getCanonicalIndex(
$namespace );
- if ( $namespace === null ) {
- $this->error( 'Bad namespace', true );
- }
+ if ( is_string( $namespace ) &&
+ !MWNamespace::exists( $namespace )
+ ) {
+ $namespace = MWNamespace::getCanonicalIndex( $namespace
);
+
+ if ( $namespace === null ) {
+ $this->error( 'Bad namespace', true );
}
}
diff --git a/specials/SpecialLanguageStats.php
b/specials/SpecialLanguageStats.php
index eb9a0df..c6f0649 100644
--- a/specials/SpecialLanguageStats.php
+++ b/specials/SpecialLanguageStats.php
@@ -468,11 +468,11 @@
}
// Calculation of summary row values
- if ( !$group instanceof AggregateMessageGroup ) {
- if ( !isset( $this->statsCounted[$groupId] ) ) {
- $this->totals = MessageGroupStats::multiAdd(
$this->totals, $stats );
- $this->statsCounted[$groupId] = true;
- }
+ if ( !$group instanceof AggregateMessageGroup &&
+ !isset( $this->statsCounted[$groupId] )
+ ) {
+ $this->totals = MessageGroupStats::multiAdd(
$this->totals, $stats );
+ $this->statsCounted[$groupId] = true;
}
$state = $this->getWorkflowStateValue( $groupId );
diff --git a/specials/SpecialTranslationStats.php
b/specials/SpecialTranslationStats.php
index 58ae829..567696a 100644
--- a/specials/SpecialTranslationStats.php
+++ b/specials/SpecialTranslationStats.php
@@ -582,10 +582,10 @@
$data = array();
foreach ( $resData as $date => $edits ) {
- if ( $skip > 0 ) {
- if ( ( $count - $i ) % $skip !== 0 ) {
- $date = '';
- }
+ if ( $skip > 0 &&
+ ( $count - $i ) % $skip !== 0
+ ) {
+ $date = '';
}
if ( strpos( $date, ';' ) !== false ) {
diff --git a/tag/PageTranslationHooks.php b/tag/PageTranslationHooks.php
index bdcedac..d3d3b10 100644
--- a/tag/PageTranslationHooks.php
+++ b/tag/PageTranslationHooks.php
@@ -513,12 +513,12 @@
$action, &$result
) {
$handle = new MessageHandle( $title );
- if ( $action === 'edit' && $handle->isPageTranslation() ) {
- if ( !$handle->isValid() ) {
- $result = array( 'tpt-unknown-page' );
+ if ( $action === 'edit' && $handle->isPageTranslation() &&
+ !$handle->isValid()
+ ) {
+ $result = array( 'tpt-unknown-page' );
- return false;
- }
+ return false;
}
return true;
--
To view, visit https://gerrit.wikimedia.org/r/274961
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I1ffdae52ce99efd6aa8b8458aa94580527ddd097
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/extensions/Translate
Gerrit-Branch: master
Gerrit-Owner: Siebrand <[email protected]>
Gerrit-Reviewer: Nikerabbit <[email protected]>
Gerrit-Reviewer: Siebrand <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits