1 <?php declare(strict_types=1);
3 namespace PhpParser\Node;
5 use PhpParser\NodeAbstract;
8 * Represents a non-namespaced name. Namespaced names are represented using Name nodes.
10 class Identifier extends NodeAbstract
12 /** @var string Identifier as string */
15 private static $specialClassNames = [
22 * Constructs an identifier node.
24 * @param string $name Identifier as string
25 * @param array $attributes Additional attributes
27 public function __construct(string $name, array $attributes = []) {
28 parent::__construct($attributes);
32 public function getSubNodeNames() : array {
37 * Get identifier as string.
39 * @return string Identifier as string.
41 public function toString() : string {
46 * Get lowercased identifier as string.
48 * @return string Lowercased identifier as string
50 public function toLowerString() : string {
51 return strtolower($this->name);
55 * Checks whether the identifier is a special class name (self, parent or static).
57 * @return bool Whether identifier is a special class name
59 public function isSpecialClassName() : bool {
60 return isset(self::$specialClassNames[strtolower($this->name)]);
64 * Get identifier as string.
66 * @return string Identifier as string
68 public function __toString() : string {
72 public function getType() : string {