Skip to content

Commit 930c002

Browse files
Update curl usage and psalm configuration
1 parent 9eeaa03 commit 930c002

2 files changed

Lines changed: 8 additions & 6 deletions

File tree

psalm.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
resolveFromConfigFile="true"
55
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
66
xmlns="https://getpsalm.org/schema/config"
7-
phpVersion="7.4"
7+
phpVersion="8.0"
88
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
99
errorBaseline="psalm-baseline.xml"
1010
>

src/API.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,9 @@ class API {
139139
/**
140140
* cURL resource
141141
*
142-
* @var CurlHandle|resource|false|null
142+
* @var CurlHandle|null
143143
*/
144-
protected $resource;
144+
protected CurlHandle|null $resource = null;
145145

146146
/**
147147
* Information about last client request
@@ -247,7 +247,7 @@ public function __destruct() {
247247
* @return bool
248248
*/
249249
public function isConnected(): bool {
250-
return is_resource($this->resource) || $this->resource instanceof CurlHandle;
250+
return $this->resource instanceof CurlHandle;
251251
}
252252

253253
/**
@@ -346,12 +346,14 @@ protected function setCURLOptions(): self {
346346
* @throws RuntimeException on error
347347
*/
348348
public function connect(): self {
349-
$this->resource = curl_init();
349+
$curl = curl_init();
350350

351-
if (!$this->resource) {
351+
if (!$curl instanceof CurlHandle) {
352352
throw new RuntimeException('Unable to initiate cURL session');
353353
}
354354

355+
$this->resource = $curl;
356+
355357
return $this;
356358
}
357359

0 commit comments

Comments
 (0)