Skip to content

Commit

Permalink
Use / variable names when mapping/walking arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
juniwalk committed May 13, 2024
1 parent 20b8e79 commit 676a456
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/Controls/CheckboxListEnum.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function setEnumType(string $enumType): static
public function getCases(): array
{
/** @var array<T> */
return Arrays::map($this->getItems(), fn($x, $y) => $this->enumType::make($y));
return Arrays::map($this->getItems(), fn($v, $k) => $this->enumType::make($k));
}


Expand Down Expand Up @@ -100,7 +100,7 @@ public function getValue(): array
}

/** @var array<int|string, T> */
return Arrays::map($this->value, fn($x) => $this->enumType::make($x));
return Arrays::map($this->value, fn($v) => $this->enumType::make($v));
}


Expand Down
4 changes: 2 additions & 2 deletions src/Controls/RadioListEnum.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function setEnumType(string $enumType): static
public function getCases(): array
{
/** @var array<T> */
return Arrays::map($this->getItems(), fn($x, $y) => $this->enumType::make($y));
return Arrays::map($this->getItems(), fn($v, $k) => $this->enumType::make($k));
}


Expand Down Expand Up @@ -95,7 +95,7 @@ public function getValue(): ?LabeledEnum
public function setDisabled(array|bool $value = true): static
{
if (is_array($value)) {
$value = Arrays::map($value, fn($x) => $x->value);
$value = Arrays::map($value, fn($v) => $v->value);
}

return parent::setDisabled($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 @@ -87,7 +87,7 @@ public function getValue(): ?LabeledEnum
public function setDisabled(array|bool $value = true): static
{
if (is_array($value)) {
$value = Arrays::map($value, fn($x) => $x->value);
$value = Arrays::map($value, fn($v) => $v->value);
}

return parent::setDisabled($value);
Expand Down

0 comments on commit 676a456

Please sign in to comment.