Skip to content

Commit

Permalink
Update symplify/easy-coding-standard and fix cs
Browse files Browse the repository at this point in the history
  • Loading branch information
dirx committed Dec 23, 2023
1 parent 648960c commit 34b4226
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 24 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
16 changes: 8 additions & 8 deletions examples/offset-lags.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -92,7 +92,7 @@ function ($consumer, $level, $fac, $buf): void {
if (count($eofs) === 50) {
break;
}
// var_export($eofs);
// var_export($eofs);
continue;
}

Expand All @@ -117,23 +117,23 @@ 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:
case MessageKeyParser::V1_OFFSET_COMMIT_KEY:
$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) {
Expand Down
1 change: 0 additions & 1 deletion src/RdKafka/Admin/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ private function __construct(RdKafka $kafka)
}

/**
* @return Client
* @throws Exception
*/
public static function fromConf(Conf $conf): self
Expand Down
1 change: 0 additions & 1 deletion src/RdKafka/ConsumerTopic.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 0 additions & 4 deletions src/RdKafka/ProducerTopic.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
class ProducerTopic extends Topic
{
/**
* @param TopicConf $conf
* @throws Exception
*/
public function __construct(Producer $producer, string $name, ?TopicConf $conf = null)
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions tests/ConstantsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
Expand Down
2 changes: 1 addition & 1 deletion tests/RdKafka/ConsumerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
);

Expand Down
10 changes: 5 additions & 5 deletions tests/RdKafka/Test/MockClusterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
);
Expand Down Expand Up @@ -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))]);
Expand Down Expand Up @@ -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))]);
Expand Down Expand Up @@ -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))]);
Expand Down Expand Up @@ -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))]);
Expand Down

0 comments on commit 34b4226

Please sign in to comment.