public function visitEncapsList(Node $node) : Context
{
foreach ((array) $node->children as $child_node) {
// Confirm that variables exists
if ($child_node instanceof Node && $child_node->kind == \ast\AST_VAR) {
$variable_name = $child_node->children['name'];
// Ignore $$var type things
if (!is_string($variable_name)) {
continue;
}
// Don't worry about non-existent undeclared variables
// in the global scope if configured to do so
if (Config::get()->ignore_undeclared_variables_in_global_scope && $this->context->isInGlobalScope()) {
continue;
}
if (!$this->context->getScope()->hasVariableWithName($variable_name) && !Variable::isSuperglobalVariableWithName($variable_name)) {
$this->emitIssue(Issue::UndeclaredVariable, $child_node->lineno ?? 0, $variable_name);
}
}
}
return $this->context;
}