protected function open_scope($pos, Lint\Node $node)
{
$token = $this->tokens[$pos];
$scope = true;
if ($token[0] === T_BASIC_CURLY_OPEN && !empty($this->scope)) {
// Scopes are closed by `;` if not opened by `{`.
$last = array_pop($this->scope);
if ($last[0] !== T_BASIC_CURLY_OPEN) {
$last[0] = T_BASIC_CURLY_OPEN;
$scope = false;
}
$this->scope[] = $last;
}
if ($scope) {
$depth = count($this->scope) + $node->depth;
$this->debug(sprintf('Scope opened by `%s` line %d', $token[1], $token[2]), $depth, OPT_SCOPE_MAP, true);
$this->scope[] = $token;
$node->tokens[] = array(T_OPEN_SCOPE, $token[1], $token[2]);
}
}