From 3f62e9186095e85a244b9557362bddf6d9eff6ac Mon Sep 17 00:00:00 2001 From: Demin Yin Date: Fri, 16 Feb 2024 16:28:11 -0800 Subject: [PATCH] update return types of hooked curl functions/methods --- src/core/Curl/Handler.php | 8 ++++---- src/ext/curl.php | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/core/Curl/Handler.php b/src/core/Curl/Handler.php index 5f68bc9..858342a 100644 --- a/src/core/Curl/Handler.php +++ b/src/core/Curl/Handler.php @@ -176,14 +176,14 @@ public function getInfo() return $this->isAvailable() ? $this->info : false; } - public function errno() + public function errno(): int { - return $this->isAvailable() ? $this->errCode : false; + return $this->isAvailable() ? $this->errCode : 0; } - public function error() + public function error(): string { - return $this->isAvailable() ? $this->errMsg : false; + return $this->isAvailable() ? $this->errMsg : ''; } public function reset() diff --git a/src/ext/curl.php b/src/ext/curl.php index afeb990..e1f2eef 100644 --- a/src/ext/curl.php +++ b/src/ext/curl.php @@ -60,12 +60,12 @@ function swoole_curl_getinfo(Swoole\Curl\Handler $obj, int $opt = 0) return $info; } -function swoole_curl_errno(Swoole\Curl\Handler $obj) +function swoole_curl_errno(Swoole\Curl\Handler $obj): int { return $obj->errno(); } -function swoole_curl_error(Swoole\Curl\Handler $obj) +function swoole_curl_error(Swoole\Curl\Handler $obj): string { return $obj->error(); } @@ -75,9 +75,9 @@ function swoole_curl_reset(Swoole\Curl\Handler $obj) return $obj->reset(); } -function swoole_curl_close(Swoole\Curl\Handler $obj) +function swoole_curl_close(Swoole\Curl\Handler $obj): void { - return $obj->close(); + $obj->close(); } function swoole_curl_multi_getcontent(Swoole\Curl\Handler $obj)