Skip to content

Commit d132dc8

Browse files
authored
Fix RdKafka\KafkaConsumer::getMetadata() signature (#522)
Fixes #521
1 parent 9fd125f commit d132dc8

File tree

4 files changed

+25
-4
lines changed

4 files changed

+25
-4
lines changed

kafka_consumer.stub.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public function getSubscription(): array {}
4646
public function unsubscribe(): void {}
4747

4848
/** @tentative-return-type */
49-
public function getMetadata(bool $all_topics, Topic $only_topic, int $timeout_ms): Metadata {}
49+
public function getMetadata(bool $all_topics, ?Topic $only_topic, int $timeout_ms): Metadata {}
5050

5151
/** @tentative-return-type */
5252
public function newTopic(string $topic_name, ?TopicConf $topic_conf = null): KafkaConsumerTopic {}

kafka_consumer_arginfo.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: aee362c9762bd72d620b36f1e5686d96e09b9cac */
2+
* Stub hash: 47e9238c79f5508833423d31a2e09041754dbffb */
33

44
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_KafkaConsumer___construct, 0, 0, 1)
55
ZEND_ARG_OBJ_INFO(0, conf, RdKafka\\Conf, 0)
@@ -35,7 +35,7 @@ ZEND_END_ARG_INFO()
3535

3636
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_OBJ_INFO_EX(arginfo_class_RdKafka_KafkaConsumer_getMetadata, 0, 3, RdKafka\\Metadata, 0)
3737
ZEND_ARG_TYPE_INFO(0, all_topics, _IS_BOOL, 0)
38-
ZEND_ARG_OBJ_INFO(0, only_topic, RdKafka\\Topic, 0)
38+
ZEND_ARG_OBJ_INFO(0, only_topic, RdKafka\\Topic, 1)
3939
ZEND_ARG_TYPE_INFO(0, timeout_ms, IS_LONG, 0)
4040
ZEND_END_ARG_INFO()
4141

kafka_consumer_legacy_arginfo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: aee362c9762bd72d620b36f1e5686d96e09b9cac */
2+
* Stub hash: 47e9238c79f5508833423d31a2e09041754dbffb */
33

44
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RdKafka_KafkaConsumer___construct, 0, 0, 1)
55
ZEND_ARG_INFO(0, conf)

tests/bug521.phpt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
--TEST--
2+
Bug #521
3+
--SKIPIF--
4+
<?php version_compare(PHP_VERSION, "8.1") < 0 && die("skip PHP < 8.1"); ?>
5+
--FILE--
6+
<?php
7+
8+
$reflection = new ReflectionMethod(RdKafka\KafkaConsumer::class, 'getMetadata');
9+
10+
foreach ($reflection->getParameters() as $reflectionParam) {
11+
printf(
12+
"%s%s%s\n",
13+
(string) $reflectionParam->getType(),
14+
$reflectionParam->getType() !== null ? ' ' : '',
15+
$reflectionParam->getName(),
16+
);
17+
}
18+
--EXPECT--
19+
bool all_topics
20+
?RdKafka\Topic only_topic
21+
int timeout_ms

0 commit comments

Comments
 (0)