Re: [POC - Patch] Scalar Type Hinting - A-La zend_parse_parameters
| From: | Lazare Inepologlou | Date: | Fri, 09 Mar 2012 13:54:08 +0000 |
| Subject: | Re: [POC - Patch] Scalar Type Hinting - A-La zend_parse_parameters | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-58820@lists.php.net to get a copy of this message | ||
Yes, like that, only better. Since automatic type casting is central in
PHP, as this is evident after all this discussion, I believe that it should
be better supported. There are two thinks that I would like to see here:
1. No more magic methods, please.
2. It should cover (eventually) casting to and from any type.
:-)
Lazare INEPOLOGLOU
Ingénieur Logiciel
2012/3/9 Anthony Ferrara <ircmaxell@gmail.com>
> > (Now, it would be nice to have another RFC about custom object casting to
> > int, float and bool...)
>
> You mean like https://wiki.php.net/rfc/object_cast_to_types
> which is
> still in draft?
>
> Note that __toBool would be problematic, since it would be called if
> the object was used in an if statement, which could yield some very
> strange results if it returned false (it would break the existing
> semantics about how we can use if statements to determine if the type
> is populated)...
>
> Anthony
>