Skip to content

Commit

Permalink
Fix crash when enum case references other enum case
Browse files Browse the repository at this point in the history
  • Loading branch information
AegirLeet committed Feb 2, 2024
1 parent fc88ef2 commit e18a357
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1437,10 +1437,16 @@ private function visitEnumDeclaration(
$case_location = new CodeLocation($this->file_scanner, $stmt);

if ($stmt->expr !== null) {
$expr = $stmt->expr;

if ($expr instanceof PhpParser\Node\Expr\PropertyFetch) {
$expr = $expr->var;
}

$case_type = SimpleTypeInferer::infer(
$this->codebase,
new NodeDataProvider(),
$stmt->expr,
$expr,
$this->aliases,
$this->file_scanner,
$storage->constants,
Expand Down

0 comments on commit e18a357

Please sign in to comment.