Req #77559 [Nab]: Support callable::class and array::class

From: Date: Sun, 03 Feb 2019 04:39:53 +0000
Subject: Req #77559 [Nab]: Support callable::class and array::class
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-219344@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=77559&edit=1 ID: 77559 Updated by: requinix@php.net Reported by: mister dot pedantic at example dot org Summary: Support callable::class and array::class Status: Not a bug Type: Feature/Change Request Package: *General Issues Operating System: Irrelevant PHP Version: Irrelevant Block user comment: N Private report: N New Comment: https://3v4l.org/FohH3 static is a special case. It needs to be a keyword because it can be used for syntax (static class methods and properties and static variables) but it can also be used like self and parent (which aren't keywords). In fact you can see the deliberate support for "static" as a pseudo-class name having to be written right into the parser: https://github.com/php/php-src/blob/PHP-7.3.1/Zend/zend_language_parser.y#L1038 Previous Comments: ------------------------------------------------------------------------ [2019-02-03 04:22:12] mister dot pedantic at example dot org Also static is a keyword, but static::class works. they are all de-facto classes/types. ------------------------------------------------------------------------ [2019-02-03 04:04:56] requinix@php.net Actually this should get a longer answer. array and callable are keywords. They cannot be used for classes. http://php.net/manual/en/reserved.keywords.php int and string and such are not keywords, so int::class and string::class are supported. However at this time you cannot create classes named "int" or "string" because PHP is reserving those for its own possible future implementation. ------------------------------------------------------------------------ [2019-02-03 03:58:29] requinix@php.net Neither of those are classes. ------------------------------------------------------------------------ [2019-02-03 03:53:51] mister dot pedantic at example dot org Description: ------------ AFAIK, all ::class work except these two. Thanks. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=77559&edit=1

« previous php.bugs (#219344) next »