Skip to content

Commit

Permalink
update return types of hooked curl functions/methods
Browse files Browse the repository at this point in the history
  • Loading branch information
deminy committed Feb 17, 2024
1 parent 2027cb8 commit 3f62e91
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/core/Curl/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
8 changes: 4 additions & 4 deletions src/ext/curl.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand All @@ -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)
Expand Down

0 comments on commit 3f62e91

Please sign in to comment.