Re: [RFC] Type hints (parameter and return value)
| From: | Arvids Godjuks | Date: | Thu, 17 Apr 2008 09:01:24 +0000 |
| Subject: | Re: [RFC] Type hints (parameter and return value) | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-37052@lists.php.net to get a copy of this message | ||
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
>
>