Re: [VOTE] Scalar Type Hints
| From: | Andrea Faulds | Date: | Wed, 11 Feb 2015 18:44:37 +0000 |
| Subject: | Re: [VOTE] Scalar Type Hints | ||
| References: | 1 2 3 4 5 6 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-82490@lists.php.net to get a copy of this message | ||
Hi Pavel,
> On 11 Feb 2015, at 07:41, Pavel Kouřil <pajousek@gmail.com> wrote:
>
> Also, I realized one thing why I think the strict version is a bad
> idea for PHP (in the state PHP is now - in an ideal world I would love
> to have nothing but strongly typed PHP, but that's offtopic) - PHP has
> many functions that return multiple types, so you cannot do foo(bar())
> if bar() has multiple return types. :(
You can’t do it with weak types either. Functions with multiple return type usually do so in order
to use one type for success, and another return type on failure. In weak typing mode, PHP would just
mangle the error value (like FALSE).
--
Andrea Faulds
http://ajf.me/