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