On Sat, Jan 31, 2015 at 3:12 AM, Matteo Beccati <p...@beccati.com> wrote:
> Hi Phil,
>
>
> On 31/01/2015 05:14, Philip Sturgeon wrote:
>>
>> This RFC adds a new method to ReflectionParameter to allow easy access
>> to a class name in a type hint, avoiding the need to actually load the
>> class and use `get_class()` or `::class`.
>>
>> https://wiki.php.net/rfc/reflectionparameter-getclassname
>
>
> Looks good to me!
>
> Just a couple of minor things.
>
> 1) The RFC does not mention what happens if the parameter is not type
> hinted, or what happens when hints are namespaced and/or use clauses are
> used.
>
> 2) There's a tiny bit of overlap with "scalar type hints", if it is accepted
> (in any form) and reflection support added to it. Depending on the way such
> reflection support is implemented, the method proposed here could be a
> perfect match. Or perhaps it could be in the way.
>
>
> Cheers
> --
> Matteo Beccati
>
> Development & Consulting - http://www.beccati.com/

Thanks! Good questions.

1) Thanks for your help on GitHub in making tests for this. Implemented nicely.

2) There might be some overlap in the scalar type hint stuff kinda,
but I'd like to think there isn't. getClassName() is just
getClass()->name without loading the actual class. Getting "string' or
"int" back is likely to have its own logic in the scalar type hint RFC
so I'd rather stay clear of it altogether.

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to