Category
stdlib
Problem
class_implements() accepts an object operand. On a backed enum case (E::A), Zend returns the same interface map as class_implements(E::class) (UnitEnum, BackedEnum). This compiler returns false (not an array).
#5422 tracks class_implements(E::class) (type name string). This issue is the enum case object operand only.
php-src reference
Repro (failure today)
<?php
enum E: int { case A = 1; }
var_dump(class_implements(E::A));
var_dump(class_implements(E::class));
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php -r "enum E:int{case A=1;} var_dump(class_implements(E::A));"
php bin/vm.php -r "enum E:int{case A=1;} var_dump(class_implements(E::A));"
'
| Runtime |
class_implements(E::A) |
| Zend |
array(2) { ["UnitEnum"]=>... ["BackedEnum"]=>... } |
| vm.php today |
bool(false) |
Scope (this repo)
| Area |
Path |
| Builtin |
ext/standard/class_implements.php / VmClassIntrospection |
| Enum cases |
lib/VM/EnumCaseSupport.php — resolve case object → enum ClassEntry interfaces |
Fix together with #5422 if one PR is simpler; keep both acceptance criteria green.
Done when
Related
Category
stdlibProblem
class_implements()accepts an object operand. On a backed enum case (E::A), Zend returns the same interface map asclass_implements(E::class)(UnitEnum,BackedEnum). This compiler returnsfalse(not an array).#5422 tracks
class_implements(E::class)(type name string). This issue is the enum case object operand only.php-src reference
ext/standard/basic_functions.c—PHP_FUNCTION(class_implements), object branchZend/zend_enum.c— enum casezend_objectimplementsUnitEnum/BackedEnumRepro (failure today)
class_implements(E::A)array(2) { ["UnitEnum"]=>... ["BackedEnum"]=>... }bool(false)Scope (this repo)
ext/standard/class_implements.php/VmClassIntrospectionlib/VM/EnumCaseSupport.php— resolve case object → enumClassEntryinterfacesFix together with #5422 if one PR is simpler; keep both acceptance criteria green.
Done when
class_implements(E::A)returns same array asclass_implements(E::class)on VMUnitEnumonlytest/compliance/cases/stdlib/class_implements_enum_case_object.phptgreen./script/ci-fast.sh --filter class_implements_enumgreenRelated
is_subclass_of()on enum cases