Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Identifier.php

class Identifier

Same name in this branch
  1. 11.1.x vendor/mck89/peast/lib/Peast/Syntax/Node/Identifier.php \Peast\Syntax\Node\Identifier

Represents a non-namespaced name. Namespaced names are represented using Name nodes.

Hierarchy

  • class \PhpParser\NodeAbstract implements \PhpParser\Node, \PhpParser\JsonSerializable
    • class \PhpParser\Node\Identifier extends \PhpParser\NodeAbstract

Expanded class hierarchy of Identifier

23 files declare their use of Identifier
AccessDeprecatedPropertyRule.php in vendor/phpstan/phpstan-deprecation-rules/src/Rules/Deprecations/AccessDeprecatedPropertyRule.php
AccessDeprecatedStaticPropertyRule.php in vendor/phpstan/phpstan-deprecation-rules/src/Rules/Deprecations/AccessDeprecatedStaticPropertyRule.php
BuilderFactory.php in vendor/nikic/php-parser/lib/PhpParser/BuilderFactory.php
BuilderHelpers.php in vendor/nikic/php-parser/lib/PhpParser/BuilderHelpers.php
CallToDeprecatedMethodRule.php in vendor/phpstan/phpstan-deprecation-rules/src/Rules/Deprecations/CallToDeprecatedMethodRule.php

... See full list

19 string references to 'Identifier'
BreakStatement::setLabel in vendor/mck89/peast/lib/Peast/Syntax/Node/BreakStatement.php
Sets the node's label
ClassDeclaration::setId in vendor/mck89/peast/lib/Peast/Syntax/Node/ClassDeclaration.php
Sets the class identifier
Class_::setId in vendor/mck89/peast/lib/Peast/Syntax/Node/Class_.php
Sets class name
ContinueStatement::setLabel in vendor/mck89/peast/lib/Peast/Syntax/Node/ContinueStatement.php
Sets the node's label
DatabaseBackend::schemaDefinition in core/lib/Drupal/Core/Flood/DatabaseBackend.php
Defines the schema for the flood table.

... See full list

File

vendor/nikic/php-parser/lib/PhpParser/Node/Identifier.php, line 10

Namespace

PhpParser\Node
View source
class Identifier extends NodeAbstract {
    
    /**
     * @psalm-var non-empty-string
     * @var string Identifier as string
     */
    public string $name;
    
    /** @var array<string, bool> */
    private static array $specialClassNames = [
        'self' => true,
        'parent' => true,
        'static' => true,
    ];
    
    /**
     * Constructs an identifier node.
     *
     * @param string $name Identifier as string
     * @param array<string, mixed> $attributes Additional attributes
     */
    public function __construct(string $name, array $attributes = []) {
        if ($name === '') {
            throw new \InvalidArgumentException('Identifier name cannot be empty');
        }
        $this->attributes = $attributes;
        $this->name = $name;
    }
    public function getSubNodeNames() : array {
        return [
            'name',
        ];
    }
    
    /**
     * Get identifier as string.
     *
     * @psalm-return non-empty-string
     * @return string Identifier as string.
     */
    public function toString() : string {
        return $this->name;
    }
    
    /**
     * Get lowercased identifier as string.
     *
     * @psalm-return non-empty-string
     * @return string Lowercased identifier as string
     */
    public function toLowerString() : string {
        return strtolower($this->name);
    }
    
    /**
     * Checks whether the identifier is a special class name (self, parent or static).
     *
     * @return bool Whether identifier is a special class name
     */
    public function isSpecialClassName() : bool {
        return isset(self::$specialClassNames[strtolower($this->name)]);
    }
    
    /**
     * Get identifier as string.
     *
     * @psalm-return non-empty-string
     * @return string Identifier as string
     */
    public function __toString() : string {
        return $this->name;
    }
    public function getType() : string {
        return 'Identifier';
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title Overrides
Identifier::$name public property @psalm-var non-empty-string
Identifier::$specialClassNames private static property @var array&lt;string, bool&gt;
Identifier::getSubNodeNames public function Gets the names of the sub nodes. Overrides Node::getSubNodeNames
Identifier::getType public function Gets the type of the node. Overrides Node::getType 1
Identifier::isSpecialClassName public function Checks whether the identifier is a special class name (self, parent or static).
Identifier::toLowerString public function Get lowercased identifier as string.
Identifier::toString public function Get identifier as string.
Identifier::__construct public function Constructs an identifier node. Overrides NodeAbstract::__construct
Identifier::__toString public function Get identifier as string.
NodeAbstract::$attributes protected property @var array&lt;string, mixed&gt; Attributes
NodeAbstract::getAttribute public function Returns the value of an attribute. Overrides Node::getAttribute
NodeAbstract::getAttributes public function Returns all the attributes of this node. Overrides Node::getAttributes
NodeAbstract::getComments public function Gets all comments directly preceding this node. Overrides Node::getComments
NodeAbstract::getDocComment public function Gets the doc comment of the node. Overrides Node::getDocComment
NodeAbstract::getEndFilePos public function Gets the file offset of the last character that is part of this node. Overrides Node::getEndFilePos
NodeAbstract::getEndLine public function Gets the line the node ended in. Overrides Node::getEndLine
NodeAbstract::getEndTokenPos public function Gets the token offset of the last token that is part of this node. Overrides Node::getEndTokenPos
NodeAbstract::getLine public function Gets line the node started in (alias of getStartLine). Overrides Node::getLine
NodeAbstract::getStartFilePos public function Gets the file offset of the first character that is part of this node. Overrides Node::getStartFilePos
NodeAbstract::getStartLine public function Gets line the node started in. Overrides Node::getStartLine
NodeAbstract::getStartTokenPos public function Gets the token offset of the first token that is part of this node. Overrides Node::getStartTokenPos
NodeAbstract::hasAttribute public function Returns whether an attribute exists. Overrides Node::hasAttribute
NodeAbstract::jsonSerialize public function
NodeAbstract::setAttribute public function Sets an attribute on a node. Overrides Node::setAttribute
NodeAbstract::setAttributes public function Replaces all the attributes of this node. Overrides Node::setAttributes
NodeAbstract::setDocComment public function Sets the doc comment of the node. Overrides Node::setDocComment

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal