On Dec 22, 2011, at 9:09 AM, Dmitri Snytkine wrote:

> The return type hinting is probably the biggest thing happening in php in a
> long time.
> Is this too good to be true?

Hopefully not.  We will see when the voting commences. :)

> 
> With return type hinting I can see a huge improvenets in php IDEs in
> spotting errors. Also it will be much easier to auto generate wsdl files
> when return types are known to a compiler.
> These are just to name a couple of important benefits that can come out of
> it.
> 
> What I don't see is any discussion of being able to declare the type of
> variable, you now, like in Java.
> ie: 
> private \ArrayObject $customers;

Type hinting is relatively new to PHP, so we need to take careful steps in 
moving forward.  With the introduction of parameter type hinting 5.0, and 
return type hinting following its lead, we will set ourselves up for a good 
base for a type hinting API and structure.  That said, PHP is not Java, and 
type hinting in PHP is very different.  It is, in fact, type *hinting*.  This 
is a runtime feature.  Only interface validation is verified at compile time, 
so we have to consider performance vs. feature in these cases.

> 
> Also, is there an implicit "void" return type?

The following types are allowed for both parameters and method returns:

- Callable
- Object (class name)
- Array

By not declaring a type hint with a parameter, it is considered mixed.  With 
method returns, simply using the keyword "function" as you have been will 
signify mixed as well.

> 
> I hope that declaring types of variables will be added too because without
> it, this feature is not all that useful. 
> 
> Dmitri Snytkine
> Web Developer
> Ultra Logistics, Inc.
> Phone: (888) 220-4640 x 2097
> Fax: (888) 795-6642
> E-Mail: dsnytk...@ultralogistics.com
> Web: www.ultralogistics.com
> 
> "A Top 100 Logistics I.T. Provider in 2011"
> 
> 
> -----Original Message-----
> From: Will Fitch [mailto:will.fi...@gmail.com] 
> Sent: Wednesday, December 21, 2011 5:29 PM
> To: Pierre Joye
> Cc: Nikita Popov; PHP Developers Mailing List
> Subject: Re: [PHP-DEV] Return Type Hinting for Methods RFC
> 
> Hi Pierre and Nikita,
> 
> I have added callable to the patch and updated the RFC entry to reflect the
> changes. Please verify and let me know if you have any issues.
> 
> On Dec 21, 2011, at 2:33 PM, Pierre Joye wrote:
> 
>> hi Will,
>> 
>> You should add it now, while 5.4 final is not released yet, this
>> feature exists already and should be part of the RFC, to be complete.
>> 
>> Cheers,
>> 
>> On Wed, Dec 21, 2011 at 6:22 PM, Will Fitch <will.fi...@gmail.com> wrote:
>>> Hi Nikita,
>>> 
>>> I didn't add that as it's not yet in production.  As soon as things are
> finalized and 5.4 is GA, I will gladly add the callable type hint.  The
> change wouldn't be different from parameter type hinting, and can easily be
> added.
>>> 
>>> On Dec 21, 2011, at 12:17 PM, Nikita Popov wrote:
>>> 
>>>> Hi Will!
>>>> 
>>>> One random thought I had while reading the RFC is: What about the
>>>> newly introduced callable typehint? Is this missing by intention? I
>>>> could well imagine so (because it's hard to check what scope
>>>> callability should be checked on), but wanted to be sure on that.
>>>> 
>>>> Nikita
>>>> 
>>>> On Wed, Dec 21, 2011 at 3:09 AM, Will Fitch <will.fi...@gmail.com>
> wrote:
>>>>> Hello All,
>>>>> 
>>>>> I would like to submit https://wiki.php.net/rfc/returntypehint2 into
> discussion.  A link to the patch for this is provided and can be ran against
> the current HEAD.
>>>>> 
>>>>> There is an older entry still in existence, but this patch is
> syntactically different.  The older entry is located at
> https://wiki.php.net/rfc/typechecking and is bundled with parameter,
> scalars, etc.
>>>>> 
>>>>> If possible, can someone promote this to the "Under Discussion"
> category within https://wiki.php.net/rfc?
>>>>> 
>>>>> -- Will
>>>>> --
>>>>> PHP Internals - PHP Runtime Development Mailing List
>>>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>>> 
>>> 
>>> 
>>> --
>>> PHP Internals - PHP Runtime Development Mailing List
>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>> 
>> 
>> 
>> 
>> -- 
>> Pierre
>> 
>> @pierrejoye | http://blog.thepimp.net | http://www.libgd.org
> 
> 
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

Reply via email to