Skip to content

PHP: 8.1 enum cases are dropped (no case_of edges) #4022

Closed

Description

@rajatnagda45

Summary

A PHP 8.1 enum captures its type and methods but drops all of its cases, leaving the enum a caseless leaf.

Repro

<?php
enum Suit: string {
    case Hearts = 'H';
    case Spades = 'S';
    public function color(): string { return 'x'; }
}

The graph has Suit, Suit::color(), but no Hearts/Spades nodes and no case_of edges.

Cause

enum_declaration is in the PHP class_types, so the type and its methods are walked, but the cases nest in the enum_declaration_list body as enum_case nodes that no handler visits. Every other enum language already emits a node + case_of per member via a language extra-walk (Java #1719 enum_constant, Kotlin enum_entry, Swift, Scala, C++ enumerator); PHP has none.

Expected

Emit a node and a case_of edge per enum_case, for both backed (: string) and pure enums. Methods must stay intact.

Fix + regression test ready.

Activity

  1. github-actions commented on Oct 3, 2026

    @github-actions

    Thanks for opening this issue, @rajatnagda45. A maintainer will take a look soon.

    If you would like to discuss it in real time, come say hi on our Discord server. For longer-form questions and ideas there is also GitHub Discussions.

    To help us triage, please make sure the report includes what you expected, what actually happened, and the steps (and a small sample) to reproduce it.

  2. safishamsi commented on Oct 4, 2026

    @safishamsi
    Member

    Fixed in v0.9.75 (live on PyPI as graphifyy==0.9.75) via #4026, thanks @rajatnagda45. 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions