Skip to content

Commit 0d6312a

Browse files
since release 2.8.0 and #129 the argument $client has the wrong type and breaks the library
1 parent 4ec7c16 commit 0d6312a

8 files changed

Lines changed: 25 additions & 42 deletions

File tree

src/HetznerAPIClient.php

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace LKDev\HetznerCloud;
44

5-
use GuzzleHttp\Client;
65
use LKDev\HetznerCloud\Clients\GuzzleClient;
76
use LKDev\HetznerCloud\Models\Actions\Actions;
87
use LKDev\HetznerCloud\Models\Certificates\Certificates;
@@ -122,18 +121,12 @@ public function setBaseUrl(string $baseUrl): self
122121
return $this;
123122
}
124123

125-
/**
126-
* @return Client
127-
*/
128124
public function getHttpClient(): GuzzleClient
129125
{
130126
return $this->httpClient;
131127
}
132128

133-
/**
134-
* @return Client
135-
*/
136-
public function setHttpClient(Client $client): self
129+
public function setHttpClient(GuzzleClient $client): self
137130
{
138131
$this->httpClient = $client;
139132

src/Models/Model.php

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,13 @@
22

33
namespace LKDev\HetznerCloud\Models;
44

5-
use GuzzleHttp\Client;
65
use LKDev\HetznerCloud\Clients\GuzzleClient;
76
use LKDev\HetznerCloud\HetznerAPIClient;
87

98
abstract class Model
109
{
11-
/**
12-
* @var \GuzzleHttp\Client
13-
*/
14-
protected $httpClient;
10+
protected GuzzleClient $httpClient;
1511

16-
/**
17-
* Model constructor.
18-
*
19-
* @param Client $httpClient
20-
*/
2112
public function __construct(?GuzzleClient $httpClient = null)
2213
{
2314
$this->httpClient = $httpClient == null ? HetznerAPIClient::$instance->getHttpClient() : $httpClient;
@@ -35,9 +26,8 @@ public static function parse($input)
3526
/**
3627
* Replaces or sets the http client.
3728
*
38-
* @param Client $httpClient
3929
*/
40-
public function setHttpClient(?Client $httpClient = null)
30+
public function setHttpClient(?GuzzleClient $httpClient = null)
4131
{
4232
$this->httpClient = $httpClient;
4333
}

src/Models/Networks/Network.php

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

33
namespace LKDev\HetznerCloud\Models\Networks;
44

5-
use GuzzleHttp\Client;
5+
use LKDev\HetznerCloud\Clients\GuzzleClient;
66
use LKDev\HetznerCloud\APIResponse;
77
use LKDev\HetznerCloud\HetznerAPIClient;
88
use LKDev\HetznerCloud\Models\Actions\Action;
@@ -71,9 +71,9 @@ class Network extends Model implements Resource
7171
* Network constructor.
7272
*
7373
* @param int $id
74-
* @param Client|null $httpClient
74+
* @param GuzzleClient|null $httpClient
7575
*/
76-
public function __construct(int $id, ?Client $httpClient = null)
76+
public function __construct(int $id, ?GuzzleClient $httpClient = null)
7777
{
7878
$this->id = $id;
7979
parent::__construct($httpClient);

src/Models/Networks/Route.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace LKDev\HetznerCloud\Models\Networks;
44

5-
use GuzzleHttp\Client;
5+
use LKDev\HetznerCloud\Clients\GuzzleClient;
66
use LKDev\HetznerCloud\Models\Model;
77

88
/**
@@ -24,9 +24,9 @@ class Route extends Model
2424
*
2525
* @param string $destination
2626
* @param string $gateway
27-
* @param Client|null $client
27+
* @param GuzzleClient|null $client
2828
*/
29-
public function __construct(string $destination, string $gateway, ?Client $client = null)
29+
public function __construct(string $destination, string $gateway, ?GuzzleClient $client = null)
3030
{
3131
$this->destination = $destination;
3232
$this->gateway = $gateway;
@@ -35,10 +35,10 @@ public function __construct(string $destination, string $gateway, ?Client $clien
3535

3636
/**
3737
* @param $input
38-
* @param Client|null $client
38+
* @param GuzzleClient|null $client
3939
* @return array|Model
4040
*/
41-
public static function parse($input, ?Client $client = null)
41+
public static function parse($input, ?GuzzleClient $client = null)
4242
{
4343
return collect($input)->map(function ($route) use ($client) {
4444
return new self($route->destination, $route->gateway, $client);

src/Models/Networks/Subnet.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace LKDev\HetznerCloud\Models\Networks;
44

5-
use GuzzleHttp\Client;
5+
use LKDev\HetznerCloud\Clients\GuzzleClient;
66
use LKDev\HetznerCloud\Models\Model;
77

88
/**
@@ -36,9 +36,9 @@ class Subnet extends Model
3636
* @param string $ipRange
3737
* @param string $networkZone
3838
* @param string $gateway
39-
* @param Client|null $client
39+
* @param GuzzleClient|null $client
4040
*/
41-
public function __construct(string $type, string $ipRange, string $networkZone, ?string $gateway = null, ?Client $client = null)
41+
public function __construct(string $type, string $ipRange, string $networkZone, ?string $gateway = null, ?GuzzleClient $client = null)
4242
{
4343
$this->type = $type;
4444
$this->ipRange = $ipRange;
@@ -49,10 +49,10 @@ public function __construct(string $type, string $ipRange, string $networkZone,
4949

5050
/**
5151
* @param $input
52-
* @param Client|null $client
52+
* @param GuzzleClient|null $client
5353
* @return array|Model
5454
*/
55-
public static function parse($input, ?Client $client = null)
55+
public static function parse($input, ?GuzzleClient $client = null)
5656
{
5757
return collect($input)->map(function ($subnet) use ($client) {
5858
return new self($subnet->type, $subnet->ip_range, $subnet->network_zone, $subnet->gateway, $client);

src/Models/PlacementGroups/PlacementGroup.php

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

33
namespace LKDev\HetznerCloud\Models\PlacementGroups;
44

5-
use GuzzleHttp\Client;
5+
use LKDev\HetznerCloud\Clients\GuzzleClient;
66
use LKDev\HetznerCloud\APIResponse;
77
use LKDev\HetznerCloud\HetznerAPIClient;
88
use LKDev\HetznerCloud\Models\Actions\Action;
@@ -49,9 +49,9 @@ class PlacementGroup extends Model implements Resource
4949
* PlacementGroup constructor.
5050
*
5151
* @param int $id
52-
* @param Client|null $httpClient
52+
* @param GuzzleClient|null $httpClient
5353
*/
54-
public function __construct(int $id, ?Client $httpClient = null)
54+
public function __construct(int $id, ?GuzzleClient $httpClient = null)
5555
{
5656
$this->id = $id;
5757
parent::__construct($httpClient);

src/Models/Servers/Server.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
namespace LKDev\HetznerCloud\Models\Servers;
1111

12-
use GuzzleHttp\Client;
12+
use LKDev\HetznerCloud\Clients\GuzzleClient;
1313
use LKDev\HetznerCloud\APIResponse;
1414
use LKDev\HetznerCloud\HetznerAPIClient;
1515
use LKDev\HetznerCloud\Models\Actions\Action;
@@ -180,9 +180,9 @@ class Server extends Model implements Resource
180180

181181
/**
182182
* @param int $serverId
183-
* @param Client|null $httpClient
183+
* @param GuzzleClient|null $httpClient
184184
*/
185-
public function __construct(int $serverId, ?Client $httpClient = null)
185+
public function __construct(int $serverId, ?GuzzleClient $httpClient = null)
186186
{
187187
$this->id = $serverId;
188188
parent::__construct($httpClient);

src/Models/Volumes/Volume.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
namespace LKDev\HetznerCloud\Models\Volumes;
1111

12-
use GuzzleHttp\Client;
12+
use LKDev\HetznerCloud\Clients\GuzzleClient;
1313
use LKDev\HetznerCloud\APIResponse;
1414
use LKDev\HetznerCloud\HetznerAPIClient;
1515
use LKDev\HetznerCloud\Models\Actions\Action;
@@ -65,9 +65,9 @@ class Volume extends Model implements Resource
6565

6666
/**
6767
* @param int $volumeId
68-
* @param Client|null $httpClient
68+
* @param GuzzleClient|null $httpClient
6969
*/
70-
public function __construct(?int $volumeId = null, ?Client $httpClient = null)
70+
public function __construct(?int $volumeId = null, ?GuzzleClient $httpClient = null)
7171
{
7272
$this->id = $volumeId;
7373
parent::__construct($httpClient);

0 commit comments

Comments
 (0)