Skip to content

Commit 635895c

Browse files
committed
CR
1 parent 0f6c28a commit 635895c

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/lib/Twig/Components/ListFieldTrait.php

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,21 @@
2020
*/
2121
trait ListFieldTrait
2222
{
23-
public string $direction = 'vertical';
23+
private const string VERTICAL = 'vertical';
24+
private const string HORIZONTAL = 'horizontal';
25+
26+
public string $direction = self::VERTICAL;
2427

2528
/** @var ListItems */
2629
#[ExposeInTemplate(name: 'items', getter: 'getItems')]
2730
public array $items = [];
2831

29-
/** @return ListItems */
32+
/**
33+
* @return ListItems
34+
*/
3035
public function getItems(): array
3136
{
32-
return array_map(function ($item) {
37+
return array_map(function (array $item) {
3338
$listItem = $item + ['name' => $this->name, 'required' => $this->required];
3439

3540
return $this->modifyListItem($listItem);
@@ -55,7 +60,7 @@ protected function validateListFieldProps(OptionsResolver $resolver): void
5560

5661
$resolver
5762
->define('direction')
58-
->allowedValues('vertical', 'horizontal')
59-
->default('vertical');
63+
->allowedValues(self::VERTICAL, self::HORIZONTAL)
64+
->default(self::VERTICAL);
6065
}
6166
}

0 commit comments

Comments
 (0)