|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2021-09-14 20:36 UTC] julien dot boudry at gmail dot com
-Summary: ReflectionEnum: Impossible to instantiate in the same
way as Classas Class
+Summary: ReflectionEnum: Impossible to instantiate in the same
way as Class
[2021-09-14 20:36 UTC] julien dot boudry at gmail dot com
[2021-09-14 22:21 UTC] requinix@php.net
-Summary: ReflectionEnum: Impossible to instantiate in the same
way as Class
+Summary: Enums cannot be used before they are defined
-Package: *General Issues
+Package: Class/Object related
[2021-09-14 22:21 UTC] requinix@php.net
[2021-09-15 08:01 UTC] nikic@php.net
-Status: Open
+Status: Wont fix
[2021-09-15 08:01 UTC] nikic@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 07:00:01 2025 UTC |
Description: ------------ This seems to be an inconsistency. The RFC does not say anything about this. The opposite of what happens to a class. Working if testEnum is declared before reflection. Test script: --------------- <?php $objClass = testObject::class; // OK $enumClass = testEnum::class; // OK new \ReflectionClass(testObject::class); // OK new \ReflectionEnum(testEnum::class); // Fatal Error // class testObject {} Enum testEnum { case TEXT; } Expected result: ---------------- No error Actual result: -------------- PHP Fatal error: Uncaught ReflectionException: Class "testEnum" does not exist in test.php:7 Stack trace: #0 test.php(7): ReflectionEnum->__construct() #1 {main} thrown in test.php on line 7