mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-29 00:34:05 +02:00
RestApiClient: Remove curl's return type hint and wrong curl_error() param
Php >= 8 returns CurlHandle instead of resource, which confuses phpstan.
This commit is contained in:
parent
cc3bfd5437
commit
2acfdecb8d
@ -206,14 +206,14 @@ class RestApiClient
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return resource
|
* @throws RuntimeException
|
||||||
*/
|
*/
|
||||||
protected function curl()
|
protected function curl()
|
||||||
{
|
{
|
||||||
if ($this->curl === null) {
|
if ($this->curl === null) {
|
||||||
$this->curl = curl_init(sprintf('https://%s:%d', $this->peer, $this->port));
|
$this->curl = curl_init(sprintf('https://%s:%d', $this->peer, $this->port));
|
||||||
if (! $this->curl) {
|
if (! $this->curl) {
|
||||||
throw new RuntimeException('CURL INIT ERROR: ' . curl_error($this->curl));
|
throw new RuntimeException('CURL INIT FAILED');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -260,13 +260,11 @@ class RestApiClient
|
|||||||
|
|
||||||
public function disconnect()
|
public function disconnect()
|
||||||
{
|
{
|
||||||
if ($this->curl !== null) {
|
if ($this->curl) {
|
||||||
if (is_resource($this->curl)) {
|
@curl_close($this->curl);
|
||||||
@curl_close($this->curl);
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->curl = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->curl = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function __destruct()
|
public function __destruct()
|
||||||
|
@ -8,7 +8,6 @@ use RuntimeException;
|
|||||||
|
|
||||||
class RestApiClient
|
class RestApiClient
|
||||||
{
|
{
|
||||||
/** @var resource */
|
|
||||||
private $curl;
|
private $curl;
|
||||||
|
|
||||||
/** @var string HTTP or HTTPS */
|
/** @var string HTTP or HTTPS */
|
||||||
@ -295,14 +294,14 @@ class RestApiClient
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return resource
|
* @throws RuntimeException
|
||||||
*/
|
*/
|
||||||
protected function curl()
|
protected function curl()
|
||||||
{
|
{
|
||||||
if ($this->curl === null) {
|
if ($this->curl === null) {
|
||||||
$this->curl = \curl_init(\sprintf('https://%s:%d', $this->host, $this->port));
|
$this->curl = curl_init(sprintf('https://%s:%d', $this->host, $this->port));
|
||||||
if (! $this->curl) {
|
if (! $this->curl) {
|
||||||
throw new RuntimeException('CURL INIT ERROR: ' . \curl_error($this->curl));
|
throw new RuntimeException('CURL INIT FAILED');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user