Re: [RFC] Type hints (parameter and return value)
| From: | Lucas van Dijk | Date: | Thu, 17 Apr 2008 09:34:32 +0000 |
| Subject: | Re: [RFC] Type hints (parameter and return value) | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-37053@lists.php.net to get a copy of this message | ||
Array is already built in, and for mixed, as you already mentioned, indeed
no type hinting. I definitely want this implemented, +1 from me.
On Thu, Apr 17, 2008 at 11:01 AM, Arvids Godjuks <arvids.godjuks@gmail.com>
wrote:
> What about types like
> array
> mixed
>
> Ok, for "mixed" we may not use type hinting at all - does patch allow to
> hint only part of function args?
> If we have a function, witch takes as 1st argument array or string and
> other
> args should have strict types or just use call like myFunc(Array($string),
> .....) ? This is just to know this for sure.
>
> 2008/4/17, Felipe Pena <felipensp@gmail.com>:
> >
> > Hello again!
> >
> > Now with both parameter and return value type hints.
> >
> > For parameter type hints, i have completed the actual implementation
> > with the leftover php types:
> > - string (binary string and unicode)
> > - integer (accepting numeric string too)
> > - double (accepting numeric string too)
> > - boolean ('0', '1', true, false)
> > - resource
> > - object
> >
> > (Yes, following our dynamic typing)
> >
> >
> > Since then, the patch also includes new methods to Reflection:
> > - isInt()
> > - isDouble()
> > - isBool()
> > - isString()
> > - isObject()
> > - isResource()
> >
> >
> > And for return value, i have modified and improved the previous patch,
> > and now it is using only the "(type)" notation. Hence, that
> > implementation doesn't make any BC break.
> >
> >
> > Examples, patches and tests:
> > http://wiki.php.net/rfc/typehint
> >
> >
> > Thanks.
> >
> > --
> > Regards,
> > Felipe Pena.
> >
> >
> >
> > --
> > PHP Internals - PHP Runtime Development Mailing List
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
--
Lucas