On 23/02/12 00:09, Stas Malyshev wrote: > Hi! > >>> Sidenote, according your examples above on how you want call >>> functions: Considered using normal constants? >> How can I do type hinting with them? > > You should not. PHP is not a strictly typed language, so if you want > strictly typed function you'll get in trouble, for the same reasons > why strict scalar typing wasn't a good idea - you may want to re-read > these discussions. I disagree. It is arguable whether having
> enum Databases { MySQL, Postgres, Oracle } > enum Colors { Red, Green, Blue } > > database_select(Colors::Red, $sql); should give an error for a Databases type hint on the first parameter, as it can be converted (that's a soft vs strict typing issue). However, such typehint should avoid a call like: > database_select(1024, $sql); with which the function can't do anything sensible with (other than returning an error if it does its own checking). Best regards -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php