Req #80133 [Csd]: Please add late-defining for class constants

From: Date: Fri, 25 Sep 2020 12:48:48 +0000
Subject: Req #80133 [Csd]: Please add late-defining for class constants
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-229212@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
 User updated by:    flexjoly at vfweb dot nl
 Reported by:        flexjoly at vfweb dot nl
-Summary:            Allow reserved word 'list' to be used for namespaces
                     (and classnames)
+Summary:            Please add late-defining for class constants
 Status:             Closed
 Type:               Feature/Change Request
 Package:            *General Issues
-PHP Version:        Next Minor Version
+PHP Version:        Irrelevant
 Assigned To:        cmb
 Block user comment: N
 Private report:     N

 New Comment:

That is great news!
Thanks!


Previous Comments:
------------------------------------------------------------------------
[2020-09-22 15:04:24] cmb@php.net

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>

------------------------------------------------------------------------
[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


Thread (4 messages)

« previous php.bugs (#229212) next »