Re: [RFC] Scalar Type Hinting With Casts (re-opening)
| From: | Andrea Faulds | Date: | Fri, 25 Jul 2014 19:00:13 +0000 |
| Subject: | Re: [RFC] Scalar Type Hinting With Casts (re-opening) | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-76134@lists.php.net to get a copy of this message | ||
On 20 Jul 2014, at 17:26, Theodore Brown <theodorejb@outlook.com> wrote:
> The one remaining issue I have with this proposal is that boolean values are currently accepted
> for every other scalar type except array. As with NULL, FALSE is a common error value, and allowing
> booleans to be passed to a function expecting a string or numeric value could easily mask errors and
> lead to hard-to-debug issues in a program. Just as a string cannot be passed to a function expecting
> a boolean, a boolean should not be passed to a function expecting a string, etc.
After consulting with Anthony about this, the RFC and patch have been updated to disallow booleans
for int, float, numeric and string type hints. The conversions table now looks like this:
https://wiki.php.net/rfc/scalar_type_hinting_with_cast#conversion_rules
--
Andrea Faulds
http://ajf.me/