Re: [RFC] Scalar Type Hinting With Casts (re-opening)
From: Andrea Faulds Date: Fri, 18 Jul 2014 13:09:49 +0000 Subject: Re: [RFC] Scalar Type Hinting With Casts (re-opening) References: 1 Groups: php.internals Request: Send a blank email to internals+get-75689@lists.php.net to get a copy of this message
On 18 Jul 2014, at 06:02, Theodore Brown <theodorejb@outlook.com> wrote: > Another concern I have is in regard to the future. I'm looking forward to the > possibility of specifying nullable types in a future version of PHP (see Levi Morrison's > "Declaring Nullable Types" RFC: http://wiki.php.net/rfc/nullable_typehints). > If the > nullable types RFC is accepted, it would be highly disconcerting if scalar type > annotations allowed null values regardless of whether a nullable marker is specified. The current proposed behaviour could be changed. At the moment, if a scalar type hint is nullable, then it won’t cast NULL if it’s passed that value, but if it’s not nullable, then it will cast it. Considering how this tends to only allow lossless casts, though, it might be worth reconsidering this and just disallowing NULL altogether. It’s worth pointing out that NULL is usually an error value, and you might get it from using an uninitialised variable or calling an internal function with bad parameters. -- Andrea Faulds http://ajf.me/
Thread (250 messages)
- RE: [PHP-DEV] [RFC] Scalar Type Hinting With Casts (re-opening)
- Re: [RFC] Scalar Type Hinting With Casts (re-opening)
- RE: [PHP-DEV] [RFC] Scalar Type Hinting With Casts (re-opening)
- RE: [PHP-DEV] [RFC] Scalar Type Hinting With Casts (re-opening)
- RE: [PHP-DEV] [RFC] Scalar Type Hinting With Casts (re-opening)
- RE: [PHP-DEV] [RFC] Scalar Type Hinting With Casts (re-opening)
- RE: [PHP-DEV] [RFC] Scalar Type Hinting With Casts (re-opening)
- RE: [PHP-DEV] [RFC] Scalar Type Hinting With Casts (re-opening)
- Re: [RFC] Scalar Type Hinting With Casts (re-opening)
- RE: [PHP-DEV] [RFC] Scalar Type Hinting With Casts (re-opening)
- Re: [RFC] Scalar Type Hinting With Casts (re-opening)
- Re: [RFC] Scalar Type Hinting With Casts (re-opening)
- Re: [RFC] Scalar Type Hinting With Casts (re-opening)
- Re: [RFC] Scalar Type Hinting With Casts (re-opening)
- Re: [RFC] Scalar Type Hinting With Casts (re-opening)
| « previous | php.internals (#75689) | next » |
|---|