File tree Expand file tree Collapse file tree 11 files changed +15
-20
lines changed Expand file tree Collapse file tree 11 files changed +15
-20
lines changed Original file line number Diff line number Diff line change 22
33## master
44* Make package requirements less strict
5+ * Bugfix: getByName functions had a wrong return type and failed when a resource was not found by name [ #50 ] ( https://github.com/LKDevelopment/hetzner-cloud-php-sdk/issues/50 )
56
67## 2.2.0 (22.06.2020)
78* Feature: Allow specifying labels on ` createImage `
Original file line number Diff line number Diff line change @@ -93,7 +93,7 @@ public function getById(int $datacenterId): Datacenter
9393 * @return \LKDev\HetznerCloud\Models\Datacenters\Datacenter
9494 * @throws \LKDev\HetznerCloud\APIException
9595 */
96- public function getByName (string $ name ): Datacenter
96+ public function getByName (string $ name ): ? Datacenter
9797 {
9898 $ resp = $ this ->list (new DatacenterRequestOpts ($ name ));
9999
Original file line number Diff line number Diff line change @@ -91,7 +91,7 @@ public function getById(int $floatingIpId): FloatingIp
9191 * @return \LKDev\HetznerCloud\Models\FloatingIps\FloatingIp
9292 * @throws \LKDev\HetznerCloud\APIException
9393 */
94- public function getByName (string $ name )
94+ public function getByName (string $ name ): ? FloatingIp
9595 {
9696 $ resp = $ this ->list (new FloatingIPRequestOpts ($ name ));
9797
Original file line number Diff line number Diff line change @@ -89,7 +89,7 @@ public function getById(int $isoId): ISO
8989 * @return \LKDev\HetznerCloud\Models\ISOs\ISO
9090 * @throws \LKDev\HetznerCloud\APIException
9191 */
92- public function getByName (string $ name ): ISO
92+ public function getByName (string $ name ): ? ISO
9393 {
9494 $ isos = $ this ->list (new ISORequestOpts ($ name ));
9595
Original file line number Diff line number Diff line change 11<?php
2- /**
3- * Created by PhpStorm.
4- * User: lukaskammerling
5- * Date: 28.01.18
6- * Time: 21:01.
7- */
82
93namespace LKDev \HetznerCloud \Models \Images ;
104
@@ -79,14 +73,14 @@ public function getById(int $imageId): Image
7973 }
8074
8175 /**
82- * Returns a specific datacenter object by its name.
76+ * Returns a specific image object by its name.
8377 *
84- * @see https://docs.hetzner.cloud/#resources-datacenters -get-1
85- * @param int $datacenterId
86- * @return \LKDev\HetznerCloud\Models\Datacenters\Datacenter
78+ * @see https://docs.hetzner.cloud/#resources-images -get-1
79+ * @param string $name
80+ * @return \LKDev\HetznerCloud\Models\Images\Image|null
8781 * @throws \LKDev\HetznerCloud\APIException
8882 */
89- public function getByName (string $ name ): Image
83+ public function getByName (string $ name ): ? Image
9084 {
9185 $ images = $ this ->list (new ImageRequestOpts ($ name ));
9286
Original file line number Diff line number Diff line change @@ -89,7 +89,7 @@ public function getById(int $locationId): Location
8989 * @return \LKDev\HetznerCloud\Models\Locations\Location
9090 * @throws \LKDev\HetznerCloud\APIException
9191 */
92- public function getByName (string $ name ): Location
92+ public function getByName (string $ name ): ? Location
9393 {
9494 $ locations = $ this ->list (new LocationRequestOpts ($ name ));
9595
Original file line number Diff line number Diff line change @@ -86,7 +86,7 @@ public function getById(int $serverId): Network
8686 * @return Network|null
8787 * @throws \LKDev\HetznerCloud\APIException
8888 */
89- public function getByName (string $ name )
89+ public function getByName (string $ name ): ? Network
9090 {
9191 $ networks = $ this ->list (new NetworkRequestOpts ($ name ));
9292
Original file line number Diff line number Diff line change @@ -135,7 +135,7 @@ public function getById(int $id)
135135 * @return \LKDev\HetznerCloud\Models\SSHKeys\SSHKey
136136 * @throws \LKDev\HetznerCloud\APIException
137137 */
138- public function getByName (string $ name )
138+ public function getByName (string $ name ): ? SSHKey
139139 {
140140 $ sshKeys = $ this ->list (new SSHKeyRequestOpts ($ name ));
141141
Original file line number Diff line number Diff line change @@ -77,7 +77,7 @@ public function list(RequestOpts $requestOpts = null): APIResponse
7777 * @return \LKDev\HetznerCloud\Models\Servers\Server|null
7878 * @throws \LKDev\HetznerCloud\APIException
7979 */
80- public function getByName (string $ serverName )
80+ public function getByName (string $ serverName ): ? Server
8181 {
8282 $ servers = $ this ->list (new ServerRequestOpts ($ serverName ));
8383
Original file line number Diff line number Diff line change @@ -79,7 +79,7 @@ public function getById(int $serverTypeId)
7979 * @return \LKDev\HetznerCloud\Models\Servers\Types\ServerType
8080 * @throws \LKDev\HetznerCloud\APIException
8181 */
82- public function getByName (string $ name )
82+ public function getByName (string $ name ): ? ServerType
8383 {
8484 $ serverTypes = $ this ->list (new ServerTypesRequestOpts ($ name ));
8585
You can’t perform that action at this time.
0 commit comments