Re: [POC - Patch] Scalar Type Hinting - A-La zend_parse_parameters
| From: | Lazare Inepologlou | Date: | Mon, 12 Mar 2012 16:04:20 +0000 |
| Subject: | Re: [POC - Patch] Scalar Type Hinting - A-La zend_parse_parameters | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-58881@lists.php.net to get a copy of this message | ||
Thank you for the confirmation.
What I am saying here is that, although this behavior was fine for objects,
it is not enough for scalars. One of the main arguments in favor of the
adoption of this syntax was that null was the only possible default value
for objects anyway. This obviously is not the case with for scalar types.
This is why I suggest a different syntax (which can also be used by object
types for consistency).
Lazare INEPOLOGLOU
Ingénieur Logiciel
2012/3/12 Anthony Ferrara <ircmaxell@gmail.com>
> Lazare,
>
> > The patch of Anthony, clearly states that this is accepted:
> >
> > function foo ( int $bar = null ) { }
> >
> > And this is what I called an int|null.
>
> Yup, it does. Because that's the current behavior with array and
> object casting. If you default it to null in the declaration, null is
> a valid value. If you don't, it's not...
>