You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Language: enum methods and non-const enum body elements (self-host subset) #2299
Backed enum declarations are green (#1356 ✅) for const-like cases, but lib/Compiler.php::compileEnumBody() still throws on any enum body child that is not Op\Terminal\Const_:
thrownew \LogicException('Unsupported enum body element: '.get_class($child));
docs/bootstrap-inventory.md may list Unsupported enum body element: when inventory regresses. Host/vendor PHP 8.2+ code uses enum methods, implements clauses, and non-const patterns that block self-host batches.
Goal (v1 subset)
Support the smallest set needed to reduce inventory noise without full PHP 8.1 enum semantics:
Problem
Backed enum declarations are green (#1356 ✅) for const-like cases, but
lib/Compiler.php::compileEnumBody()still throws on any enum body child that is notOp\Terminal\Const_:docs/bootstrap-inventory.mdmay listUnsupported enum body element:when inventory regresses. Host/vendor PHP 8.2+ code uses enum methods,implementsclauses, and non-const patterns that block self-host batches.Goal (v1 subset)
Support the smallest set needed to reduce inventory noise without full PHP 8.1 enum semantics:
public function label(): stringlowered like class methods (Language: Class methods and property access in JIT #58 / Language: Visibility, constructors, and destructors #145 dependency)enum Foo: string implements Barrecorded in class metadata (no dynamic dispatch v1)const+ method combos requiring traits (Language: Traits, abstract classes, and interfaces #144)Implementation hints
lib/Compiler.php—compileEnum,compileEnumBodyClassMethodin enum body; reusecompileClassBodypieceslib/VM.phplib/JIT.phplib/Lint/UnsupportedRegistry.phplib/AOT/Suggested PR slices
implementson enum; no dispatchpublic function name(): stringwith$thisas case wrappertest/compliance/cases/enum_method.phptdocs/bootstrap-inventory.md; expect warning deltaTest plan
Acceptance criteria
compileEnumBodyaccepts at least oneClassMethodwithout throwphp script/bootstrap-inventory.php --checkstill clean or documented deltascript/capability-matrix.phprow updatedVerification (local / Docker only)
./script/ci-fast.sh --filter enum make test-harness # pre-merge when JIT touchedNo GitHub Actions (#394 ✅).
Dependencies
privateenum methods to v2)lib/(discover viabootstrap-inventory-triage.phpafter Language: Class methods and property access in JIT #58)Links