Optimize usage of $var->getName()