Re: [RFC] Enum proposal (yet another)
| From: | Ángel González | Date: | Thu, 23 Feb 2012 20:21:11 +0000 |
| Subject: | Re: [RFC] Enum proposal (yet another) | ||
| References: | 1 2 3 4 5 6 7 8 9 10 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-57985@lists.php.net to get a copy of this message | ||
I don't see your point, Sebastian.
> And
>
> | $studipNamedVariable = Databases::Mysql;
> | // ... much code
> | database_select($stupidNamedVariable, $sql);
>
> is better? The problem here seems to be more the developer, that
> avoids the use of constants, then less the missing enums.
You can obviously do weird things, as with in any feature. In this case
you bring up, I see little sense in passing enums in variables, unless
that comes itself from a parameter for that function, or comes from an
external source, like a configuration data.
> If you use a constant like
>
> | Databases::Mysql = 1024;
>
> the call
>
> | database_select(Database::IDontExists, $sql);
>
> will fail too. Other examples, that supports type hints, can be found
> in other mails around here.
Yes. With a parser error as IDontExists doesn't belong to Database enum.
How does it relate with assigning 1024 to Databases::Mysql ?