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

Breadcrumb

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

function BuilderHelpers::normalizeIdentifierOrExpr

Normalizes strings to Identifier, also allowing expressions.

Parameters

string|Identifier|Expr $name The identifier to normalize:

Return value

Identifier|Expr The normalized identifier or expression

4 calls to BuilderHelpers::normalizeIdentifierOrExpr()
BuilderFactory::classConstFetch in vendor/nikic/php-parser/lib/PhpParser/BuilderFactory.php
Creates a class constant fetch node.
BuilderFactory::methodCall in vendor/nikic/php-parser/lib/PhpParser/BuilderFactory.php
Creates a method call node.
BuilderFactory::propertyFetch in vendor/nikic/php-parser/lib/PhpParser/BuilderFactory.php
Creates a property fetch node.
BuilderFactory::staticCall in vendor/nikic/php-parser/lib/PhpParser/BuilderFactory.php
Creates a static method call node.

File

vendor/nikic/php-parser/lib/PhpParser/BuilderHelpers.php, line 87

Class

BuilderHelpers
This class defines helpers used in the implementation of builders. Don't use it directly.

Namespace

PhpParser

Code

public static function normalizeIdentifierOrExpr($name) {
    if ($name instanceof Identifier || $name instanceof Expr) {
        return $name;
    }
    if (\is_string($name)) {
        return new Identifier($name);
    }
    throw new \LogicException('Expected string or instance of Node\\Identifier or Node\\Expr');
}

API Navigation

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