Pass phpcs-strict on various files in includes/
authorSiebrand Mazeland <siebrand@kitano.nl>
Thu, 24 Apr 2014 19:50:01 +0000 (21:50 +0200)
committerSiebrand Mazeland <siebrand@kitano.nl>
Thu, 24 Apr 2014 19:50:01 +0000 (21:50 +0200)
These files have all had treatment before, and these occurrences have either
been missed or have been introduced after.

Change-Id: I06cdab4616b5bff47c85152df28f18c861730a23

13 files changed:
includes/api/ApiParse.php
includes/api/ApiQueryPrefixSearch.php
includes/api/ApiQueryRedirects.php
includes/api/ApiQuerySearch.php
includes/cache/LocalisationCache.php
includes/composer/ComposerPackageModifier.php
includes/diff/DairikiDiff.php
includes/exception/MWException.php
includes/filerepo/file/LocalFile.php
includes/htmlform/HTMLForm.php
includes/installer/MssqlInstaller.php
includes/jobqueue/JobQueueFederated.php
includes/media/Bitmap_ClientOnly.php

index 97f0009..a7cc436 100644 (file)
@@ -363,7 +363,8 @@ class ApiParse extends ApiBase {
                }
 
                if ( isset( $prop['limitreportdata'] ) ) {
-                       $result_array['limitreportdata'] = $this->formatLimitReportData( $p_result->getLimitReportData() );
+                       $result_array['limitreportdata'] =
+                               $this->formatLimitReportData( $p_result->getLimitReportData() );
                }
                if ( isset( $prop['limitreporthtml'] ) ) {
                        $limitreportHtml = EditPage::getPreviewLimitReport( $p_result );
@@ -488,7 +489,11 @@ class ApiParse extends ApiBase {
                        if ( $title ) {
                                $entry['url'] = wfExpandUrl( $title->getFullURL(), PROTO_CURRENT );
                                // localised language name in user language (maybe set by uselang=)
-                               $entry['langname'] = Language::fetchLanguageName( $title->getInterwiki(), $this->getLanguage()->getCode() );
+                               $entry['langname'] = Language::fetchLanguageName(
+                                       $title->getInterwiki(),
+                                       $this->getLanguage()->getCode()
+                               );
+
                                // native language name
                                $entry['autonym'] = Language::fetchLanguageName( $title->getInterwiki() );
                        }
index eaa9c01..4abd7f0 100644 (file)
@@ -93,8 +93,8 @@ class ApiQueryPrefixSearch extends ApiQueryGeneratorBase {
                                        ApiBase::PARAM_DFLT => 10,
                                        ApiBase::PARAM_TYPE => 'limit',
                                        ApiBase::PARAM_MIN => 1,
-                                       ApiBase::PARAM_MAX => 100, // Non-standard value for compatibility
-                                                                  // with action=opensearch
+                                       // Non-standard value for compatibility with action=opensearch
+                                       ApiBase::PARAM_MAX => 100,
                                        ApiBase::PARAM_MAX2 => 200,
                                ),
                        );
index cd98c52..2ed7d30 100644 (file)
@@ -116,7 +116,10 @@ class ApiQueryRedirects extends ApiQueryGeneratorBase {
                                $this->dieUsageMsg( 'show' );
                        }
                        $this->addWhereIf( "rd_fragment != $emptyString", isset( $show['fragment'] ) );
-                       $this->addWhereIf( "rd_fragment = $emptyString OR rd_fragment IS NULL", isset( $show['!fragment'] ) );
+                       $this->addWhereIf(
+                               "rd_fragment = $emptyString OR rd_fragment IS NULL",
+                               isset( $show['!fragment'] )
+                       );
                }
 
                $map = $pageSet->getAllTitlesByNamespace();
index 660055c..8eceb6f 100644 (file)
@@ -222,8 +222,12 @@ class ApiQuerySearch extends ApiQueryGeneratorBase {
                                );
 
                                // Add item to results and see whether it fits
-                               $fit = $apiResult->addValue( array( 'query', 'interwiki' . $this->getModuleName(), $result->getInterwikiPrefix()  ),
-                                       null, $vals );
+                               $fit = $apiResult->addValue(
+                                       array( 'query', 'interwiki' . $this->getModuleName(), $result->getInterwikiPrefix()  ),
+                                       null,
+                                       $vals
+                               );
+
                                if ( !$fit ) {
                                        // We hit the limit. We can't really provide any meaningful
                                        // pagination info so just bail out
index 1c36ec0..3bbf1bb 100644 (file)
@@ -691,7 +691,6 @@ class LocalisationCache {
                global $IP;
                wfProfileIn( __METHOD__ );
 
-
                // This reads in the PHP i18n file with non-messages l10n data
                $fileName = Language::getMessagesFileName( $code );
                if ( !file_exists( $fileName ) ) {
index ae8baf2..64c69ef 100644 (file)
@@ -16,7 +16,9 @@ class ComposerPackageModifier {
        protected $versionNormalizer;
        protected $versionFetcher;
 
-       public function __construct( Package $package, ComposerVersionNormalizer $versionNormalizer, MediaWikiVersionFetcher $versionFetcher ) {
+       public function __construct( Package $package,
+               ComposerVersionNormalizer $versionNormalizer, MediaWikiVersionFetcher $versionFetcher
+       ) {
                $this->package = $package;
                $this->versionNormalizer = $versionNormalizer;
                $this->versionFetcher = $versionFetcher;
@@ -48,7 +50,10 @@ class ComposerPackageModifier {
                $mvVersion = $this->versionFetcher->fetchVersion();
                $mvVersion = $this->versionNormalizer->normalizeSuffix( $mvVersion );
 
-               $version = new VersionConstraint( '==', $this->versionNormalizer->normalizeLevelCount( $mvVersion ) );
+               $version = new VersionConstraint(
+                       '==',
+                       $this->versionNormalizer->normalizeLevelCount( $mvVersion )
+               );
                $version->setPrettyString( $mvVersion );
 
                return $version;
index 0e38d68..a4c0168 100644 (file)
@@ -424,7 +424,9 @@ class DiffEngine {
                        }
 
                        $x1 = $xoff + (int)( ( $numer + ( $xlim - $xoff ) * $chunk ) / $nchunks );
+                       // @codingStandardsIgnoreFile Ignore Squiz.WhiteSpace.SemicolonSpacing.Incorrect
                        for ( ; $x < $x1; $x++ ) {
+                               // @codingStandardsIgnoreEnd
                                $line = $flip ? $this->yv[$x] : $this->xv[$x];
                                if ( empty( $ymatches[$line] ) ) {
                                        continue;
index 2b8cb00..82303b9 100644 (file)
@@ -135,7 +135,8 @@ class MWException extends Exception {
 
                if ( $wgShowExceptionDetails ) {
                        return '<p>' . nl2br( htmlspecialchars( MWExceptionHandler::getLogMessage( $this ) ) ) .
-                       '</p><p>Backtrace:</p><p>' . nl2br( htmlspecialchars( MWExceptionHandler::getRedactedTraceAsString( $this ) ) ) .
+                       '</p><p>Backtrace:</p><p>' .
+                       nl2br( htmlspecialchars( MWExceptionHandler::getRedactedTraceAsString( $this ) ) ) .
                        "</p>\n";
                } else {
                        return "<div class=\"errorbox\">" .
@@ -222,7 +223,9 @@ class MWException extends Exception {
                        echo "<!DOCTYPE html>\n" .
                                '<html><head>' .
                                // Mimick OutputPage::setPageTitle behaviour
-                               '<title>' . htmlspecialchars( $this->msg( 'pagetitle', "$1 - $wgSitename", $this->getPageTitle() ) ) . '</title>' .
+                               '<title>' .
+                               htmlspecialchars( $this->msg( 'pagetitle', "$1 - $wgSitename", $this->getPageTitle() ) ) .
+                               '</title>' .
                                '<style>body { font-family: sans-serif; margin: 0; padding: 0.5em 2em; }</style>' .
                                "</head><body>\n";
 
index f89dc3d..3cb918f 100644 (file)
@@ -1458,7 +1458,6 @@ class LocalFile extends File {
 
                wfProfileOut( __METHOD__ . '-edit' );
 
-
                if ( $reupload ) {
                        # Delete old thumbnails
                        wfProfileIn( __METHOD__ . '-purge' );
@@ -1911,7 +1910,9 @@ class LocalFile extends File {
 
                $key = $this->repo->getSharedCacheKey( 'file-volatile', md5( $this->getName() ) );
                if ( $key ) {
-                       if ( $this->lastMarkedVolatile && ( time() - $this->lastMarkedVolatile ) <= self::VOLATILE_TTL ) {
+                       if ( $this->lastMarkedVolatile
+                               && ( time() - $this->lastMarkedVolatile ) <= self::VOLATILE_TTL
+                       ) {
                                return true; // sanity
                        }
                        return ( $wgMemc->get( $key ) !== false );
index 10c9ce0..019eb2b 100644 (file)
@@ -338,8 +338,10 @@ class HTMLForm extends ContextSource {
                }
 
                if ( !$class ) {
-                       throw new MWException( "Descriptor with no class for $fieldname: " . print_r( $descriptor, true ) );
+                       throw new MWException( "Descriptor with no class for $fieldname: "
+                               . print_r( $descriptor, true ) );
                }
+
                return $class;
        }
 
index 248a6e4..51db148 100644 (file)
@@ -45,7 +45,9 @@ class MssqlInstaller extends DatabaseInstaller {
                '_WebWindowsAuthentication' => 'sqlauth',
        );
 
-       public $minimumVersion = '9.00.1399'; // SQL Server 2005 RTM (TODO: are SQL Express version numbers different?)
+       // SQL Server 2005 RTM
+       // @todo Are SQL Express version numbers different?)
+       public $minimumVersion = '9.00.1399';
 
        // These are schema-level privs
        // Note: the web user will be created will full permissions if possible, this permission
@@ -135,7 +137,12 @@ class MssqlInstaller extends DatabaseInstaller {
 
        public function submitConnectForm() {
                // Get variables from the request.
-               $newValues = $this->setVarsFromRequest( array( 'wgDBserver', 'wgDBname', 'wgDBmwschema', 'wgDBprefix' ) );
+               $newValues = $this->setVarsFromRequest( array(
+                       'wgDBserver',
+                       'wgDBname',
+                       'wgDBmwschema',
+                       'wgDBprefix'
+               ) );
 
                // Validate them.
                $status = Status::newGood();
@@ -163,7 +170,11 @@ class MssqlInstaller extends DatabaseInstaller {
                }
 
                // User box
-               $this->setVarsFromRequest( array( '_InstallUser', '_InstallPassword', '_InstallWindowsAuthentication' ) );
+               $this->setVarsFromRequest( array(
+                       '_InstallUser',
+                       '_InstallPassword',
+                       '_InstallWindowsAuthentication'
+               ) );
 
                // Try to connect
                $status = $this->getConnection();
@@ -309,7 +320,8 @@ class MssqlInstaller extends DatabaseInstaller {
 
                        if ( $this->schemaExists( $this->getVar( 'wgDBmwschema' ) ) ) {
                                // wgDBmwschema is validated to only contain alphanumeric + underscore, so this is safe
-                               $res = $conn->query( "SELECT permission_name FROM sys.fn_my_permissions( '{$this->getVar( 'wgDBmwschema' )}', 'SCHEMA' )" );
+                               $res = $conn->query( "SELECT permission_name FROM sys.fn_my_permissions( "
+                                       . "'{$this->getVar( 'wgDBmwschema' )}', 'SCHEMA' )" );
 
                                foreach ( $res as $row ) {
                                        $schemaPrivs[$row->permission_name] = true;
@@ -320,9 +332,11 @@ class MssqlInstaller extends DatabaseInstaller {
                // Now check all the grants we'll need to be doing to see if we can
                foreach ( $this->webUserPrivs as $permission ) {
                        if ( ( isset( $schemaPrivs[$permission] ) && $schemaPrivs[$permission] )
-                                       || ( isset( $dbPrivs[$implied[$permission][0]] ) && $dbPrivs[$implied[$permission][0]] )
-                                       || ( isset( $serverPrivs[$implied[$permission][1]] ) && $serverPrivs[$implied[$permission][1]] ) ) {
-
+                                       || ( isset( $dbPrivs[$implied[$permission][0]] )
+                                               && $dbPrivs[$implied[$permission][0]] )
+                                       || ( isset( $serverPrivs[$implied[$permission][1]] )
+                                               && $serverPrivs[$implied[$permission][1]] )
+                       ) {
                                unset( $grantOptions[$permission] );
                        }
                }
@@ -344,8 +358,11 @@ class MssqlInstaller extends DatabaseInstaller {
                } else {
                        $noCreateMsg = 'config-db-web-no-create-privs';
                }
+
                $wrapperStyle = $this->getVar( '_SameAccount' ) ? 'display: none' : '';
-               $displayStyle = $this->getVar( '_WebWindowsAuthentication' ) == 'windowsauth' ? 'display: none' : '';
+               $displayStyle = $this->getVar( '_WebWindowsAuthentication' ) == 'windowsauth'
+                       ? 'display: none'
+                       : '';
                $s = Html::openElement( 'fieldset' ) .
                        Html::element( 'legend', array(), wfMessage( 'config-db-web-account' )->text() ) .
                        $this->getCheckBox(
@@ -390,9 +407,13 @@ class MssqlInstaller extends DatabaseInstaller {
         * @return Status
         */
        public function submitSettingsForm() {
-               $this->setVarsFromRequest(
-                       array( 'wgDBuser', 'wgDBpassword', '_SameAccount', '_CreateDBAccount', '_WebWindowsAuthentication' )
-               );
+               $this->setVarsFromRequest( array(
+                               'wgDBuser',
+                               'wgDBpassword',
+                               '_SameAccount',
+                               '_CreateDBAccount',
+                               '_WebWindowsAuthentication'
+               ) );
 
                if ( $this->getVar( '_SameAccount' ) ) {
                        $this->setVar( '_WebWindowsAuthentication', $this->getVar( '_InstallWindowsAuthentication' ) );
@@ -408,7 +429,10 @@ class MssqlInstaller extends DatabaseInstaller {
                        $this->setVar( 'wgDBWindowsAuthentication', false );
                }
 
-               if ( $this->getVar( '_CreateDBAccount' ) && $this->getVar( '_WebWindowsAuthentication' ) == 'sqlauth' && strval( $this->getVar( 'wgDBpassword' ) ) == '' ) {
+               if ( $this->getVar( '_CreateDBAccount' )
+                       && $this->getVar( '_WebWindowsAuthentication' ) == 'sqlauth'
+                       && strval( $this->getVar( 'wgDBpassword' ) ) == ''
+               ) {
                        return Status::newFatal( 'config-db-password-empty', $this->getVar( 'wgDBuser' ) );
                }
 
@@ -471,13 +495,22 @@ class MssqlInstaller extends DatabaseInstaller {
                $dbName = $this->getVar( 'wgDBname' );
                $schemaName = $this->getVar( 'wgDBmwschema' );
                if ( !$this->databaseExists( $dbName ) ) {
-                       $conn->query( "CREATE DATABASE " . $conn->addIdentifierQuotes( $dbName ), __METHOD__ );
+                       $conn->query(
+                               "CREATE DATABASE " . $conn->addIdentifierQuotes( $dbName ),
+                               __METHOD__
+                       );
                        $conn->selectDB( $dbName );
                        if ( !$this->schemaExists( $schemaName ) ) {
-                               $conn->query( "CREATE SCHEMA " . $conn->addIdentifierQuotes( $schemaName ), __METHOD__ );
+                               $conn->query(
+                                       "CREATE SCHEMA " . $conn->addIdentifierQuotes( $schemaName ),
+                                       __METHOD__
+                               );
                        }
                        if ( !$this->catalogExists( $schemaName ) ) {
-                               $conn->query( "CREATE FULLTEXT CATALOG " . $conn->addIdentifierQuotes( $schemaName ), __METHOD__ );
+                               $conn->query(
+                                       "CREATE FULLTEXT CATALOG " . $conn->addIdentifierQuotes( $schemaName ),
+                                       __METHOD__
+                               );
                        }
                }
                $this->setupSchemaVars();
@@ -529,7 +562,9 @@ class MssqlInstaller extends DatabaseInstaller {
                                try {
                                        $this->db->begin();
                                        $this->db->selectDB( 'master' );
-                                       $logintype = $this->getVar( '_WebWindowsAuthentication' ) == 'windowsauth' ? 'FROM WINDOWS' : "WITH PASSWORD = $escPass";
+                                       $logintype = $this->getVar( '_WebWindowsAuthentication' ) == 'windowsauth'
+                                               ? 'FROM WINDOWS'
+                                               : "WITH PASSWORD = $escPass";
                                        $this->db->query( "CREATE LOGIN $escUser $logintype" );
                                        $this->db->selectDB( $dbName );
                                        $this->db->query( "CREATE USER $escUser FOR LOGIN $escUser WITH DEFAULT_SCHEMA = $escSchema" );
@@ -603,7 +638,8 @@ class MssqlInstaller extends DatabaseInstaller {
                        $searchindex = $this->db->tableName( 'searchindex' );
                        $schema = $this->db->addIdentifierQuotes( $this->getVar( 'wgDBmwschema' ) );
                        try {
-                               $this->db->query( "CREATE FULLTEXT INDEX ON $searchindex (si_title, si_text) KEY INDEX si_page ON $schema" );
+                               $this->db->query( "CREATE FULLTEXT INDEX ON $searchindex (si_title, si_text) "
+                                       . "KEY INDEX si_page ON $schema" );
                        } catch ( DBQueryError $dqe ) {
                                $status->fatal( 'config-install-tables-failed', $dqe->getText() );
                        }
index 9d46a00..9b4c315 100644 (file)
@@ -221,7 +221,9 @@ class JobQueueFederated extends JobQueue {
                // Try to insert the jobs and update $partitionsTry on any failures.
                // Retry to insert any remaning jobs again, ignoring the bad partitions.
                $jobsLeft = $jobs;
+               // @codingStandardsIgnoreStart Generic.CodeAnalysis.ForLoopWithTestFunctionCall.NotAllowed
                for ( $i = $this->maxPartitionsTry; $i > 0 && count( $jobsLeft ); --$i ) {
+                       // @codingStandardsIgnoreEnd
                        try {
                                $partitionRing->getLiveRing();
                        } catch ( UnexpectedValueException $e ) {
index c105c42..b91fb8a 100644 (file)
  *
  * @ingroup Media
  */
+// @codingStandardsIgnoreStart Squiz.Classes.ValidClassName.NotCamelCaps
 class BitmapHandler_ClientOnly extends BitmapHandler {
+       // @codingStandardsIgnoreEnd
+
        /**
         * @param File $image
         * @param array $params