jenkins-bot has submitted this change and it was merged.

Change subject: Fix CodeSniffer errors and warnings
......................................................................


Fix CodeSniffer errors and warnings

Change-Id: Idc74e34634d88625773fb8f73315f61edfa67e28
---
M includes/api/ApiMain.php
M includes/api/ApiPageSet.php
M includes/api/ApiQueryAllCategories.php
M includes/api/ApiQueryAllLinks.php
M includes/api/ApiQueryAllPages.php
M includes/api/ApiQueryDeletedrevs.php
M includes/api/ApiQueryImageInfo.php
M includes/api/ApiQuerySiteinfo.php
M includes/api/ApiQueryUserContributions.php
M includes/api/ApiRevisionDelete.php
M includes/api/ApiWatch.php
M includes/db/DatabaseMssql.php
M includes/db/DatabasePostgres.php
M includes/filebackend/SwiftFileBackend.php
M includes/htmlform/HTMLForm.php
M includes/installer/MysqlUpdater.php
M includes/installer/PostgresUpdater.php
M includes/installer/SqliteUpdater.php
18 files changed, 97 insertions(+), 35 deletions(-)

Approvals:
  Chad: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/api/ApiMain.php b/includes/api/ApiMain.php
index 81b5e9f..2684f51 100644
--- a/includes/api/ApiMain.php
+++ b/includes/api/ApiMain.php
@@ -39,7 +39,6 @@
  * @ingroup API
  */
 class ApiMain extends ApiBase {
-
        /**
         * When no format parameter is given, this format will be used
         */
@@ -1148,7 +1147,10 @@
                        array( 'code' => 'maxlag', 'info' => 'Waiting for host: 
x seconds lagged' ),
                        array( 'code' => 'maxlag', 'info' => 'Waiting for a 
database server: x seconds lagged' ),
                        array( 'code' => 'assertuserfailed', 'info' => 
'Assertion that the user is logged in failed' ),
-                       array( 'code' => 'assertbotfailed', 'info' => 
'Assertion that the user has the bot right failed' ),
+                       array(
+                               'code' => 'assertbotfailed',
+                               'info' => 'Assertion that the user has the bot 
right failed'
+                       ),
                ) );
        }
 
diff --git a/includes/api/ApiPageSet.php b/includes/api/ApiPageSet.php
index 36dd726..4ecf029 100644
--- a/includes/api/ApiPageSet.php
+++ b/includes/api/ApiPageSet.php
@@ -39,7 +39,6 @@
  * @since 1.21 derives from ApiBase instead of ApiQueryBase
  */
 class ApiPageSet extends ApiBase {
-
        /**
         * Constructor flag: The new instance of ApiPageSet will ignore the 
'generator=' parameter
         * @since 1.21
@@ -536,7 +535,9 @@
         * @return array Array suitable for inclusion in the response
         * @since 1.23
         */
-       public function getInvalidTitlesAndRevisions( $invalidChecks = array( 
'invalidTitles', 'special', 'missingIds', 'missingRevIds', 'missingTitles', 
'interwikiTitles' ) ) {
+       public function getInvalidTitlesAndRevisions( $invalidChecks = array( 
'invalidTitles',
+               'special', 'missingIds', 'missingRevIds', 'missingTitles', 
'interwikiTitles' )
+       ) {
                $result = array();
                if ( in_array( "invalidTitles", $invalidChecks ) ) {
                        self::addValues( $result, $this->getInvalidTitles(), 
'invalid', 'title' );
diff --git a/includes/api/ApiQueryAllCategories.php 
b/includes/api/ApiQueryAllCategories.php
index 6bf8075..44bf0cb 100644
--- a/includes/api/ApiQueryAllCategories.php
+++ b/includes/api/ApiQueryAllCategories.php
@@ -67,8 +67,12 @@
                }
 
                $dir = ( $params['dir'] == 'descending' ? 'older' : 'newer' );
-               $from = ( $params['from'] === null ? null : 
$this->titlePartToKey( $params['from'], NS_CATEGORY ) );
-               $to = ( $params['to'] === null ? null : $this->titlePartToKey( 
$params['to'], NS_CATEGORY ) );
+               $from = ( $params['from'] === null
+                       ? null
+                       : $this->titlePartToKey( $params['from'], NS_CATEGORY ) 
);
+               $to = ( $params['to'] === null
+                       ? null
+                       : $this->titlePartToKey( $params['to'], NS_CATEGORY ) );
                $this->addWhereRange( 'cat_title', $dir, $from, $to );
 
                $min = $params['min'];
diff --git a/includes/api/ApiQueryAllLinks.php 
b/includes/api/ApiQueryAllLinks.php
index 5be304d..13f766e 100644
--- a/includes/api/ApiQueryAllLinks.php
+++ b/includes/api/ApiQueryAllLinks.php
@@ -154,7 +154,6 @@
                        $this->titlePartToKey( $params['to'], 
$params['namespace'] ) );
                $this->addWhereRange( $pfx . $fieldTitle, 'newer', $from, $to );
 
-
                if ( isset( $params['prefix'] ) ) {
                        $this->addWhere( $pfx . $fieldTitle . $db->buildLike( 
$this->titlePartToKey(
                                $params['prefix'], $params['namespace'] ), 
$db->anyString() ) );
diff --git a/includes/api/ApiQueryAllPages.php 
b/includes/api/ApiQueryAllPages.php
index 430dd51..501154a 100644
--- a/includes/api/ApiQueryAllPages.php
+++ b/includes/api/ApiQueryAllPages.php
@@ -87,8 +87,12 @@
 
                $this->addWhereFld( 'page_namespace', $params['namespace'] );
                $dir = ( $params['dir'] == 'descending' ? 'older' : 'newer' );
-               $from = ( $params['from'] === null ? null : 
$this->titlePartToKey( $params['from'], $params['namespace'] ) );
-               $to = ( $params['to'] === null ? null : $this->titlePartToKey( 
$params['to'], $params['namespace'] ) );
+               $from = ( $params['from'] === null
+                       ? null
+                       : $this->titlePartToKey( $params['from'], 
$params['namespace'] ) );
+               $to = ( $params['to'] === null
+                       ? null
+                       : $this->titlePartToKey( $params['to'], 
$params['namespace'] ) );
                $this->addWhereRange( 'page_title', $dir, $from, $to );
 
                if ( isset( $params['prefix'] ) ) {
diff --git a/includes/api/ApiQueryDeletedrevs.php 
b/includes/api/ApiQueryDeletedrevs.php
index 7585ba7..365fe3f 100644
--- a/includes/api/ApiQueryDeletedrevs.php
+++ b/includes/api/ApiQueryDeletedrevs.php
@@ -176,8 +176,12 @@
                } elseif ( $mode == 'all' ) {
                        $this->addWhereFld( 'ar_namespace', 
$params['namespace'] );
 
-                       $from = $params['from'] === null ? null : 
$this->titlePartToKey( $params['from'], $params['namespace'] );
-                       $to = $params['to'] === null ? null : 
$this->titlePartToKey( $params['to'], $params['namespace'] );
+                       $from = $params['from'] === null
+                               ? null
+                               : $this->titlePartToKey( $params['from'], 
$params['namespace'] );
+                       $to = $params['to'] === null
+                               ? null
+                               : $this->titlePartToKey( $params['to'], 
$params['namespace'] );
                        $this->addWhereRange( 'ar_title', $dir, $from, $to );
 
                        if ( isset( $params['prefix'] ) ) {
diff --git a/includes/api/ApiQueryImageInfo.php 
b/includes/api/ApiQueryImageInfo.php
index baee9b1..95c1420 100644
--- a/includes/api/ApiQueryImageInfo.php
+++ b/includes/api/ApiQueryImageInfo.php
@@ -677,7 +677,8 @@
                                ' (requires url and param ' . $modulePrefix . 
'urlwidth)',
                        'mediatype' =>      ' mediatype     - Adds the media 
type of the image',
                        'metadata' =>       ' metadata      - Lists Exif 
metadata for the version of the image',
-                       'commonmetadata' => ' commonmetadata - Lists file 
format generic metadata for the version of the image',
+                       'commonmetadata' => ' commonmetadata - Lists file 
format generic metadata ' .
+                               'for the version of the image',
                        'extmetadata' =>    ' extmetadata   - Lists formatted 
metadata combined ' .
                                'from multiple sources. Results are HTML 
formatted.',
                        'archivename' =>    ' archivename   - Adds the file 
name of the archive ' .
diff --git a/includes/api/ApiQuerySiteinfo.php 
b/includes/api/ApiQuerySiteinfo.php
index 07561ca..a9a5f5f 100644
--- a/includes/api/ApiQuerySiteinfo.php
+++ b/includes/api/ApiQuerySiteinfo.php
@@ -573,12 +573,20 @@
                                                        $ret['vcs-url'] = 
isset( $svnInfo['viewvc-url'] ) ? $svnInfo['viewvc-url'] : '';
                                                }
                                        }
+
                                        if ( 
SpecialVersion::getExtLicenseFileName( $extensionPath ) ) {
                                                $ret['license-name'] = isset( 
$ext['license-name'] ) ? $ext['license-name'] : '';
-                                               $ret['license'] = 
SpecialPage::getTitleFor( 'Version', "License/{$ext['name']}" )->getLinkURL();
+                                               $ret['license'] = 
SpecialPage::getTitleFor(
+                                                       'Version',
+                                                       "License/{$ext['name']}"
+                                               )->getLinkURL();
                                        }
+
                                        if ( 
SpecialVersion::getExtAuthorsFileName( $extensionPath ) ) {
-                                               $ret['credits'] = 
SpecialPage::getTitleFor( 'Version', "Credits/{$ext['name']}" )->getLinkURL();
+                                               $ret['credits'] = 
SpecialPage::getTitleFor(
+                                                       'Version',
+                                                       "Credits/{$ext['name']}"
+                                               )->getLinkURL();
                                        }
                                }
                                $data[] = $ret;
diff --git a/includes/api/ApiQueryUserContributions.php 
b/includes/api/ApiQueryUserContributions.php
index 7896a2c..b492d9a 100644
--- a/includes/api/ApiQueryUserContributions.php
+++ b/includes/api/ApiQueryUserContributions.php
@@ -360,7 +360,13 @@
                                $vals['commenthidden'] = '';
                                $anyHidden = true;
                        }
-                       if ( Revision::userCanBitfield( $row->rev_deleted, 
Revision::DELETED_COMMENT, $this->getUser() ) ) {
+
+                       $userCanView = Revision::userCanBitfield(
+                               $row->rev_deleted,
+                               Revision::DELETED_COMMENT, $this->getUser()
+                       );
+
+                       if ( $userCanView ) {
                                if ( $this->fld_comment ) {
                                        $vals['comment'] = $row->rev_comment;
                                }
diff --git a/includes/api/ApiRevisionDelete.php 
b/includes/api/ApiRevisionDelete.php
index 55d59f4..9ba30d7 100644
--- a/includes/api/ApiRevisionDelete.php
+++ b/includes/api/ApiRevisionDelete.php
@@ -97,14 +97,19 @@
                $data = $this->extractStatusInfo( $status );
                $data['target'] = $targetObj->getFullText();
                $data['items'] = array();
+
                foreach ( $status->itemStatuses as $id => $s ) {
                        $data['items'][$id] = $this->extractStatusInfo( $s );
                        $data['items'][$id]['id'] = $id;
                }
+
                $list->reloadFromMaster();
+               // @codingStandardsIgnoreStart Avoid function calls in a FOR 
loop test part
                for ( $item = $list->reset(); $list->current(); $item = 
$list->next() ) {
                        $data['items'][$item->getId()] += $item->getApiData( 
$this->getResult() );
                }
+               // @codingStandardsIgnoreEnd
+
                $data['items'] = array_values( $data['items'] );
                $result->setIndexedTagName( $data['items'], 'i' );
                $result->addValue( null, $this->getModuleName(), $data );
@@ -232,10 +237,12 @@
 
        public function getExamples() {
                return array(
-                       
'api.php?action=revisiondelete&target=Main%20Page&type=revision&ids=12345&hide=content&token=123ABC'
-                       => 'Hide content for revision 12345 on the Main Page',
-                       
'api.php?action=revisiondelete&type=logging&ids=67890&hide=content|comment|user&reason=BLP%20violation&token=123ABC'
-                       => 'Hide all data on log entry 67890 with the reason 
"BLP violation"',
+                       
'api.php?action=revisiondelete&target=Main%20Page&type=revision&ids=12345&' .
+                               'hide=content&token=123ABC'
+                               => 'Hide content for revision 12345 on the Main 
Page',
+                       
'api.php?action=revisiondelete&type=logging&ids=67890&hide=content|comment|user&'
 .
+                               'reason=BLP%20violation&token=123ABC'
+                               => 'Hide all data on log entry 67890 with the 
reason "BLP violation"',
                );
        }
 
diff --git a/includes/api/ApiWatch.php b/includes/api/ApiWatch.php
index 09f9356..d0049ff 100644
--- a/includes/api/ApiWatch.php
+++ b/includes/api/ApiWatch.php
@@ -48,12 +48,20 @@
                // title is still supported for backward compatibility
                if ( !isset( $params['title'] ) ) {
                        $pageSet->execute();
-                       $res = $pageSet->getInvalidTitlesAndRevisions( array( 
'invalidTitles', 'special', 'missingIds', 'missingRevIds', 'interwikiTitles' ) 
);
+                       $res = $pageSet->getInvalidTitlesAndRevisions( array(
+                               'invalidTitles',
+                               'special',
+                               'missingIds',
+                               'missingRevIds',
+                               'interwikiTitles'
+                       ) );
+
                        foreach ( $pageSet->getMissingTitles() as $title ) {
                                $r = $this->watchTitle( $title, $user, $params 
);
                                $r['missing'] = 1;
                                $res[] = $r;
                        }
+
                        foreach ( $pageSet->getGoodTitles() as $title ) {
                                $r = $this->watchTitle( $title, $user, $params 
);
                                $res[] = $r;
@@ -64,9 +72,13 @@
                        $extraParams = array_keys( array_filter( 
$pageSet->extractRequestParams(), function ( $x ) {
                                return $x !== null && $x !== false;
                        } ) );
+
                        if ( $extraParams ) {
                                $p = $this->getModulePrefix();
-                               $this->dieUsage( "The parameter {$p}title can 
not be used with ".  implode( ", ", $extraParams ), 'invalidparammix' );
+                               $this->dieUsage(
+                                       "The parameter {$p}title can not be 
used with " . implode( ", ", $extraParams ),
+                                       'invalidparammix'
+                               );
                        }
 
                        $title = Title::newFromText( $params['title'] );
@@ -78,7 +90,9 @@
                $this->getResult()->addValue( null, $this->getModuleName(), 
$res );
        }
 
-       private function watchTitle( Title $title, User $user, array $params, 
$compatibilityMode = false ) {
+       private function watchTitle( Title $title, User $user, array $params,
+               $compatibilityMode = false
+       ) {
                if ( !$title->isWatchable() ) {
                        return array( 'title' => $title->getPrefixedText(), 
'watchable' => 0 );
                }
@@ -115,7 +129,6 @@
                if ( !is_null( $oldLang ) ) {
                        $this->getContext()->setLanguage( $oldLang ); // Reset 
language to $oldLang
                }
-
 
                if ( !$status->isOK() ) {
                        if ( $compatibilityMode ) {
diff --git a/includes/db/DatabaseMssql.php b/includes/db/DatabaseMssql.php
index 9636da5..8826683 100644
--- a/includes/db/DatabaseMssql.php
+++ b/includes/db/DatabaseMssql.php
@@ -984,7 +984,9 @@
         * @param array $join_conds
         * @return string
         */
-       protected function tableNamesWithUseIndexOrJOIN( $tables, $use_index = 
array(), $join_conds = array() ) {
+       protected function tableNamesWithUseIndexOrJOIN( $tables, $use_index = 
array(),
+               $join_conds = array()
+       ) {
                $ret = array();
                $retJOIN = array();
                $use_index_safe = is_array( $use_index ) ? $use_index : array();
diff --git a/includes/db/DatabasePostgres.php b/includes/db/DatabasePostgres.php
index 6475c8f..c8830d3 100644
--- a/includes/db/DatabasePostgres.php
+++ b/includes/db/DatabasePostgres.php
@@ -827,7 +827,9 @@
         * can be locked. That means tables in an outer join cannot be FOR 
UPDATE locked. Trying to do
         * so causes a DB error. This wrapper checks which tables can be locked 
and adjusts it accordingly.
         */
-       function selectSQLText( $table, $vars, $conds = '', $fname = 
__METHOD__, $options = array(), $join_conds = array() ) {
+       function selectSQLText( $table, $vars, $conds = '', $fname = __METHOD__,
+               $options = array(), $join_conds = array()
+       ) {
                if ( is_array( $options ) ) {
                        $forUpdateKey = array_search( 'FOR UPDATE', $options );
                        if ( $forUpdateKey !== false && $join_conds ) {
@@ -1063,7 +1065,7 @@
 
        /**
         * Return the next in a sequence, save the value for retrieval via 
insertId()
-        * 
+        *
         * @param string $seqName
         * @return int|null
         */
@@ -1564,7 +1566,7 @@
 
                if ( isset( $options['FOR UPDATE'] ) ) {
                        $postLimitTail .= ' FOR UPDATE OF ' . implode( ', ', 
$options['FOR UPDATE'] );
-               } else if ( isset( $noKeyOptions['FOR UPDATE'] ) ) {
+               } elseif ( isset( $noKeyOptions['FOR UPDATE'] ) ) {
                        $postLimitTail .= ' FOR UPDATE';
                }
 
diff --git a/includes/filebackend/SwiftFileBackend.php 
b/includes/filebackend/SwiftFileBackend.php
index f3b9664..c3d2de8 100644
--- a/includes/filebackend/SwiftFileBackend.php
+++ b/includes/filebackend/SwiftFileBackend.php
@@ -1218,7 +1218,8 @@
                }
 
                // Run all requests for the first stage, then the next, and so 
on
-               for ( $stage = 0; $stage < count( $httpReqsByStage ); ++$stage 
) {
+               $reqCount = count( $httpReqsByStage );
+               for ( $stage = 0; $stage < $reqCount; ++$stage ) {
                        $httpReqs = $this->http->runMulti( 
$httpReqsByStage[$stage] );
                        foreach ( $httpReqs as $index => $httpReq ) {
                                // Run the callback for each request of this 
operation
diff --git a/includes/htmlform/HTMLForm.php b/includes/htmlform/HTMLForm.php
index 1e8da45..f3b7ce7 100644
--- a/includes/htmlform/HTMLForm.php
+++ b/includes/htmlform/HTMLForm.php
@@ -812,8 +812,14 @@
                        if ( $this->isVForm() ) {
                                // mw-ui-block is necessary because the buttons 
aren't necessarily in an
                                // immediate child div of the vform.
-                               // TODO Let client specify if the primary 
submit button is progressive or destructive
-                               array_push( $attribs['class'], 'mw-ui-button', 
'mw-ui-big', 'mw-ui-constructive', 'mw-ui-block' );
+                               // @todo Let client specify if the primary 
submit button is progressive or destructive
+                               array_push(
+                                       $attribs['class'],
+                                       'mw-ui-button',
+                                       'mw-ui-big',
+                                       'mw-ui-constructive',
+                                       'mw-ui-block'
+                               );
                        }
 
                        $html .= Xml::submitButton( $this->getSubmitText(), 
$attribs ) . "\n";
diff --git a/includes/installer/MysqlUpdater.php 
b/includes/installer/MysqlUpdater.php
index 9dfbff8..33ff65e 100644
--- a/includes/installer/MysqlUpdater.php
+++ b/includes/installer/MysqlUpdater.php
@@ -28,7 +28,6 @@
  * @since 1.17
  */
 class MysqlUpdater extends DatabaseUpdater {
-
        protected function getCoreUpdateList() {
                return array(
                        array( 'disableContentHandlerUseDB' ),
@@ -246,8 +245,9 @@
 
                        // 1.23
                        array( 'addField', 'recentchanges', 'rc_source', 
'patch-rc_source.sql' ),
-                       array( 'addIndex', 'logging', 
'log_user_text_type_time',  'patch-logging_user_text_type_time_index.sql' ),
-                       array( 'addIndex', 'logging', 'log_user_text_time',  
'patch-logging_user_text_time_index.sql' ),
+                       array( 'addIndex', 'logging', 'log_user_text_type_time',
+                               'patch-logging_user_text_type_time_index.sql' ),
+                       array( 'addIndex', 'logging', 'log_user_text_time', 
'patch-logging_user_text_time_index.sql' ),
                        array( 'addField', 'page', 'page_links_updated', 
'patch-page_links_updated.sql' ),
                );
        }
diff --git a/includes/installer/PostgresUpdater.php 
b/includes/installer/PostgresUpdater.php
index cd5a8ad..7841fca 100644
--- a/includes/installer/PostgresUpdater.php
+++ b/includes/installer/PostgresUpdater.php
@@ -260,7 +260,8 @@
                        array( 'addPgIndex', 'job', 'job_cmd_token', '(job_cmd, 
job_token, job_random)' ),
                        array( 'addPgIndex', 'job', 'job_cmd_token_id', 
'(job_cmd, job_token, job_id)' ),
                        array( 'addPgIndex', 'filearchive', 'fa_sha1', 
'(fa_sha1)' ),
-                       array( 'addPgIndex', 'logging', 
'logging_user_text_type_time', '(log_user_text, log_type, log_timestamp)' ),
+                       array( 'addPgIndex', 'logging', 
'logging_user_text_type_time',
+                               '(log_user_text, log_type, log_timestamp)' ),
                        array( 'addPgIndex', 'logging', 
'logging_user_text_time', '(log_user_text, log_timestamp)' ),
 
                        array( 'checkIndex', 'pagelink_unique', array(
diff --git a/includes/installer/SqliteUpdater.php 
b/includes/installer/SqliteUpdater.php
index 3db3758..5d4f6de 100644
--- a/includes/installer/SqliteUpdater.php
+++ b/includes/installer/SqliteUpdater.php
@@ -123,7 +123,8 @@
 
                        // 1.23
                        array( 'addField', 'recentchanges', 'rc_source', 
'patch-rc_source.sql' ),
-                       array( 'addIndex', 'logging', 
'log_user_text_type_time',  'patch-logging_user_text_type_time_index.sql' ),
+                       array( 'addIndex', 'logging', 'log_user_text_type_time',
+                               'patch-logging_user_text_type_time_index.sql' ),
                        array( 'addIndex', 'logging', 'log_user_text_time',  
'patch-logging_user_text_time_index.sql' ),
                        array( 'addField', 'page', 'page_links_updated', 
'patch-page_links_updated.sql' ),
                );

-- 
To view, visit https://gerrit.wikimedia.org/r/111430
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Idc74e34634d88625773fb8f73315f61edfa67e28
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Siebrand <[email protected]>
Gerrit-Reviewer: Aaron Schulz <[email protected]>
Gerrit-Reviewer: Anomie <[email protected]>
Gerrit-Reviewer: Chad <[email protected]>
Gerrit-Reviewer: Daniel Friesen <[email protected]>
Gerrit-Reviewer: Hashar <[email protected]>
Gerrit-Reviewer: Parent5446 <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to