Re: [RFC] Scalar Type Hints
| From: | Derick Rethans | Date: | Sun, 04 Jan 2015 17:31:39 +0000 |
| Subject: | Re: [RFC] Scalar Type Hints | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-80154@lists.php.net to get a copy of this message | ||
On Wed, 31 Dec 2014, Stanislav Malyshev wrote:
>
> The issue is the class names though. E.g. see:
>
> https://github.com/ralphschindler/zf2-db/blob/master/research/ColumnType/Integer.php
That's in a namespace, so it's not actually Integer, but
Zend\Db\Metadata\Type\Integer
> and:
>
>
> https://github.com/canaydogan/ObjectValidator/blob/master/src/ObjectValidator/Validator/Int.php
That's in a namespace, so it's not actually Int, but
ObjectValidator\Validator\Int
>
> These are uppercase "I", but class names are not case-sensitive... So
> we'll need to figure it out. Unfortunately, looking at github,
> disallowing "class Int" looks like pretty bad idea.
Sorry, but for years we have this in the manual
(http://php.net/manual/en/userlandnaming.rules.php):
"PHP owns the top-level namespace but tries to find decent descriptive
names and avoid any obvious clashes."
With namespaces (as in your above examples), this is already moot.
I think it's perfectly acceptable that PHP makes a built-in type a
reserved word. I would certainly not change it to PHPInt to "avoid any
obvious clashes".
cheers,
Derick