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

Breadcrumb

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

function BuilderHelpers::normalizeNameOrExpr

Normalizes a name: Converts string names to Name nodes, while also allowing expressions.

Parameters

Expr|Name|string $name The name to normalize:

Return value

Name|Expr The normalized name or expression

4 calls to BuilderHelpers::normalizeNameOrExpr()
BuilderFactory::classConstFetch in vendor/nikic/php-parser/lib/PhpParser/BuilderFactory.php
Creates a class constant fetch node.
BuilderFactory::funcCall in vendor/nikic/php-parser/lib/PhpParser/BuilderFactory.php
Creates a function call node.
BuilderFactory::new in vendor/nikic/php-parser/lib/PhpParser/BuilderFactory.php
Creates an object creation 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 137

Class

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

Namespace

PhpParser

Code

public static function normalizeNameOrExpr($name) {
    if ($name instanceof Expr) {
        return $name;
    }
    if (!is_string($name) && !$name instanceof Name) {
        throw new \LogicException('Name must be a string or an instance of Node\\Name or Node\\Expr');
    }
    return self::normalizeName($name);
}

API Navigation

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