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