Req #77975 [Asn->Csd]: support $object::CLASS

From: Date: Sun, 01 Mar 2020 22:21:33 +0000
Subject: Req #77975 [Asn->Csd]: support $object::CLASS
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-225824@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=77975&edit=1 ID: 77975 Updated by: cmb@php.net Reported by: Wes dot nospam at example dot org Summary: support $object::CLASS -Status: Assigned +Status: Closed Type: Feature/Change Request Package: Class/Object related PHP Version: Irrelevant Assigned To: nikic Block user comment: N Private report: N New Comment: <https://wiki.php.net/rfc/class_name_literal_on_object> has already been implemented. :) Previous Comments: ------------------------------------------------------------------------ [2019-05-06 17:07:21] requinix@php.net No argument from me - more consistency is a good thing. Just trying to understand the request in more detail. ------------------------------------------------------------------------ [2019-05-06 17:05:27] levim@php.net Note that static::CLASS already works, which is somewhat dynamic. The opcode can have more arguments, I think, so I don't see any reason why this can't be done technically. What's the argument against making it support dynamic lookup? ------------------------------------------------------------------------ [2019-05-06 14:57:59] requinix@php.net Problem is that ::class is compile-time. Why not get_class()? ------------------------------------------------------------------------ [2019-05-06 14:25:39] Wes dot nospam at example dot org Description: ------------ Would be great to align $object::CLASS to behave like other constants, even if CLASS isn't actually one. The current result is: Fatal error: Dynamic class names are not allowed in compile-time ::class fetch in Thank you ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=77975&edit=1

« previous php.bugs (#225824) next »