Skip to content

Language: enum implements interface — inherit interface class constants (#5725) - #5746

Merged
PurHur merged 1 commit into
masterfrom
agent/issue-5725-enum-interface-const
Jun 4, 2026
Merged

PurHur merged 1 commit into
masterfrom
agent/issue-5725-enum-interface-const

Conversation

@PurHur

@PurHur PurHur commented Jun 4, 2026

Copy link
Copy Markdown
Owner

Summary

Enums that implements an interface now inherit interface class constants on VM and JIT, matching Zend E::X resolution (php-src Zend/zend_enum.c / zend_interfaces.c).

  • VM: call inheritFromInterfaces() after enum body materialization in TYPE_DECLARE_ENUM
  • JIT: register classImplements and call inheritInterfaceConstants() for enums (same path as classes)

php-src reference

  • Zend/zend_enum.c — enum implements interface
  • Zend/zend_interfaces.c — inherited constants

Verification

Issue repro:

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php test/repro/parity_enum_interface_const.php
php bin/vm.php test/repro/parity_enum_interface_const.php 2>&1 | grep -v listSpreadRhs
'
1
'y'
1
'y'

Compliance:

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && vendor/bin/phpunit --filter enum_interface_const'
OK (1 test, 1 assertion)

Closes #5725

Made with Cursor

Enums implementing an interface now inherit interface constants on VM
and JIT, matching Zend E::X resolution for unit and backed enums.

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur merged commit 25f27f7 into master Jun 4, 2026
@PurHur
PurHur deleted the agent/issue-5725-enum-interface-const branch June 4, 2026 14:33
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 — interface class constants E::X must resolve (zend_enum.c)

1 participant