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
PhpParserCode
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);
}