Skip to content

Commit 80775c2

Browse files
Fix syntax error on enum(FQN).cases()
1 parent 6c89e2e commit 80775c2

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/Inspection/InvalidEnumCase.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,13 @@ private function checkArguments(GetAttrExpression $node): void
3737
{
3838
$location = new NodeLocation($node);
3939

40-
$enumClass = $node->getNode('node')->getNode('arguments')->getNode('0')->getAttribute('value');
41-
$case = $node->getNode('attribute')->getAttribute('value');
42-
4340
// No need to test whether enum_exists, as Twig's EnumFunction does that already.
44-
41+
$case = $node->getNode('attribute')->getAttribute('value');
4542
if ($case === 'cases') {
4643
return;
4744
}
4845

46+
$enumClass = $node->getNode('node')->getNode('arguments')->getNode('0')->getAttribute('value');
4947
foreach ($enumClass::cases() as $enumCase) {
5048
if ($enumCase->name === $case) {
5149
return;

0 commit comments

Comments
 (0)