PhpParser\ParserAbstract::checkNamespace PHP Method

checkNamespace() protected method

protected checkNamespace ( Namespace_ $node )
$node PhpParser\Node\Stmt\Namespace_
    protected function checkNamespace(Namespace_ $node) {
        if (isset(self::$specialNames[strtolower($node->name)])) {
            $this->emitError(new Error(
                sprintf('Cannot use \'%s\' as namespace name', $node->name),
                $node->name->getAttributes()
            ));
        }

        if (null !== $node->stmts) {
            foreach ($node->stmts as $stmt) {
                if ($stmt instanceof Namespace_) {
                    $this->emitError(new Error(
                        'Namespace declarations cannot be nested', $stmt->getAttributes()
                    ));
                }
            }
        }
    }