On Wed, Sep 23, 2015 at 12:27 PM, Rowan Collins <rowan.coll...@gmail.com> wrote: > > > My suggestion (with which I believe Stig was agreeing) is this: > > variable_exists('foo'): yes (should be yes) > unset($foo); > variable_exists('foo'): no (should be no) > variable_exists('bar'): no (should be no) > > 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.
This feels like exactly the type of thing you were trying to avoid when you suggested hasitem() since you pass it a compound variable expression ($var->prop, $var['key']) which makes refactoring easier. I would prefer seeing both take actual expressions, much like isset and empty. Basically, if variable_exists recurses then its an error and if hasitem doesn't recurse its an error.