Hello, Ilija, Alex, > Yes, that would work fine.
Thanks for the answer! I am not opposed to this behavior, but it might be better to mention it in the RFC. Unlike Enums, an object in a constant can have mutable state, so the result depends on when the constant expression is executed. If it is difficult or doesn't have the benefit to determine the timing, it would be better to clearly state that the timing of the execution of such constant expression is undefined for now. It is also an understandable behavior to prohibit the use of normal objects in the property fetching in constant expressions because of the difference in mutability between Enum and other objects. > That would mean it would not be supported for > - class constant initializers > - instance property initializers > - static property initializers The new in initializers RFC doesn't explicitly mention the fact that it allows class constants having objects via global constant, but it's already doable in PHP 8.1. class A {public int $i = 42;} const BARE_CONSTANT = new A; class B { const ClassConstant = BARE_CONSTANT; } echo B::ClassConstant->i; Thanks! -- Shinji Igarashi -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php