Skip to content

Commit 8848c3c

Browse files
committed
Fix Invalid argument errors introduced with 2.8.0
Superseeds #136
1 parent f0b2c33 commit 8848c3c

File tree

8 files changed

+33
-26
lines changed

8 files changed

+33
-26
lines changed

src/HetznerAPIClient.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class HetznerAPIClient
6060
/**
6161
* @var \LKDev\HetznerCloud\Clients\GuzzleClient
6262
*/
63-
protected $httpClient;
63+
protected GuzzleClient $httpClient;
6464

6565
/**
6666
* @param string $apiToken
@@ -123,17 +123,17 @@ public function setBaseUrl(string $baseUrl): self
123123
}
124124

125125
/**
126-
* @return Client
126+
* @return GuzzleClient
127127
*/
128-
public function getHttpClient(): Client
128+
public function getHttpClient(): GuzzleClient
129129
{
130130
return $this->httpClient;
131131
}
132132

133133
/**
134-
* @return Client
134+
* @return GuzzleClient
135135
*/
136-
public function setHttpClient(Client $client): self
136+
public function setHttpClient(GuzzleClient $client): self
137137
{
138138
$this->httpClient = $client;
139139

src/Models/Model.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,22 @@
33
namespace LKDev\HetznerCloud\Models;
44

55
use GuzzleHttp\Client;
6+
use LKDev\HetznerCloud\Clients\GuzzleClient;
67
use LKDev\HetznerCloud\HetznerAPIClient;
78

89
abstract class Model
910
{
1011
/**
11-
* @var \GuzzleHttp\Client
12+
* @var GuzzleClient
1213
*/
1314
protected $httpClient;
1415

1516
/**
1617
* Model constructor.
1718
*
18-
* @param Client $httpClient
19+
* @param GuzzleClient $httpClient
1920
*/
20-
public function __construct(?Client $httpClient = null)
21+
public function __construct(?GuzzleClient $httpClient = null)
2122
{
2223
$this->httpClient = $httpClient == null ? HetznerAPIClient::$instance->getHttpClient() : $httpClient;
2324
}
@@ -34,9 +35,9 @@ public static function parse($input)
3435
/**
3536
* Replaces or sets the http client.
3637
*
37-
* @param Client $httpClient
38+
* @param GuzzleClient $httpClient
3839
*/
39-
public function setHttpClient(?Client $httpClient = null)
40+
public function setHttpClient(?GuzzleClient $httpClient = null)
4041
{
4142
$this->httpClient = $httpClient;
4243
}

src/Models/Networks/Network.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use GuzzleHttp\Client;
66
use LKDev\HetznerCloud\APIResponse;
7+
use LKDev\HetznerCloud\Clients\GuzzleClient;
78
use LKDev\HetznerCloud\HetznerAPIClient;
89
use LKDev\HetznerCloud\Models\Actions\Action;
910
use LKDev\HetznerCloud\Models\Contracts\Resource;
@@ -71,9 +72,9 @@ class Network extends Model implements Resource
7172
* Network constructor.
7273
*
7374
* @param int $id
74-
* @param Client|null $httpClient
75+
* @param GuzzleClient|null $httpClient
7576
*/
76-
public function __construct(int $id, ?Client $httpClient = null)
77+
public function __construct(int $id, ?GuzzleClient $httpClient = null)
7778
{
7879
$this->id = $id;
7980
parent::__construct($httpClient);

src/Models/Networks/Route.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace LKDev\HetznerCloud\Models\Networks;
44

55
use GuzzleHttp\Client;
6+
use LKDev\HetznerCloud\Clients\GuzzleClient;
67
use LKDev\HetznerCloud\Models\Model;
78

89
/**
@@ -24,9 +25,9 @@ class Route extends Model
2425
*
2526
* @param string $destination
2627
* @param string $gateway
27-
* @param Client|null $client
28+
* @param GuzzleClient|null $client
2829
*/
29-
public function __construct(string $destination, string $gateway, ?Client $client = null)
30+
public function __construct(string $destination, string $gateway, ?GuzzleClient $client = null)
3031
{
3132
$this->destination = $destination;
3233
$this->gateway = $gateway;
@@ -35,10 +36,10 @@ public function __construct(string $destination, string $gateway, ?Client $clien
3536

3637
/**
3738
* @param $input
38-
* @param Client|null $client
39+
* @param GuzzleClient|null $client
3940
* @return array|Model
4041
*/
41-
public static function parse($input, ?Client $client = null)
42+
public static function parse($input, ?GuzzleClient $client = null)
4243
{
4344
return collect($input)->map(function ($route) use ($client) {
4445
return new self($route->destination, $route->gateway, $client);

src/Models/Networks/Subnet.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace LKDev\HetznerCloud\Models\Networks;
44

55
use GuzzleHttp\Client;
6+
use LKDev\HetznerCloud\Clients\GuzzleClient;
67
use LKDev\HetznerCloud\Models\Model;
78

89
/**
@@ -36,9 +37,9 @@ class Subnet extends Model
3637
* @param string $ipRange
3738
* @param string $networkZone
3839
* @param string $gateway
39-
* @param Client|null $client
40+
* @param GuzzleClient|null $client
4041
*/
41-
public function __construct(string $type, string $ipRange, string $networkZone, ?string $gateway = null, ?Client $client = null)
42+
public function __construct(string $type, string $ipRange, string $networkZone, ?string $gateway = null, ?GuzzleClient $client = null)
4243
{
4344
$this->type = $type;
4445
$this->ipRange = $ipRange;
@@ -49,10 +50,10 @@ public function __construct(string $type, string $ipRange, string $networkZone,
4950

5051
/**
5152
* @param $input
52-
* @param Client|null $client
53+
* @param GuzzleClient|null $client
5354
* @return array|Model
5455
*/
55-
public static function parse($input, ?Client $client = null)
56+
public static function parse($input, ?GuzzleClient $client = null)
5657
{
5758
return collect($input)->map(function ($subnet) use ($client) {
5859
return new self($subnet->type, $subnet->ip_range, $subnet->network_zone, $subnet->gateway, $client);

src/Models/PlacementGroups/PlacementGroup.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use GuzzleHttp\Client;
66
use LKDev\HetznerCloud\APIResponse;
7+
use LKDev\HetznerCloud\Clients\GuzzleClient;
78
use LKDev\HetznerCloud\HetznerAPIClient;
89
use LKDev\HetznerCloud\Models\Actions\Action;
910
use LKDev\HetznerCloud\Models\Contracts\Resource;
@@ -49,9 +50,9 @@ class PlacementGroup extends Model implements Resource
4950
* PlacementGroup constructor.
5051
*
5152
* @param int $id
52-
* @param Client|null $httpClient
53+
* @param GuzzleClient|null $httpClient
5354
*/
54-
public function __construct(int $id, ?Client $httpClient = null)
55+
public function __construct(int $id, ?GuzzleClient $httpClient = null)
5556
{
5657
$this->id = $id;
5758
parent::__construct($httpClient);

src/Models/Servers/Server.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
use GuzzleHttp\Client;
1313
use LKDev\HetznerCloud\APIResponse;
14+
use LKDev\HetznerCloud\Clients\GuzzleClient;
1415
use LKDev\HetznerCloud\HetznerAPIClient;
1516
use LKDev\HetznerCloud\Models\Actions\Action;
1617
use LKDev\HetznerCloud\Models\Contracts\Resource;
@@ -180,9 +181,9 @@ class Server extends Model implements Resource
180181

181182
/**
182183
* @param int $serverId
183-
* @param Client|null $httpClient
184+
* @param GuzzleClient|null $httpClient
184185
*/
185-
public function __construct(int $serverId, ?Client $httpClient = null)
186+
public function __construct(int $serverId, ?GuzzleClient $httpClient = null)
186187
{
187188
$this->id = $serverId;
188189
parent::__construct($httpClient);

src/Models/Volumes/Volume.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
use GuzzleHttp\Client;
1313
use LKDev\HetznerCloud\APIResponse;
14+
use LKDev\HetznerCloud\Clients\GuzzleClient;
1415
use LKDev\HetznerCloud\HetznerAPIClient;
1516
use LKDev\HetznerCloud\Models\Actions\Action;
1617
use LKDev\HetznerCloud\Models\Contracts\Resource;
@@ -65,9 +66,9 @@ class Volume extends Model implements Resource
6566

6667
/**
6768
* @param int $volumeId
68-
* @param Client|null $httpClient
69+
* @param GuzzleClient|null $httpClient
6970
*/
70-
public function __construct(?int $volumeId = null, ?Client $httpClient = null)
71+
public function __construct(?int $volumeId = null, ?GuzzleClient $httpClient = null)
7172
{
7273
$this->id = $volumeId;
7374
parent::__construct($httpClient);

0 commit comments

Comments
 (0)