Skip to content

Language: enum implements interface — case objects + VM dispatch (#3373) - #3378

Merged
PurHur merged 1 commit into
masterfrom
agent/issue-3373-enum-implements-interface
May 30, 2026
Merged

PurHur merged 1 commit into
masterfrom
agent/issue-3373-enum-implements-interface

Conversation

@PurHur

@PurHur PurHur commented May 29, 2026

Copy link
Copy Markdown
Owner

Summary

  • Enum case fetches (Status::Open) now materialize as cached singleton ObjectEntry instances instead of bare backed scalars, enabling instance method dispatch and instanceof against implemented interfaces.
  • Built-in enum case properties name and value match Zend semantics; string context (echo/concat) still uses the backed scalar.
  • php-cfg parse path for enum … implements … was already wired (Language: Backed enum VM regression — php-cfg Enum_ parse + case value echo (#1356) #3083); this completes VM runtime parity for the issue repro.

php-src reference: Zend/zend_enum.c (enum registration + case objects), Zend/zend_interfaces.c (interface satisfaction), Zend/zend_compile.c (zend_compile_enum implements clause).

Verification

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php vendor/bin/phpunit --filter EnumVMTest'
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php vendor/bin/phpunit --filter VmEnumImplementsInterfaceTest'
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php vendor/bin/phpunit --filter PhpCfgEnumImplementsParseTest'

Closes #3373

Made with Cursor

VM dispatch for enum case objects with interface methods and instanceof
is already on master via EnumCaseSupport; add phpt, unit test, and
capability matrix notes.

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur force-pushed the agent/issue-3373-enum-implements-interface branch from 2440554 to 9078c2b Compare May 30, 2026 10:59
@PurHur
PurHur merged commit 3fd180a into master May 30, 2026
@PurHur
PurHur deleted the agent/issue-3373-enum-implements-interface branch May 30, 2026 10:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Language: enum implements interface — parse + VM dispatch (Zend zend_enum.c parity)

1 participant