Re: [RFC] Scalar Type Hinting With Casts (re-opening)
| From: | Rowan Collins | Date: | Mon, 14 Jul 2014 17:24:20 +0000 |
| Subject: | Re: [RFC] Scalar Type Hinting With Casts (re-opening) | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-75497@lists.php.net to get a copy of this message | ||
Zeev Suraski wrote (on 14/07/2014):
I'd say absolutely yes, if they're PHP developers that's exactly what they'd expect. After all, if you use 'hello' today in any integer context in PHP, explicit or implicit, that's exactly how it will behavior across the language.And yet if you use it as a parameter to a type hinted function, it will produce an error. You can be consistent with casts, or consistent with existing type hints, but not both. If the current type hints were only for objects, I would be OK with that, but I really don't get why an array cast is so different from an int cast.