Req #77975 [Fbk->Opn]: support $object::CLASS

From: Date: Mon, 06 May 2019 17:07:21 +0000
Subject: Req #77975 [Fbk->Opn]: support $object::CLASS
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-220720@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:         requinix@php.net
 Reported by:        Wes dot nospam at example dot org
 Summary:            support $object::CLASS
-Status:             Feedback
+Status:             Open
 Type:               Feature/Change Request
 Package:            Class/Object related
 PHP Version:        Irrelevant
 Block user comment: N
 Private report:     N

 New Comment:

No argument from me - more consistency is a good thing. Just trying to understand the request in
more detail.


Previous Comments:
------------------------------------------------------------------------
[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


Thread (5 messages)

« previous php.bugs (#220720) next »