build: Updating mediawiki/mediawiki-codesniffer to 0.12.0
authorUmherirrender <umherirrender_de.wp@web.de>
Sun, 10 Sep 2017 19:11:37 +0000 (21:11 +0200)
committerUmherirrender <umherirrender_de.wp@web.de>
Sun, 10 Sep 2017 19:11:37 +0000 (21:11 +0200)
Change-Id: Iefaae5043fa77d5d556c31079549dab8f61bd3ef

15 files changed:
composer.json
includes/OutputPage.php
includes/libs/filebackend/FileBackendStore.php
includes/libs/objectcache/BagOStuff.php
includes/libs/objectcache/MemcachedBagOStuff.php
includes/libs/objectcache/WANObjectCache.php
includes/libs/rdbms/TransactionProfiler.php
includes/libs/rdbms/database/Database.php
includes/libs/rdbms/loadmonitor/LoadMonitor.php
includes/parser/ParserOutput.php
phpcs.xml
tests/phpunit/includes/GlobalFunctions/wfTimestampTest.php
tests/phpunit/includes/libs/objectcache/WANObjectCacheTest.php
tests/phpunit/includes/libs/rdbms/TransactionProfilerTest.php
tests/phpunit/includes/libs/rdbms/database/DatabaseMysqlBaseTest.php

index dd7567c..70d2e8f 100644 (file)
@@ -54,7 +54,7 @@
                "jakub-onderka/php-parallel-lint": "0.9.2",
                "jetbrains/phpstorm-stubs": "dev-master#1b9906084d6635456fcf3f3a01f0d7d5b99a578a",
                "justinrainbow/json-schema": "~5.2",
-               "mediawiki/mediawiki-codesniffer": "0.11.0",
+               "mediawiki/mediawiki-codesniffer": "0.12.0",
                "monolog/monolog": "~1.22.1",
                "nikic/php-parser": "2.1.0",
                "nmred/kafka-php": "0.1.5",
index dd21194..b71ae89 100644 (file)
@@ -2013,7 +2013,7 @@ class OutputPage extends ContextSource {
                }
 
                $age = time() - wfTimestamp( TS_UNIX, $mtime );
-               $adaptiveTTL = max( .9 * $age, $minTTL );
+               $adaptiveTTL = max( 0.9 * $age, $minTTL );
                $adaptiveTTL = min( $adaptiveTTL, $maxTTL );
 
                $this->lowerCdnMaxage( (int)$adaptiveTTL );
index 77473d1..b8eec3f 100644 (file)
@@ -1714,7 +1714,7 @@ abstract class FileBackendStore extends FileBackend {
                        return; // invalid storage path
                }
                $mtime = ConvertibleTimestamp::convert( TS_UNIX, $val['mtime'] );
-               $ttl = $this->memCache->adaptiveTTL( $mtime, 7 * 86400, 300, .1 );
+               $ttl = $this->memCache->adaptiveTTL( $mtime, 7 * 86400, 300, 0.1 );
                $key = $this->fileCacheKey( $path );
                // Set the cache unless it is currently salted.
                $this->memCache->set( $key, $val, $ttl );
index f834ccf..8a23db5 100644 (file)
@@ -476,7 +476,7 @@ abstract class BagOStuff implements IExpiringStore, LoggerAwareInterface {
                $lSince = microtime( true ); // lock timestamp
 
                return new ScopedCallback( function () use ( $key, $lSince, $expiry ) {
-                       $latency = .050; // latency skew (err towards keeping lock present)
+                       $latency = 0.050; // latency skew (err towards keeping lock present)
                        $age = ( microtime( true ) - $lSince + $latency );
                        if ( ( $age + $latency ) >= $expiry ) {
                                $this->logger->warning( "Lock for $key held too long ($age sec)." );
index 5128d82..0188991 100644 (file)
@@ -45,7 +45,7 @@ class MemcachedBagOStuff extends BagOStuff {
        protected function applyDefaultParams( $params ) {
                return $params + [
                        'compress_threshold' => 1500,
-                       'connect_timeout' => .5,
+                       'connect_timeout' => 0.5,
                        'debug' => false
                ];
        }
index c1c9cc1..1f757a4 100644 (file)
@@ -1424,7 +1424,7 @@ class WANObjectCache implements IExpiringStore, LoggerAwareInterface {
         * @return int Adaptive TTL
         * @since 1.28
         */
-       public function adaptiveTTL( $mtime, $maxTTL, $minTTL = 30, $factor = .2 ) {
+       public function adaptiveTTL( $mtime, $maxTTL, $minTTL = 30, $factor = 0.2 ) {
                if ( is_float( $mtime ) || ctype_digit( $mtime ) ) {
                        $mtime = (int)$mtime; // handle fractional seconds and string integers
                }
index af431a6..57a12a4 100644 (file)
@@ -39,7 +39,7 @@ class TransactionProfiler implements LoggerAwareInterface {
        /** @var float Seconds */
        protected $dbLockThreshold = 3.0;
        /** @var float Seconds */
-       protected $eventThreshold = .25;
+       protected $eventThreshold = 0.25;
        /** @var bool */
        protected $silenced = false;
 
index 2c66d74..c904092 100644 (file)
@@ -54,8 +54,8 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware
        const PING_TTL = 1.0;
        const PING_QUERY = 'SELECT 1 AS ping';
 
-       const TINY_WRITE_SEC = .010;
-       const SLOW_WRITE_SEC = .500;
+       const TINY_WRITE_SEC = 0.010;
+       const SLOW_WRITE_SEC = 0.500;
        const SMALL_WRITE_ROWS = 100;
 
        /** @var string SQL query */
index fdc5ac8..8292c03 100644 (file)
@@ -157,7 +157,7 @@ class LoadMonitor implements ILoadMonitor {
                        $newWeight = $movAveRatio * $coefficient + ( 1 - $movAveRatio ) * $lastWeight;
 
                        // Scale from 10% to 100% of nominal weight
-                       $weightScales[$i] = max( $newWeight, .10 );
+                       $weightScales[$i] = max( $newWeight, 0.10 );
 
                        if ( !$conn ) {
                                $lagTimes[$i] = false;
index 2981748..06319e5 100644 (file)
@@ -223,7 +223,7 @@ class ParserOutput extends CacheTime {
        // finalizeAdaptiveCacheExpiry() uses TTL = MAX( m * PARSE_TIME + b, MIN_AR_TTL)
        // Current values imply that m=3933.333333 and b=-333.333333
        // See https://www.nngroup.com/articles/website-response-times/
-       const PARSE_FAST_SEC = .100; // perceived "fast" page parse
+       const PARSE_FAST_SEC = 0.100; // perceived "fast" page parse
        const PARSE_SLOW_SEC = 1.0; // perceived "slow" page parse
        const FAST_AR_TTL = 60; // adaptive TTL for "fast" pages
        const SLOW_AR_TTL = 3600; // adaptive TTL for "slow" pages
index 4c5266e..bd9890b 100644 (file)
--- a/phpcs.xml
+++ b/phpcs.xml
@@ -20,6 +20,9 @@
                <exclude name="MediaWiki.Usage.DbrQueryUsage.DbrQueryFound" />
                <exclude name="MediaWiki.Usage.ExtendClassUsage.FunctionVarUsage" />
                <exclude name="MediaWiki.Usage.SuperGlobalsUsage.SuperGlobals" />
+               <exclude name="MediaWiki.Files.ClassMatchesFilename.WrongCase" />
+               <exclude name="MediaWiki.Files.ClassMatchesFilename.NotMatch" />
+               <exclude name="MediaWiki.Files.OneClassPerFile.MultipleFound" />
        </rule>
        <rule ref="MediaWiki.NamingConventions.PrefixedGlobalFunctions">
                <properties>
index b6682f7..a70f136 100644 (file)
@@ -21,7 +21,7 @@ class WfTimestampTest extends MediaWikiTestCase {
                        [ -30281104, TS_MW, '19690115123456', 'Negative TS_UNIX to TS_MW' ],
                        [ $t, TS_UNIX, 979562096, 'TS_UNIX to TS_UNIX' ],
                        [ $t, TS_DB, '2001-01-15 12:34:56', 'TS_UNIX to TS_DB' ],
-                       [ $t + .01, TS_MW, '20010115123456', 'TS_UNIX float to TS_MW' ],
+                       [ $t + 0.01, TS_MW, '20010115123456', 'TS_UNIX float to TS_MW' ],
 
                        [ $t, TS_ISO_8601_BASIC, '20010115T123456Z', 'TS_ISO_8601_BASIC to TS_DB' ],
 
index 881ace2..c762aa7 100644 (file)
@@ -1184,11 +1184,11 @@ class WANObjectCacheTest extends PHPUnit_Framework_TestCase {
 
        public static function provideAdaptiveTTL() {
                return [
-                       [ 3600, 900, 30, .2, 720 ],
-                       [ 3600, 500, 30, .2, 500 ],
-                       [ 3600, 86400, 800, .2, 800 ],
-                       [ false, 86400, 800, .2, 800 ],
-                       [ null, 86400, 800, .2, 800 ]
+                       [ 3600, 900, 30, 0.2, 720 ],
+                       [ 3600, 500, 30, 0.2, 500 ],
+                       [ 3600, 86400, 800, 0.2, 800 ],
+                       [ false, 86400, 800, 0.2, 800 ],
+                       [ null, 86400, 800, 0.2, 800 ]
                ];
        }
 
index cb18fb3..b6ea426 100644 (file)
@@ -112,10 +112,10 @@ class TransactionProfilerTest extends PHPUnit_Framework_TestCase {
                $tp->setLogger( $logger );
                $tp->setExpectation( 'queries', 2, __METHOD__ );
 
-               $tp->recordQueryCompletion( "SQL 1", microtime( true ) - .01, false, 0 );
-               $tp->recordQueryCompletion( "SQL 2", microtime( true ) - .01, false, 0 );
-               $tp->recordQueryCompletion( "SQL 3", microtime( true ) - .01, false, 0 ); // warn
-               $tp->recordQueryCompletion( "SQL 4", microtime( true ) - .01, false, 0 ); // warn
+               $tp->recordQueryCompletion( "SQL 1", microtime( true ) - 0.01, false, 0 );
+               $tp->recordQueryCompletion( "SQL 2", microtime( true ) - 0.01, false, 0 );
+               $tp->recordQueryCompletion( "SQL 3", microtime( true ) - 0.01, false, 0 ); // warn
+               $tp->recordQueryCompletion( "SQL 4", microtime( true ) - 0.01, false, 0 ); // warn
        }
 
        public function testWriteQueryCount() {
@@ -126,16 +126,16 @@ class TransactionProfilerTest extends PHPUnit_Framework_TestCase {
                $tp->setLogger( $logger );
                $tp->setExpectation( 'writes', 2, __METHOD__ );
 
-               $tp->recordQueryCompletion( "SQL 1", microtime( true ) - .01, false, 0 );
-               $tp->recordQueryCompletion( "SQL 2", microtime( true ) - .01, false, 0 );
-               $tp->recordQueryCompletion( "SQL 3", microtime( true ) - .01, false, 0 );
-               $tp->recordQueryCompletion( "SQL 4", microtime( true ) - .01, false, 0 );
+               $tp->recordQueryCompletion( "SQL 1", microtime( true ) - 0.01, false, 0 );
+               $tp->recordQueryCompletion( "SQL 2", microtime( true ) - 0.01, false, 0 );
+               $tp->recordQueryCompletion( "SQL 3", microtime( true ) - 0.01, false, 0 );
+               $tp->recordQueryCompletion( "SQL 4", microtime( true ) - 0.01, false, 0 );
 
                $tp->transactionWritingIn( 'srv1', 'db1', '123' );
-               $tp->recordQueryCompletion( "SQL 1w", microtime( true ) - .01, true, 2 );
-               $tp->recordQueryCompletion( "SQL 2w", microtime( true ) - .01, true, 5 );
-               $tp->recordQueryCompletion( "SQL 3w", microtime( true ) - .01, true, 3 );
-               $tp->recordQueryCompletion( "SQL 4w", microtime( true ) - .01, true, 1 );
+               $tp->recordQueryCompletion( "SQL 1w", microtime( true ) - 0.01, true, 2 );
+               $tp->recordQueryCompletion( "SQL 2w", microtime( true ) - 0.01, true, 5 );
+               $tp->recordQueryCompletion( "SQL 3w", microtime( true ) - 0.01, true, 3 );
+               $tp->recordQueryCompletion( "SQL 4w", microtime( true ) - 0.01, true, 1 );
                $tp->transactionWritingOut( 'srv1', 'db1', '123', 1, 1 );
        }
 }
index b564310..456447f 100644 (file)
@@ -352,8 +352,8 @@ class DatabaseMysqlBaseTest extends PHPUnit_Framework_TestCase {
                $db->setLBInfo( 'clusterMasterHost', 'db1052' );
                $lagEst = $db->getLag();
 
-               $this->assertGreaterThan( $lag - .010, $lagEst, "Correct heatbeat lag" );
-               $this->assertLessThan( $lag + .010, $lagEst, "Correct heatbeat lag" );
+               $this->assertGreaterThan( $lag - 0.010, $lagEst, "Correct heatbeat lag" );
+               $this->assertLessThan( $lag + 0.010, $lagEst, "Correct heatbeat lag" );
        }
 
        public static function provideLagAmounts() {