@@ -127,29 +127,31 @@ public function __construct(
127127 *
128128 * @see https://docs.hetzner.cloud/#resources-floating-ips-put
129129 * @param string $description
130- * @return static
130+ * @return static|null
131131 * @throws \LKDev\HetznerCloud\APIException
132132 */
133- public function update (array $ data ): self
133+ public function update (array $ data ): ? self
134134 {
135135 $ response = $ this ->httpClient ->put ('floating_ips/ ' .$ this ->id , [
136136 'json ' => $ data ,
137137 ]);
138138 if (! HetznerAPIClient::hasError ($ response )) {
139139 return self ::parse (json_decode ((string ) $ response ->getBody ())->floating_ip );
140140 }
141+
142+ return null ;
141143 }
142144
143145 /**
144146 * Changes the description of a Floating IP.
145147 *
146148 * @see https://docs.hetzner.cloud/#resources-floating-ips-put
147149 * @param string $description
148- * @return static
150+ * @return static|null
149151 * @throws \LKDev\HetznerCloud\APIException
150152 * @deprecated 1.2.0
151153 */
152- public function changeDescription (string $ description ): self
154+ public function changeDescription (string $ description ): ? self
153155 {
154156 return $ this ->update (['description ' => $ description ]);
155157 }
@@ -167,17 +169,19 @@ public function delete(): bool
167169 if (! HetznerAPIClient::hasError ($ response )) {
168170 return true ;
169171 }
172+
173+ return false ;
170174 }
171175
172176 /**
173177 * Changes the protection configuration of the Floating IP.
174178 *
175179 * @see https://docs.hetzner.cloud/#resources-floating-ip-actions-post-3
176180 * @param bool $delete
177- * @return APIResponse
181+ * @return APIResponse|null
178182 * @throws \LKDev\HetznerCloud\APIException
179183 */
180- public function changeProtection (bool $ delete = true ): APIResponse
184+ public function changeProtection (bool $ delete = true ): ? APIResponse
181185 {
182186 $ response = $ this ->httpClient ->post ('floating_ips/ ' .$ this ->id .'/actions/change_protection ' , [
183187 'json ' => [
@@ -189,17 +193,19 @@ public function changeProtection(bool $delete = true): APIResponse
189193 'action ' => Action::parse (json_decode ((string ) $ response ->getBody ())->action ),
190194 ], $ response ->getHeaders ());
191195 }
196+
197+ return null ;
192198 }
193199
194200 /**
195201 * Assigns a Floating IP to a server.
196202 *
197203 * @see https://docs.hetzner.cloud/#floating-ip-actions-assign-a-floating-ip-to-a-server
198204 * @param Server $server
199- * @return APIResponse
205+ * @return APIResponse|null
200206 * @throws \LKDev\HetznerCloud\APIException
201207 */
202- public function assignTo (Server $ server ): APIResponse
208+ public function assignTo (Server $ server ): ? APIResponse
203209 {
204210 $ response = $ this ->httpClient ->post ('floating_ips/ ' .$ this ->id .'/actions/assign ' , [
205211 'json ' => [
@@ -211,23 +217,27 @@ public function assignTo(Server $server): APIResponse
211217 'action ' => Action::parse (json_decode ((string ) $ response ->getBody ())->action ),
212218 ], $ response ->getHeaders ());
213219 }
220+
221+ return null ;
214222 }
215223
216224 /**
217225 * Unassigns a Floating IP, resulting in it being unreachable. You may assign it to a server again at a later time.
218226 *
219227 * @see https://docs.hetzner.cloud/#floating-ip-actions-unassign-a-floating-ip
220- * @return APIResponse
228+ * @return APIResponse|null
221229 * @throws \LKDev\HetznerCloud\APIException
222230 */
223- public function unassign (): APIResponse
231+ public function unassign (): ? APIResponse
224232 {
225233 $ response = $ this ->httpClient ->post ('floating_ips/ ' .$ this ->id .'/actions/unassign ' );
226234 if (! HetznerAPIClient::hasError ($ response )) {
227235 return APIResponse::create ([
228236 'action ' => Action::parse (json_decode ((string ) $ response ->getBody ())->action ),
229237 ], $ response ->getHeaders ());
230238 }
239+
240+ return null ;
231241 }
232242
233243 /**
@@ -236,10 +246,10 @@ public function unassign(): APIResponse
236246 * @see https://docs.hetzner.cloud/#floating-ip-actions-change-reverse-dns-entry-for-a-floating-ip
237247 * @param string $ip
238248 * @param string $dnsPtr
239- * @return APIResponse
249+ * @return APIResponse|null
240250 * @throws \LKDev\HetznerCloud\APIException
241251 */
242- public function changeReverseDNS (string $ ip , string $ dnsPtr ): APIResponse
252+ public function changeReverseDNS (string $ ip , string $ dnsPtr ): ? APIResponse
243253 {
244254 $ response = $ this ->httpClient ->post ('floating_ips/ ' .$ this ->id .'/actions/change_dns_ptr ' , [
245255 'json ' => [
@@ -252,13 +262,15 @@ public function changeReverseDNS(string $ip, string $dnsPtr): APIResponse
252262 'action ' => Action::parse (json_decode ((string ) $ response ->getBody ())->action ),
253263 ], $ response ->getHeaders ());
254264 }
265+
266+ return null ;
255267 }
256268
257269 /**
258270 * @param $input
259271 * @return \LKDev\HetznerCloud\Models\FloatingIps\FloatingIp|static|null
260272 */
261- public static function parse ($ input ): self
273+ public static function parse ($ input ): ? self
262274 {
263275 if ($ input == null ) {
264276 return null ;
0 commit comments