Re: Return type hinting patch
| From: | Sam Barrow | Date: | Wed, 30 Apr 2008 11:50:15 +0000 |
| Subject: | Re: Return type hinting patch | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-37348@lists.php.net to get a copy of this message | ||
On Wed, 2008-04-30 at 09:23 +0300, Arvids Godjuks wrote:
> I'm +1 for this syntax
>
> function int myfunction(int $param)
> {
> return $someint;
> }
>
> C/C++ like, easy to understand
>
>
> And bad idea about making a return type "function" - looks very
> useless and will not be used a lot. Work with objects with methods
> returning an object of some kind, then you can do
Function is a reserved keyword in PHP anyway, it would cause problems in
numerous places if it was used as a type.
> $object->method()->method2()->method3();
>
> P.S. I think this thread should be merged with function param type
> hinting because they come together and should be implemented together,
Well this is two parts, class/array hinting and scalar hinting. Class
and array hinting is already implemented, so for now I'm just pushing
for that in return types.