Req #80133 [Opn->Csd]: Allow reserved word 'list' to be used for namespaces (and classnames)
| From: | cmb@php.net | Date: | Tue, 22 Sep 2020 15:04:24 +0000 |
| Subject: | Req #80133 [Opn->Csd]: Allow reserved word 'list' to be used for namespaces (and classnames) | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-229143@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=80133&edit=1
ID: 80133
Updated by: cmb@php.net
Reported by: flexjoly at vfweb dot nl
Summary: Allow reserved word 'list' to be used for namespaces
(and classnames)
-Status: Open
+Status: Closed
Type: Feature/Change Request
Package: *General Issues
PHP Version: Next Minor Version
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
You can use
list as part of a namespace name as of PHP 8.0.0[1].
Using the keyword as standalone classname can't be supported,
though.
[1] <https://3v4l.org/hkth0>
Previous Comments:
------------------------------------------------------------------------
[2020-09-22 14:55:58] flexjoly at vfweb dot nl
Description:
------------
Hi,
That 'list' is a reserved word is understandable. But also very annoying. For you need it
a lot. Almost any crud has one or more lists.
I have (abstract base) classes like:
\data\data\Data
\data\data\DataInterface
\data\data\DataFactory
\data\record\Record
\data\record\RecordInterface
\data\record\RecordFactory
and I need:
\data\list\List (or \data\list\ListData)
\data\list\ListInterface
\data\list\ListFactory
But those are impossible.....
So instead of list we now use: listdata\ListData
Which is not consistent in our way of naming.
Now I wanted to make:
\import\list\ImportList
But even this is impossible.
https://www.php.net/manual/en/reserved.keywords.php
Since 7.0 many "keywords are allowed as property, constant, and method names".
It would be so nice if they would also be allowed as namespace.
Greetz, flexjoly
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=80133&edit=1