php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #70834 Namespace name scalar with ::namespace
Submitted: 2015-11-02 11:03 UTC Modified: 2020-02-28 15:04 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: office at maslosoft dot com Assigned:
Status: Open Package: Scripting Engine problem
PHP Version: Irrelevant OS: Any
Private report: No CVE-ID: None
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
46 + 11 = ?
Subscribe to this entry?

 
 [2015-11-02 11:03 UTC] office at maslosoft dot com
Description:
------------
Background:
There is existing special constant, ie `Vendor\Package\ClassName::class`, as per RFC:
https://wiki.php.net/rfc/class_name_scalars

Requested feature:
There could be also namespace constant, which is anyway reserved, ie:

`Vendor\Package\ClassName::namespace` should resolve to string '\Vendor\Package\ClassName'

Pros:
Could be used for any namespace related operation, like registering namespace for some purpose

Cons:
Could interfere with token parsing scripts



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-11-02 11:04 UTC] office at maslosoft dot com
Typo, it should be:
`Vendor\Package\ClassName::namespace` should resolve to string '\Vendor\Package'
 [2020-02-28 15:04 UTC] nikic@php.net
-Package: Reflection related +Package: Scripting Engine problem
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Oct 06 14:01:27 2024 UTC