- Added some more type checking

This commit is contained in:
Dave Mc Nicoll committed 2023-11-01 11:29:08 -04:00
1 parent 951c93fc63
commit 4484f1c997
6 files changed
+16 -10

No files matched your search

+5 -3
View File
@@ -10,7 +10,7 @@ class Curl implements TransportInterface {
public $headers = [];
public function push(string $url, array $data) : ? object
public function push(string $url, array $data) : object|null|bool
{
$ch = curl_init();
@@ -22,7 +22,9 @@ class Curl implements TransportInterface {
curl_setopt($ch, CURLOPT_TIMEOUT_MS, $this->timeout * 200);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
if ( ( false === curl_exec($ch) ) && $this->throwErrors ) {
$exec = curl_exec($ch);
if ( ( false === $exec ) && $this->throwErrors ) {
$errno = curl_errno($ch);
$errors = array_filter([ curl_error($ch) , static::CURL_ERROR[$errno] ?? null ]);
@@ -31,7 +33,7 @@ class Curl implements TransportInterface {
curl_close($ch);
return null;
return $exec;
}
const CURL_ERROR = [