Re: Re: Clarification on the Enum language structure
| From: | Ben Schmidt | Date: | Wed, 23 Feb 2011 23:13:32 +0000 |
| Subject: | Re: Re: Clarification on the Enum language structure | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-51526@lists.php.net to get a copy of this message | ||
I also suggest when type-hinting, if the type is integer or string where an enum is expected, PHP attempts a cast before failing, to make this more convenient.O, and if this cast (or any cast to enum) fails, IMHO, it should replace it with null. When type-hinting, this means that if null is an acceptable value, execution can continue. If not, error, same as if something of a non-scalar non-matching type is passed, consistent with object type hints. Ben.