On 23 September 2015 20:04:57 BST, Ryan Pallas <derokor...@gmail.com> wrote:
> I dislike this because it makes refactoring harder. Just like when we
>rename a dynamic property, we have to search for its usage as a string
>(which may be stored in a variable), and then analyze if those strings
>warrant being changed. Of course, strings in a variable may also be
>created
>dynamically, so simply searching for the name of a property being
>renamed
>may not find you all its usages.

But variable_exists is only ever useful when using dynamic variable 
declarations anyway. If you have stable variable names which are amenable to 
static analysis, you should never need to know if they "exist" or not. 

What's more, the function is not dereferencing a variable to get its value, it 
is looking up a name in the symbol table, so the magic syntax that makes it 
look like you're using the variable is misleading.

And yes, the same criticism is true of hasitem(); I'm not 100% sure if it's a 
good idea or not, only that it's preferable to a Swiss-army knife exists().

Regards,
-- 
Rowan Collins
[IMSoP]


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

Reply via email to