Re-enable MediaWiki.WhiteSpace.SpaceyParenthesis.SingleSpaceAfterOpenParenthesis
authorReedy <reedy@wikimedia.org>
Sat, 26 Sep 2015 15:48:10 +0000 (16:48 +0100)
committerReedy <reedy@wikimedia.org>
Sat, 26 Sep 2015 16:13:12 +0000 (16:13 +0000)
Fixed some SingleSpaceBeforeCloseParenthesis too

Change-Id: I1695c706a9b23ab98074ff7d6a3687eb5cdce6e7

includes/debug/logger/monolog/BufferHandler.php
includes/debug/logger/monolog/KafkaHandler.php
includes/utils/AvroValidator.php
phpcs.xml
tests/phpunit/includes/debug/logger/monolog/KafkaHandlerTest.php

index 3ebd0b1..ea286b3 100644 (file)
@@ -37,7 +37,7 @@ class BufferHandler extends BaseBufferHandler {
         * {@inheritDoc}
         */
        public function handle( array $record ) {
-               if (!$this->initialized) {
+               if ( !$this->initialized ) {
                        DeferredUpdates::addCallableUpdate( array( $this, 'close' ) );
                        $this->initialized = true;
                }
index 59d7764..1583cd1 100644 (file)
@@ -133,7 +133,7 @@ class KafkaHandler extends AbstractProcessingHandler {
                                }
                        }
                        if ( $messages ) {
-                               $this->addMessages($channel, $messages);
+                               $this->addMessages( $channel, $messages );
                        }
                }
 
index 89341ea..b9d30d7 100644 (file)
@@ -36,25 +36,25 @@ class AvroValidator {
         *  returned.
         */
        public static function getErrors( AvroSchema $schema, $datum ) {
-               switch ( $schema->type) {
+               switch ( $schema->type ) {
                case AvroSchema::NULL_TYPE:
-                       if ( !is_null($datum) ) {
+                       if ( !is_null( $datum ) ) {
                                return self::wrongType( 'null', $datum );
                        }
                        return array();
                case AvroSchema::BOOLEAN_TYPE:
-                       if ( !is_bool($datum) ) {
+                       if ( !is_bool( $datum ) ) {
                                return self::wrongType( 'boolean', $datum );
                        }
                        return array();
                case AvroSchema::STRING_TYPE:
                case AvroSchema::BYTES_TYPE:
-                       if ( !is_string($datum) ) {
+                       if ( !is_string( $datum ) ) {
                                return self::wrongType( 'string', $datum );
                        }
                        return array();
                case AvroSchema::INT_TYPE:
-                       if ( !is_int($datum) ) {
+                       if ( !is_int( $datum ) ) {
                                return self::wrongType( 'integer', $datum );
                        }
                        if ( AvroSchema::INT_MIN_VALUE > $datum
@@ -68,7 +68,7 @@ class AvroValidator {
                        }
                        return array();
                case AvroSchema::LONG_TYPE:
-                       if ( !is_int($datum) ) {
+                       if ( !is_int( $datum ) ) {
                                return self::wrongType( 'integer', $datum );
                        }
                        if ( AvroSchema::LONG_MIN_VALUE > $datum
@@ -83,16 +83,16 @@ class AvroValidator {
                        return array();
                case AvroSchema::FLOAT_TYPE:
                case AvroSchema::DOUBLE_TYPE:
-                       if ( !is_float($datum) && !is_int($datum) ) {
+                       if ( !is_float( $datum ) && !is_int( $datum ) ) {
                                return self::wrongType( 'float or integer', $datum );
                        }
                        return array();
                case AvroSchema::ARRAY_SCHEMA:
-                       if (!is_array($datum)) {
+                       if ( !is_array( $datum ) ) {
                                return self::wrongType( 'array', $datum );
                        }
                        $errors = array();
-                       foreach ($datum as $d) {
+                       foreach ( $datum as $d ) {
                                $result = self::getErrors( $schema->items(), $d );
                                if ( $result ) {
                                        $errors[] = $result;
@@ -100,12 +100,12 @@ class AvroValidator {
                        }
                        return $errors;
                case AvroSchema::MAP_SCHEMA:
-                       if (!is_array($datum)) {
+                       if ( !is_array( $datum ) ) {
                                return self::wrongType( 'array', $datum );
                        }
                        $errors = array();
-                       foreach ($datum as $k => $v) {
-                               if ( !is_string($k) ) {
+                       foreach ( $datum as $k => $v ) {
+                               if ( !is_string( $k ) ) {
                                        $errors[] = self::wrongType( 'string key', $k );
                                }
                                $result = self::getErrors( $schema->values(), $v );
@@ -116,7 +116,7 @@ class AvroValidator {
                        return $errors;
                case AvroSchema::UNION_SCHEMA:
                        $errors = array();
-                       foreach ($schema->schemas() as $schema) {
+                       foreach ( $schema->schemas() as $schema ) {
                                $result = self::getErrors( $schema, $datum );
                                if ( !$result ) {
                                        return array();
index 03b2af2..d1d7384 100644 (file)
--- a/phpcs.xml
+++ b/phpcs.xml
@@ -6,7 +6,6 @@
                <exclude name="PSR2.Methods.MethodDeclaration.Underscore"/>
                <exclude name="MediaWiki.NamingConventions.PrefixedGlobalFunctions.wfPrefix"/>
                <exclude name="MediaWiki.WhiteSpace.SpaceyParenthesis.SingleSpaceBeforeCloseParenthesis"/>
-               <exclude name="MediaWiki.WhiteSpace.SpaceyParenthesis.SingleSpaceAfterOpenParenthesis"/>
                <exclude name="Squiz.Classes.ValidClassName.NotCamelCaps"/>
                <exclude name="Generic.CodeAnalysis.ForLoopWithTestFunctionCall.NotAllowed"/>
                <exclude name="MediaWiki.WhiteSpace.SpaceAfterControlStructure.Incorrect"/>
index ef6f847..9866ce1 100644 (file)
@@ -52,10 +52,10 @@ class KafkaHandlerTest extends MediaWikiTestCase {
                $produce = $this->getMockBuilder( 'Kafka\Produce' )
                        ->disableOriginalConstructor()
                        ->getMock();
-               $produce->expects($this->any())
-                       ->method('getAvailablePartitions')
-                       ->will($this->returnValue( array( 'A' ) ) );
-               $produce->expects($this->once())
+               $produce->expects( $this->any() )
+                       ->method( 'getAvailablePartitions' )
+                       ->will( $this->returnValue( array( 'A' ) ) );
+               $produce->expects( $this->once() )
                        ->method( 'setMessages' )
                        ->with( $expect, $this->anything(), $this->anything() );