Skip to content

Create ReflectionEnum class #183

@devin-ai-integration

Description

@devin-ai-integration

Part of #182

Create src/ReflectionEnum.php that extends \ReflectionEnum (which itself extends \ReflectionClass):

  1. Accept a class name or Enum_ AST node (similar to how ReflectionClass works)
  2. Implement these methods specific to \ReflectionEnum:
    • getBackingType(): ?ReflectionNamedType — read from $enumNode->scalarType
    • getCase(string $name): ReflectionEnumUnitCase|ReflectionEnumBackedCase — find the EnumCase node by name
    • getCases(): array — return all enum cases as ReflectionEnumUnitCase/ReflectionEnumBackedCase instances
    • hasCase(string $name): bool
    • isBacked(): bool — check if $enumNode->scalarType is set
  3. Use the same InitializationTrait pattern as ReflectionClass
  4. Reference existing enum handling in src/ReflectionClass.php lines 100-112 and src/ReflectionMethod.php lines 404-412

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions