From 0ea1898b4e7a8b2624e3f0bf0c8561b6ce882695 Mon Sep 17 00:00:00 2001 From: Reedy Date: Sat, 26 Sep 2015 16:48:10 +0100 Subject: [PATCH] Re-enable MediaWiki.WhiteSpace.SpaceyParenthesis.SingleSpaceAfterOpenParenthesis Fixed some SingleSpaceBeforeCloseParenthesis too Change-Id: I1695c706a9b23ab98074ff7d6a3687eb5cdce6e7 --- .../debug/logger/monolog/BufferHandler.php | 2 +- .../debug/logger/monolog/KafkaHandler.php | 2 +- includes/utils/AvroValidator.php | 26 +++++++++---------- phpcs.xml | 1 - .../debug/logger/monolog/KafkaHandlerTest.php | 8 +++--- 5 files changed, 19 insertions(+), 20 deletions(-) diff --git a/includes/debug/logger/monolog/BufferHandler.php b/includes/debug/logger/monolog/BufferHandler.php index 3ebd0b1f30..ea286b3bd5 100644 --- a/includes/debug/logger/monolog/BufferHandler.php +++ b/includes/debug/logger/monolog/BufferHandler.php @@ -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; } diff --git a/includes/debug/logger/monolog/KafkaHandler.php b/includes/debug/logger/monolog/KafkaHandler.php index 59d7764a95..1583cd17b0 100644 --- a/includes/debug/logger/monolog/KafkaHandler.php +++ b/includes/debug/logger/monolog/KafkaHandler.php @@ -133,7 +133,7 @@ class KafkaHandler extends AbstractProcessingHandler { } } if ( $messages ) { - $this->addMessages($channel, $messages); + $this->addMessages( $channel, $messages ); } } diff --git a/includes/utils/AvroValidator.php b/includes/utils/AvroValidator.php index 89341eaf23..b9d30d7784 100644 --- a/includes/utils/AvroValidator.php +++ b/includes/utils/AvroValidator.php @@ -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(); diff --git a/phpcs.xml b/phpcs.xml index 03b2af2443..d1d73843f6 100644 --- a/phpcs.xml +++ b/phpcs.xml @@ -6,7 +6,6 @@ - diff --git a/tests/phpunit/includes/debug/logger/monolog/KafkaHandlerTest.php b/tests/phpunit/includes/debug/logger/monolog/KafkaHandlerTest.php index ef6f8475a4..9866ce140d 100644 --- a/tests/phpunit/includes/debug/logger/monolog/KafkaHandlerTest.php +++ b/tests/phpunit/includes/debug/logger/monolog/KafkaHandlerTest.php @@ -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() ); -- 2.20.1