jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/363508 )

Change subject: build: Updating mediawiki/mediawiki-codesniffer to 0.10.0
......................................................................


build: Updating mediawiki/mediawiki-codesniffer to 0.10.0

The following sniffs are failing and were disabled:
* MediaWiki.Commenting.FunctionComment.MissingDocumentationPublic
* MediaWiki.Commenting.FunctionComment.MissingParamComment
* MediaWiki.Commenting.FunctionComment.MissingParamTag
* MediaWiki.NamingConventions.LowerCamelFunctionsName.FunctionName
* MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.NewLineComment

Also added "composer fix" command.

Change-Id: I6ed9bb11678983ea6cb0cf220c36bdd799353cbb
---
M composer.json
M phpcs.xml
M src/Reader/Hash.php
M src/Reader/PHP.php
M src/Writer/PHP.php
M tests/CdbTest.php
M tests/Reader/HashTest.php
7 files changed, 30 insertions(+), 21 deletions(-)

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



diff --git a/composer.json b/composer.json
index 728a5b3..5580e61 100644
--- a/composer.json
+++ b/composer.json
@@ -31,7 +31,7 @@
        "require-dev": {
                "jakub-onderka/php-parallel-lint": "0.9",
                "phpunit/phpunit": "^4.8",
-               "mediawiki/mediawiki-codesniffer": "0.5.0"
+               "mediawiki/mediawiki-codesniffer": "0.10.0"
        },
        "scripts": {
                "test": [
@@ -39,6 +39,9 @@
                        "phpunit $PHPUNIT_ARGS",
                        "phpcs -p -s"
                ],
-               "cover": "phpunit --coverage-html coverage"
+               "cover": "phpunit --coverage-html coverage",
+               "fix": [
+                       "phpcbf"
+               ]
        }
 }
diff --git a/phpcs.xml b/phpcs.xml
index e086bd4..01c8457 100644
--- a/phpcs.xml
+++ b/phpcs.xml
@@ -1,6 +1,12 @@
 <?xml version="1.0"?>
 <ruleset name="CDB">
-       <rule ref="vendor/mediawiki/mediawiki-codesniffer/MediaWiki"/>
+       <rule ref="./vendor/mediawiki/mediawiki-codesniffer/MediaWiki">
+               <exclude 
name="MediaWiki.Commenting.FunctionComment.MissingDocumentationPublic" />
+               <exclude 
name="MediaWiki.Commenting.FunctionComment.MissingParamComment" />
+               <exclude 
name="MediaWiki.Commenting.FunctionComment.MissingParamTag" />
+               <exclude 
name="MediaWiki.NamingConventions.LowerCamelFunctionsName.FunctionName" />
+               <exclude 
name="MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.NewLineComment" />
+       </rule>
        <file>.</file>
        <exclude-pattern>coverage</exclude-pattern>
        <exclude-pattern>vendor</exclude-pattern>
diff --git a/src/Reader/Hash.php b/src/Reader/Hash.php
index 8eaf670..cbc1807 100644
--- a/src/Reader/Hash.php
+++ b/src/Reader/Hash.php
@@ -61,7 +61,7 @@
         * Close the file. Optional, you can just let the variable go out of 
scope.
         */
        public function close() {
-               $this->data = array();
+               $this->data = [];
                $this->keys = null;
        }
 
diff --git a/src/Reader/PHP.php b/src/Reader/PHP.php
index c388141..8506cfd 100644
--- a/src/Reader/PHP.php
+++ b/src/Reader/PHP.php
@@ -192,7 +192,7 @@
                static $lookups;
 
                if ( !$lookups ) {
-                       $lookups = array();
+                       $lookups = [];
                        for ( $i = 1; $i < 256; $i++ ) {
                                $lookups[ chr( $i ) ] = $i;
                        }
diff --git a/src/Writer/PHP.php b/src/Writer/PHP.php
index 2fd5405..374c6b6 100644
--- a/src/Writer/PHP.php
+++ b/src/Writer/PHP.php
@@ -52,7 +52,7 @@
                        $this->throwException(
                                'Unable to open CDB file "' . 
$this->tmpFileName . '" for write.' );
                }
-               $this->hplist = array();
+               $this->hplist = [];
                $this->numentries = 0;
                $this->pos = 2048; // leaving space for the pointer array, 256 
* 8
                if ( fseek( $this->handle, $this->pos ) == -1 ) {
@@ -122,10 +122,10 @@
         * @param int $h
         */
        protected function addend( $keylen, $datalen, $h ) {
-               $this->hplist[] = array(
+               $this->hplist[] = [
                        'h' => $h,
                        'p' => $this->pos
-               );
+               ];
 
                $this->numentries++;
                $this->posplus( 8 );
@@ -163,7 +163,7 @@
                }
 
                // Fill in $starts with the *end* indexes
-               $starts = array();
+               $starts = [];
                $pos = 0;
                for ( $i = 0; $i < 256; ++$i ) {
                        $pos += $counts[$i];
@@ -177,7 +177,7 @@
                        $packedTables = array_fill( 0, $this->numentries, false 
);
                } else {
                        // array_fill(): Number of elements must be positive
-                       $packedTables = array();
+                       $packedTables = [];
                }
                foreach ( $this->hplist as $item ) {
                        $packedTables[--$starts[255 & $item['h']]] = $item;
@@ -192,9 +192,9 @@
                        $len = $count + $count;
                        $final .= pack( 'VV', $this->pos, $len );
 
-                       $hashtable = array();
+                       $hashtable = [];
                        for ( $u = 0; $u < $len; ++$u ) {
-                               $hashtable[$u] = array( 'h' => 0, 'p' => 0 );
+                               $hashtable[$u] = [ 'h' => 0, 'p' => 0 ];
                        }
 
                        // Fill the hashtable, using the next empty slot if the 
hashed slot
diff --git a/tests/CdbTest.php b/tests/CdbTest.php
index 2ed655e..a2774ca 100644
--- a/tests/CdbTest.php
+++ b/tests/CdbTest.php
@@ -85,7 +85,7 @@
                $w1 = new Writer\PHP( $this->phpCdbFile );
                $w2 = new Writer\DBA( $this->dbaCdbFile );
 
-               $data = array();
+               $data = [];
                for ( $i = 0; $i < 1000; $i++ ) {
                        $key = self::randomString();
                        $value = self::randomString();
diff --git a/tests/Reader/HashTest.php b/tests/Reader/HashTest.php
index 78919a2..e3e6546 100644
--- a/tests/Reader/HashTest.php
+++ b/tests/Reader/HashTest.php
@@ -14,31 +14,31 @@
        }
 
        public function testClose() {
-               $reader = new Hash( array( 'foo' => 'FOO' ) );
+               $reader = new Hash( [ 'foo' => 'FOO' ] );
                $reader->close();
 
                $this->assertFalse( $reader->get( 'foo' ) );
        }
 
        public function testGet() {
-               $reader = new Hash( array( 'foo' => 'FOO' ) );
+               $reader = new Hash( [ 'foo' => 'FOO' ] );
 
                $this->assertSame( 'FOO', $reader->get( 'foo' ) );
                $this->assertFalse( $reader->get( 'xyz' ) );
        }
 
        public function testExists() {
-               $reader = new Hash( array( 'foo' => 'FOO' ) );
+               $reader = new Hash( [ 'foo' => 'FOO' ] );
 
                $this->assertTrue( $reader->exists( 'foo' ) );
                $this->assertFalse( $reader->exists( 'xyz' ) );
        }
 
        public function testFirstKey() {
-               $reader = new Hash( array(
+               $reader = new Hash( [
                        'one' => 'ONE',
                        'two' => 'TWO',
-               ) );
+               ] );
 
                $this->assertSame( 'one', $reader->firstkey() );
                $this->assertSame( 'one', $reader->firstkey() );
@@ -48,16 +48,16 @@
        }
 
        public function testFirstKey_empty() {
-               $reader = new Hash( array() );
+               $reader = new Hash( [] );
 
                $this->assertFalse( $reader->firstkey() );
        }
 
        public function testNextKey() {
-               $reader = new Hash( array(
+               $reader = new Hash( [
                        'one' => 'ONE',
                        'two' => 'TWO',
-               ) );
+               ] );
 
                $this->assertSame( 'one', $reader->nextkey() );
                $this->assertSame( 'two', $reader->nextkey() );

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I6ed9bb11678983ea6cb0cf220c36bdd799353cbb
Gerrit-PatchSet: 1
Gerrit-Project: cdb
Gerrit-Branch: master
Gerrit-Owner: Legoktm <lego...@member.fsf.org>
Gerrit-Reviewer: Umherirrender <umherirrender_de...@web.de>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to