[MediaWiki-commits] [Gerrit] IPSet[master]: build: Updating mediawiki/mediawiki-codesniffer to 0.10.0

2017-07-07 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/363500 )

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.WhiteSpace.SpaceBeforeSingleLineComment.NewLineComment

Also added "composer fix" command.

Change-Id: I6ff246a42e5c35d9f5de2d9e309da25c33bc1a21
---
M composer.json
M phpcs.xml
M src/IPSet.php
M tests/IPSetTest.php
4 files changed, 62 insertions(+), 57 deletions(-)

Approvals:
  Umherirrender: Looks good to me, but someone else must approve
  Legoktm: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/composer.json b/composer.json
index 6c39e69..c1e1246 100644
--- a/composer.json
+++ b/composer.json
@@ -20,7 +20,7 @@
"require-dev": {
"jakub-onderka/php-parallel-lint": "0.9.2",
"phpunit/phpunit": "^4.8",
-   "mediawiki/mediawiki-codesniffer": "0.5.1"
+   "mediawiki/mediawiki-codesniffer": "0.10.0"
},
"scripts": {
"test": [
@@ -28,6 +28,9 @@
"phpunit $PHPUNIT_ARGS",
"phpcs -p"
],
-   "cover": "phpunit --coverage-html coverage/"
+   "cover": "phpunit --coverage-html coverage/",
+   "fix": [
+   "phpcbf"
+   ]
}
 }
diff --git a/phpcs.xml b/phpcs.xml
index dc93336..317e4ab 100644
--- a/phpcs.xml
+++ b/phpcs.xml
@@ -1,6 +1,8 @@
 
 
-   
+   
+   
+   
.
coverage
vendor
diff --git a/src/IPSet.php b/src/IPSet.php
index 912f602..92e2b0f 100644
--- a/src/IPSet.php
+++ b/src/IPSet.php
@@ -151,9 +151,9 @@
} elseif ( $node === false ) {
// create new subarray to go deeper
if ( !( $curBit & 7 ) && $curBit <= $mask - 8 ) 
{
-   $node = array( 'comp' => 
$rawOrd[$curBit >> 3], 'next' => false );
+   $node = [ 'comp' => $rawOrd[$curBit >> 
3], 'next' => false ];
} else {
-   $node = array( false, false );
+   $node = [ false, false ];
}
}
 
@@ -170,8 +170,8 @@
$unode = $node['next'];
for ( $i = 0; $i < 8; ++$i ) {
$unode = ( $comp & ( 1 << $i ) )
-   ? array( false, $unode )
-   : array( $unode, false 
);
+   ? [ false, $unode ]
+   : [ $unode, false ];
}
$node = $unode;
}
diff --git a/tests/IPSetTest.php b/tests/IPSetTest.php
index cc79ca3..4388e6e 100644
--- a/tests/IPSetTest.php
+++ b/tests/IPSetTest.php
@@ -38,9 +38,9 @@
 * an array of IP => expected (boolean) result against the config 
dataset.
 */
public static function provideIPSets() {
-   $testcases = array(
-   'old_list_subset' => array(
-   array(
+   $testcases = [
+   'old_list_subset' => [
+   [
'208.80.152.162',
'10.64.0.123',
'10.64.0.124',
@@ -78,8 +78,8 @@
'2620:0:862:102:26B6:FDFF:FEF5:AD9C',
'10.20.0.114',
'2620:0:862:102:26B6:FDFF:FEF5:7C38',
-   ),
-   array(
+   ],
+   [
'0.0.0.0' => false,
'255.255.255.255' => false,
'10.64.0.122' => false,
@@ -95,10 +95,10 @@
'2620:0:862:1:26b6:fdff:fef5:abb3' => 
false,
'2620:0:862:1:26b6:fdff:fef5:abb4' => 
true,
'2620:0:862:1:26b6:fdff:fef5:abb5' => 
false,
-   ),
-   ),
-   'new_cidr_set' => array(
-   array(
+   ],
+   ],
+

[MediaWiki-commits] [Gerrit] IPSet[master]: build: Updating mediawiki/mediawiki-codesniffer to 0.10.0

2017-07-05 Thread Legoktm (Code Review)
Legoktm has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/363500 )

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.WhiteSpace.SpaceBeforeSingleLineComment.NewLineComment

Also added "composer fix" command.

Change-Id: I6ff246a42e5c35d9f5de2d9e309da25c33bc1a21
---
M composer.json
M phpcs.xml
M src/IPSet.php
M tests/IPSetTest.php
4 files changed, 62 insertions(+), 57 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/IPSet refs/changes/00/363500/1

diff --git a/composer.json b/composer.json
index 6c39e69..c1e1246 100644
--- a/composer.json
+++ b/composer.json
@@ -20,7 +20,7 @@
"require-dev": {
"jakub-onderka/php-parallel-lint": "0.9.2",
"phpunit/phpunit": "^4.8",
-   "mediawiki/mediawiki-codesniffer": "0.5.1"
+   "mediawiki/mediawiki-codesniffer": "0.10.0"
},
"scripts": {
"test": [
@@ -28,6 +28,9 @@
"phpunit $PHPUNIT_ARGS",
"phpcs -p"
],
-   "cover": "phpunit --coverage-html coverage/"
+   "cover": "phpunit --coverage-html coverage/",
+   "fix": [
+   "phpcbf"
+   ]
}
 }
diff --git a/phpcs.xml b/phpcs.xml
index dc93336..317e4ab 100644
--- a/phpcs.xml
+++ b/phpcs.xml
@@ -1,6 +1,8 @@
 
 
-   
+   
+   
+   
.
coverage
vendor
diff --git a/src/IPSet.php b/src/IPSet.php
index 912f602..92e2b0f 100644
--- a/src/IPSet.php
+++ b/src/IPSet.php
@@ -151,9 +151,9 @@
} elseif ( $node === false ) {
// create new subarray to go deeper
if ( !( $curBit & 7 ) && $curBit <= $mask - 8 ) 
{
-   $node = array( 'comp' => 
$rawOrd[$curBit >> 3], 'next' => false );
+   $node = [ 'comp' => $rawOrd[$curBit >> 
3], 'next' => false ];
} else {
-   $node = array( false, false );
+   $node = [ false, false ];
}
}
 
@@ -170,8 +170,8 @@
$unode = $node['next'];
for ( $i = 0; $i < 8; ++$i ) {
$unode = ( $comp & ( 1 << $i ) )
-   ? array( false, $unode )
-   : array( $unode, false 
);
+   ? [ false, $unode ]
+   : [ $unode, false ];
}
$node = $unode;
}
diff --git a/tests/IPSetTest.php b/tests/IPSetTest.php
index cc79ca3..4388e6e 100644
--- a/tests/IPSetTest.php
+++ b/tests/IPSetTest.php
@@ -38,9 +38,9 @@
 * an array of IP => expected (boolean) result against the config 
dataset.
 */
public static function provideIPSets() {
-   $testcases = array(
-   'old_list_subset' => array(
-   array(
+   $testcases = [
+   'old_list_subset' => [
+   [
'208.80.152.162',
'10.64.0.123',
'10.64.0.124',
@@ -78,8 +78,8 @@
'2620:0:862:102:26B6:FDFF:FEF5:AD9C',
'10.20.0.114',
'2620:0:862:102:26B6:FDFF:FEF5:7C38',
-   ),
-   array(
+   ],
+   [
'0.0.0.0' => false,
'255.255.255.255' => false,
'10.64.0.122' => false,
@@ -95,10 +95,10 @@
'2620:0:862:1:26b6:fdff:fef5:abb3' => 
false,
'2620:0:862:1:26b6:fdff:fef5:abb4' => 
true,
'2620:0:862:1:26b6:fdff:fef5:abb5' => 
false,
-   ),
-   ),
-   'new_cidr_set' => array(
-   array(
+   ],
+   ],
+   'new_cidr_set' => [
+   [