Skip to content

Commit

Permalink
Use isset to check value
Browse files Browse the repository at this point in the history
  • Loading branch information
juniwalk authored Feb 21, 2024
1 parent 52b52c0 commit 4755371
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Controls/CheckboxListEnum.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function setValue(/*?LabeledEnum*/ $values): self
}

$values = Arrays::map($values, function(mixed $value) {
if ($value && !$value instanceof $this->enumType) {
if (isset($value) && !$value instanceof $this->enumType) {
$value = $this->enumType::make($value);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Controls/RadioListEnum.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function setItems(array $enums, bool $useKeys = true): self
*/
public function setValue(/*?LabeledEnum*/ $value): self
{
if ($value && !$value instanceof $this->enumType) {
if (isset($value) && !$value instanceof $this->enumType) {
$value = $this->enumType::make($value);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Controls/SelectBoxEnum.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function setItems(array $enums, bool $useKeys = true, bool $badge = false
*/
public function setValue(/*?LabeledEnum*/ $value): self
{
if ($value && !$value instanceof $this->enumType) {
if (isset($value) && !$value instanceof $this->enumType) {
$value = $this->enumType::make($value);
}

Expand Down

0 comments on commit 4755371

Please sign in to comment.