Skip to content

Language: enum user instance methods — VM case objects (#3390) - #3392

Merged
PurHur merged 1 commit into
masterfrom
agent/issue-3390-enum-user-methods
May 30, 2026
Merged

PurHur merged 1 commit into
masterfrom
agent/issue-3390-enum-user-methods

Conversation

@PurHur

@PurHur PurHur commented May 29, 2026

Copy link
Copy Markdown
Owner

Summary

  • Register enum cases as singleton ObjectEntry values at TYPE_DECLARE_CLASS_CONST time (unit and backed enums).
  • Implement Zend-style name / value property reads on enum case objects; backed enum echo still prints the scalar via Variable::toString.
  • Add compliance tests for unit and backed enum instance methods ($case->method(), $this->name).

php-src reference

  • Zend/zend_enum.c — enum case object handlers, name/value properties
  • Zend/zend_compile.c — zend_compile_enum / method registration

Parser/CFG for enum methods was already in place (patches/php-cfg-enum-class-method.patch, compileEnumBody); this PR completes VM runtime dispatch.

Verification

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

Closes #3390

Made with Cursor

Route enum case property reads through EnumCaseSupport before property
hooks; fix isPropertyHookRawWrite to use php-cfg class operand ->value.
Add enum_user_method / enum_backed_user_method compliance cases.

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur force-pushed the agent/issue-3390-enum-user-methods branch from 57e2ee4 to 7f89c66 Compare May 30, 2026 10:03
@PurHur
PurHur merged commit 86009e6 into master May 30, 2026
@PurHur
PurHur deleted the agent/issue-3390-enum-user-methods branch May 30, 2026 10:03
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 user methods — parse + VM dispatch (Zend zend_enum.c parity)

1 participant