> On 6 Nov 2014, at 09:29, Daniel Ribeiro <drgom...@gmail.com> wrote:
> 
> On Thu, Nov 6, 2014 at 1:01 PM, Stas Malyshev <smalys...@sugarcrm.com>
> wrote:
> 
>> You could of course require the expression to always be enclosed in (),
>> but that produces weird syntax where some forms of instanceof work
>> without () and some only with (). Given that you can easily assign your
>> value to a variable, is it worth it?
>> 
>> Also, you can always use is_a($foo, $bar->getClassName()).
>> 
> 
> This is exactly what I'm doing right now, requiring the expression to
> always be enclosed in parenthesis. I think it's way better to be able to do
> this instead of creating temporary variables just to assign a class name.
> Also, is_a, since it's a function, is significantly slower than instanceof,
> which is a construct (but of course you already now that).

This is still pretty weird, $foo instanceof Bar and $foo instanceof (Bar) 
shouldn’t be different.

Perhaps, dare I say it, we should merge the constant and class namespaces in 
PHP7? Those are perhaps the least likely to conflict. It’d mean we could handle 
instanceof expressions, and we wouldn’t need to use ::class.

--
Andrea Faulds
http://ajf.me/





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

Reply via email to