Файл: gapps/vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/Namespace_.php
Строк: 45
<?php
namespace PhpParserNodeStmt;
use PhpParserNode;
use PhpParserError;
class Namespace_ extends NodeStmt
{
/** @var null|NodeName Name */
public $name;
/** @var Node[] Statements */
public $stmts;
protected static $specialNames = array(
'self' => true,
'parent' => true,
'static' => true,
);
/**
* Constructs a namespace node.
*
* @param null|NodeName $name Name
* @param null|Node[] $stmts Statements
* @param array $attributes Additional attributes
*/
public function __construct(NodeName $name = null, $stmts = array(), array $attributes = array()) {
parent::__construct($attributes);
$this->name = $name;
$this->stmts = $stmts;
if (isset(self::$specialNames[strtolower($this->name)])) {
throw new Error(
sprintf('Cannot use '%s' as namespace name', $this->name),
$this->name->getAttributes()
);
}
if (null !== $this->stmts) {
foreach ($this->stmts as $stmt) {
if ($stmt instanceof self) {
throw new Error('Namespace declarations cannot be nested', $stmt->getAttributes());
}
}
}
}
public function getSubNodeNames() {
return array('name', 'stmts');
}
}