|
|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2021-09-20 13:29 UTC] [email protected]
[2021-09-20 13:29 UTC] [email protected]
-Status: Open
+Status: Closed
|
|||||||||||||||||||||||||||
|
All rights reserved. |
Last updated: Sat Aug 01 04:00:01 2026 UTC |
Description: ------------ With Enum, ReflectionMethod->getDeclaringClass() return a ReflectionClass object instead of ReflectionEnum. The RFC is unclear about that. But ReflectionEnum extends ReflectionClass, so the types are compatible and it's more logical. We are forced to use the enum_exists() function, and rebuild a new ExceptionEnum if we need ReflectionEnum. Test script: --------------- <?php Enum testEnum { case A; case B; public function foo () {} } $re = new ReflectionEnum(testEnum::class); $me = $re->getMethod('foo'); echo $me->getDeclaringClass()::class; echo "\n"; $rc = new ReflectionClass(testEnum::class); $mc = $re->getMethod('foo'); echo $mc->getDeclaringClass()::class; Expected result: ---------------- ReflectionEnum ReflectionEnum Actual result: -------------- ReflectionClass ReflectionClass