From 34b4226aed56f3cbc60cfed5e2aaed5ca9210e75 Mon Sep 17 00:00:00 2001 From: Dirk Adler Date: Sat, 23 Dec 2023 14:31:00 +0100 Subject: [PATCH] Update symplify/easy-coding-standard and fix cs --- composer.json | 2 +- examples/offset-lags.php | 16 ++++++++-------- src/RdKafka/Admin/Client.php | 1 - src/RdKafka/ConsumerTopic.php | 1 - src/RdKafka/ProducerTopic.php | 4 ---- tests/ConstantsTest.php | 6 +++--- tests/RdKafka/ConsumerTest.php | 2 +- tests/RdKafka/Test/MockClusterTest.php | 10 +++++----- 8 files changed, 18 insertions(+), 24 deletions(-) diff --git a/composer.json b/composer.json index 8ed7cd05..b646a7dd 100644 --- a/composer.json +++ b/composer.json @@ -44,7 +44,7 @@ "require-dev": { "phpunit/phpunit": "^9.4", "ircmaxell/php-c-parser": "dev-master#fd8f5efefd0fcc6c5119d945694acaa3a6790ada", - "symplify/easy-coding-standard": "^10.0", + "symplify/easy-coding-standard": "^12.0", "klitsche/ffigen": "0.8.1", "klitsche/dog": "^0.4", "symfony/dom-crawler": "^5.1", diff --git a/examples/offset-lags.php b/examples/offset-lags.php index c83d3d32..7cc77eb2 100644 --- a/examples/offset-lags.php +++ b/examples/offset-lags.php @@ -81,7 +81,7 @@ function ($consumer, $level, $fac, $buf): void { if ($message === null) { break; } -// var_dump($message->key, $message->payload, $message->err); + // var_dump($message->key, $message->payload, $message->err); if ($message->err === RD_KAFKA_RESP_ERR__TIMED_OUT) { echo '-'; continue; @@ -92,7 +92,7 @@ function ($consumer, $level, $fac, $buf): void { if (count($eofs) === 50) { break; } -// var_export($eofs); + // var_export($eofs); continue; } @@ -117,8 +117,8 @@ function ($consumer, $level, $fac, $buf): void { // parse key value $keyParser = new MessageKeyParser($key); $keyParsed = $keyParser->getParsed(); -// var_dump($keyParser->getVersion()); -// var_export($keyParsed); + // var_dump($keyParser->getVersion()); + // var_export($keyParsed); switch ($keyParser->getVersion()) { case MessageKeyParser::V0_OFFSET_COMMIT_KEY: @@ -126,14 +126,14 @@ function ($consumer, $level, $fac, $buf): void { $payloadParser = new OffsetCommitValueParser($payload); $parsed = $payloadParser->getParsed(); $compactedOffsetCommitValues[$keyParsed['group']][$keyParsed['topic']][$keyParsed['partition']] = $parsed['offset']; -// var_dump($payloadParser->getVersion()); -// var_export($parsed); + // var_dump($payloadParser->getVersion()); + // var_export($parsed); break; case MessageKeyParser::V2_GROUP_METADATA_KEY: $payloadParser = new GroupMetadataValueParser($payload); $parsed = $payloadParser->getParsed(); -// var_dump($payloadParser->getVersion()); -// var_export($parsed); + // var_dump($payloadParser->getVersion()); + // var_export($parsed); foreach ($parsed['members'] as $member) { foreach ($member['assignment']['topic_partitions'] as $topicPartition) { foreach ($topicPartition['partitions'] as $partition) { diff --git a/src/RdKafka/Admin/Client.php b/src/RdKafka/Admin/Client.php index c7d279e8..bfc12916 100644 --- a/src/RdKafka/Admin/Client.php +++ b/src/RdKafka/Admin/Client.php @@ -32,7 +32,6 @@ private function __construct(RdKafka $kafka) } /** - * @return Client * @throws Exception */ public static function fromConf(Conf $conf): self diff --git a/src/RdKafka/ConsumerTopic.php b/src/RdKafka/ConsumerTopic.php index 511671b4..e6b51851 100644 --- a/src/RdKafka/ConsumerTopic.php +++ b/src/RdKafka/ConsumerTopic.php @@ -19,7 +19,6 @@ class ConsumerTopic extends Topic private array $consuming = []; /** - * @param TopicConf $conf * @throws Exception */ public function __construct(Consumer $consumer, string $name, ?TopicConf $conf = null) diff --git a/src/RdKafka/ProducerTopic.php b/src/RdKafka/ProducerTopic.php index ee8fe13d..0cc866a6 100644 --- a/src/RdKafka/ProducerTopic.php +++ b/src/RdKafka/ProducerTopic.php @@ -14,7 +14,6 @@ class ProducerTopic extends Topic { /** - * @param TopicConf $conf * @throws Exception */ public function __construct(Producer $producer, string $name, ?TopicConf $conf = null) @@ -23,9 +22,6 @@ public function __construct(Producer $producer, string $name, ?TopicConf $conf = } /** - * @param string $payload - * @param string $key - * * @throws Exception */ public function produce(int $partition, int $msgflags, ?string $payload = null, ?string $key = null, $opaque = null): void diff --git a/tests/ConstantsTest.php b/tests/ConstantsTest.php index 8681b16e..cd59d218 100644 --- a/tests/ConstantsTest.php +++ b/tests/ConstantsTest.php @@ -67,9 +67,9 @@ public function testConstantsExist(): void $this->assertTrue(defined('RD_KAFKA_RESP_ERR_STALE_CTRL_EPOCH')); $this->assertTrue(defined('RD_KAFKA_RESP_ERR_OFFSET_METADATA_TOO_LARGE')); $this->assertTrue(defined('RD_KAFKA_RESP_ERR_NETWORK_EXCEPTION')); -// $this->assertTrue(defined('RD_KAFKA_RESP_ERR_GROUP_LOAD_IN_PROGRESS')); // missing in ext -// $this->assertTrue(defined('RD_KAFKA_RESP_ERR_GROUP_COORDINATOR_NOT_AVAILABLE')); // missing in ext -// $this->assertTrue(defined('RD_KAFKA_RESP_ERR_NOT_COORDINATOR_FOR_GROUP')); // missing in ext + // $this->assertTrue(defined('RD_KAFKA_RESP_ERR_GROUP_LOAD_IN_PROGRESS')); // missing in ext + // $this->assertTrue(defined('RD_KAFKA_RESP_ERR_GROUP_COORDINATOR_NOT_AVAILABLE')); // missing in ext + // $this->assertTrue(defined('RD_KAFKA_RESP_ERR_NOT_COORDINATOR_FOR_GROUP')); // missing in ext $this->assertTrue(defined('RD_KAFKA_RESP_ERR_TOPIC_EXCEPTION')); $this->assertTrue(defined('RD_KAFKA_RESP_ERR_RECORD_LIST_TOO_LARGE')); $this->assertTrue(defined('RD_KAFKA_RESP_ERR_NOT_ENOUGH_REPLICAS')); diff --git a/tests/RdKafka/ConsumerTest.php b/tests/RdKafka/ConsumerTest.php index 8a2ea74d..29fb2fea 100644 --- a/tests/RdKafka/ConsumerTest.php +++ b/tests/RdKafka/ConsumerTest.php @@ -60,7 +60,7 @@ public function testGetOutQLen(): void $conf->set('bootstrap.servers', KAFKA_BROKERS); $conf->setLogCb( function ($consumer, $level, $fac, $buf): void { -// echo "log: $level $fac $buf" . PHP_EOL; + // echo "log: $level $fac $buf" . PHP_EOL; } ); diff --git a/tests/RdKafka/Test/MockClusterTest.php b/tests/RdKafka/Test/MockClusterTest.php index db31bebf..31cb312e 100644 --- a/tests/RdKafka/Test/MockClusterTest.php +++ b/tests/RdKafka/Test/MockClusterTest.php @@ -117,7 +117,7 @@ public function testSetApiVersion(): void function (Producer $producer, int $level, string $fac, string $buf) use (&$logStack): void { if (strpos($buf, 'ApiKey') > 0) { $logStack[] = $buf; -// echo $buf . PHP_EOL; + // echo $buf . PHP_EOL; } } ); @@ -313,7 +313,7 @@ public function testPushRequestErrors(): void $consumerConfig = new Conf(); $consumerConfig->set('log_level', (string) LOG_EMERG); $consumerConfig->set('group.id', __METHOD__); -// $consumerConfig->set('debug', 'fetch'); + // $consumerConfig->set('debug', 'fetch'); $consumerConfig->set('bootstrap.servers', $cluster->getBootstraps()); $consumer = new KafkaConsumer($consumerConfig); $consumer->assign([new TopicPartition(KAFKA_TEST_TOPIC, 0, rd_kafka_offset_tail(1))]); @@ -357,7 +357,7 @@ public function testPushRequestErrorsArray(): void $consumerConfig = new Conf(); $consumerConfig->set('log_level', (string) LOG_EMERG); $consumerConfig->set('group.id', __METHOD__); -// $consumerConfig->set('debug', 'fetch'); + // $consumerConfig->set('debug', 'fetch'); $consumerConfig->set('bootstrap.servers', $cluster->getBootstraps()); $consumer = new KafkaConsumer($consumerConfig); $consumer->assign([new TopicPartition(KAFKA_TEST_TOPIC, 0, rd_kafka_offset_tail(1))]); @@ -424,7 +424,7 @@ public function testPushBrokerRequestErrors(): void $consumerConfig = new Conf(); $consumerConfig->set('log_level', (string) LOG_EMERG); $consumerConfig->set('group.id', __METHOD__); -// $consumerConfig->set('debug', 'fetch'); + // $consumerConfig->set('debug', 'fetch'); $consumerConfig->set('bootstrap.servers', $cluster->getBootstraps()); $consumer = new KafkaConsumer($consumerConfig); $consumer->assign([new TopicPartition(KAFKA_TEST_TOPIC, 0, rd_kafka_offset_tail(1))]); @@ -469,7 +469,7 @@ public function testPushBrokerRequestErrorRtts(): void $consumerConfig = new Conf(); $consumerConfig->set('log_level', (string) LOG_EMERG); $consumerConfig->set('group.id', __METHOD__); -// $consumerConfig->set('debug', 'fetch'); + // $consumerConfig->set('debug', 'fetch'); $consumerConfig->set('bootstrap.servers', $cluster->getBootstraps()); $consumer = new KafkaConsumer($consumerConfig); $consumer->assign([new TopicPartition(KAFKA_TEST_TOPIC, 0, rd_kafka_offset_tail(1))]);