Skip to content

Commit 257b970

Browse files
committed
[Site] Address PR review feedback
- Use PascalCase for enum values (Normal instead of NORMAL) - Use named arguments in Animalz constructor - Cache this.results in template variable to avoid double call
1 parent 9c2698f commit 257b970

File tree

4 files changed

+152
-151
lines changed

4 files changed

+152
-151
lines changed

ux.symfony.com/src/Enum/AnimalzType.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,16 @@
1515

1616
enum AnimalzType: string
1717
{
18-
case Normal = 'NORMAL';
19-
case Water = 'WATER';
20-
case Flying = 'FLYING';
21-
case Bug = 'BUG';
22-
case Fight = 'FIGHT';
23-
case Dark = 'DARK';
24-
case Poison = 'POISON';
25-
case Grass = 'GRASS';
26-
case Fairy = 'FAIRY';
27-
case Fossil = 'FOSSIL';
18+
case Normal = 'Normal';
19+
case Water = 'Water';
20+
case Flying = 'Flying';
21+
case Bug = 'Bug';
22+
case Fight = 'Fight';
23+
case Dark = 'Dark';
24+
case Poison = 'Poison';
25+
case Grass = 'Grass';
26+
case Fairy = 'Fairy';
27+
case Fossil = 'Fossil';
2828

2929
public function getColor(): string
3030
{

ux.symfony.com/src/Service/AnimalzRepository.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,11 @@ private function loadZanimalz(): array
8888

8989
return array_map(
9090
fn (array $item): Animalz => new Animalz(
91-
$item['name'],
92-
AnimalzType::from($item['type'][0]),
93-
isset($item['type'][1]) ? AnimalzType::from($item['type'][1]) : null,
94-
$item['legs'],
95-
$item['description'],
91+
name: $item['name'],
92+
type1: AnimalzType::from($item['type'][0]),
93+
type2: isset($item['type'][1]) ? AnimalzType::from($item['type'][1]) : null,
94+
legs: $item['legs'],
95+
description: $item['description'],
9696
),
9797
$data,
9898
);

0 commit comments

Comments
 (0)