Skip to content

Commit ab63197

Browse files
DanielWiedemann248LKaemmerling
authored andcommitted
Fix Boolean Properties Getting Parsed As Null
Due to how the ternary operator works, the statements I changed were incorrectly processed. Checking for an existing property with `??` rfixes this
1 parent bd1827e commit ab63197

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/Models/Servers/Server.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -93,18 +93,18 @@ class Server extends Model implements Resource
9393
public $iso;
9494

9595
/**
96-
* @var bool
96+
* @var ?bool
9797
*/
9898
public $rescue_enabled;
9999
/**
100-
* @var bool
100+
* @var ?bool
101101
*
102102
* @deprecated Use $rescue_enabled instead
103103
*/
104104
public $rescueEnabled;
105105

106106
/**
107-
* @var bool
107+
* @var ?bool
108108
*/
109109
public $locked;
110110

@@ -206,9 +206,9 @@ public function setAdditionalData($data)
206206
$this->created = $data->created;
207207
$this->image = $data->image ?: Image::parse($data->image);
208208
$this->iso = $data->iso ?: ISO::parse($data->iso);
209-
$this->rescue_enabled = $data->rescue_enabled ?: null;
210-
$this->rescueEnabled = $data->rescue_enabled ?: null;
211-
$this->locked = $data->locked ?: null;
209+
$this->rescue_enabled = $data->rescue_enabled ?? null;
210+
$this->rescueEnabled = $data->rescue_enabled ?? null;
211+
$this->locked = $data->locked ?? null;
212212
$this->backup_window = $data->backup_window ?: null;
213213
$this->backupWindow = $data->backup_window ?: null;
214214
$this->outgoing_traffic = $data->outgoing_traffic ?: null;

0 commit comments

Comments
 (0)