This repository was archived by the owner on Oct 27, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +25
-4
lines changed
Expand file tree Collapse file tree 2 files changed +25
-4
lines changed Original file line number Diff line number Diff line change 77/**
88 * @param int $err Error code
99 *
10- * @return string Returns the error as a string.
10+ * @return string The error name as a string.
11+ */
12+ function rd_kafka_err2name (int $ err ): string
13+ {
14+ return Library::rd_kafka_err2name ($ err );
15+ }
16+
17+ /**
18+ * @param int $err Error code
19+ *
20+ * @return string The error description a string.
1121 */
1222function rd_kafka_err2str (int $ err ): string
1323{
@@ -17,7 +27,7 @@ function rd_kafka_err2str(int $err): string
1727/**
1828 * @param int $errnox A system errno
1929 *
20- * @return int Returns a kafka error code as an integer.
30+ * @return int A kafka error code as an integer.
2131 * @deprecated
2232 */
2333function rd_kafka_errno2err (int $ errnox ): int
@@ -26,7 +36,7 @@ function rd_kafka_errno2err(int $errnox): int
2636}
2737
2838/**
29- * @return int Returns the system errno as an integer.
39+ * @return int The system errno as an integer.
3040 * @deprecated
3141 */
3242function rd_kafka_errno (): int
@@ -51,7 +61,7 @@ function rd_kafka_thread_cnt(): int
5161}
5262
5363/**
54- * @return string Returns librdkafka version.
64+ * @return string The librdkafka version.
5565 */
5666function rd_kafka_version (): string
5767{
Original file line number Diff line number Diff line change 1515 */
1616class FunctionsTest extends TestCase
1717{
18+ use RequireVersionTrait;
19+
20+ public function testErr2name (): void
21+ {
22+ $ this ->assertSame ('NO_ERROR ' , rd_kafka_err2name (RD_KAFKA_RESP_ERR_NO_ERROR ));
23+ }
24+
1825 public function testErr2str (): void
1926 {
2027 $ this ->assertSame ('Success ' , rd_kafka_err2str (RD_KAFKA_RESP_ERR_NO_ERROR ));
2128 }
2229
2330 public function testErrno2err (): void
2431 {
32+ $ this ->requiresRdKafkaExtensionVersion ('< ' , '5 ' );
33+
2534 $ this ->assertSame (RD_KAFKA_RESP_ERR__FAIL , rd_kafka_errno2err (999 ));
2635 }
2736
2837 public function testErrno (): void
2938 {
39+ $ this ->requiresRdKafkaExtensionVersion ('< ' , '5 ' );
40+
3041 $ this ->assertSame (0 , rd_kafka_errno ());
3142 }
3243
You can’t perform that action at this time.
0 commit comments