nikic/PHP-Parser · error · LogicException
Expected string or instance of Node\Identifier
Error message
Expected string or instance of Node\Identifier
What it means
Error "Expected string or instance of Node\Identifier" thrown in nikic/PHP-Parser.
Source
Thrown at lib/PhpParser/BuilderHelpers.php:77
}
/**
* Normalizes strings to Identifier.
*
* @param string|Identifier $name The identifier to normalize
*
* @return Identifier The normalized identifier
*/
public static function normalizeIdentifier($name): Identifier {
if ($name instanceof Identifier) {
return $name;
}
if (\is_string($name)) {
return new Identifier($name);
}
throw new \LogicException('Expected string or instance of Node\Identifier');
}
/**
* Normalizes strings to Identifier, also allowing expressions.
*
* @param string|Identifier|Expr $name The identifier to normalize
*
* @return Identifier|Expr The normalized identifier or expression
*/
public static function normalizeIdentifierOrExpr($name) {
if ($name instanceof Identifier || $name instanceof Expr) {
return $name;
}
if (\is_string($name)) {
return new Identifier($name);
}
View on GitHub (pinned to fbd47f7ebc)
When it happens
Trigger: Thrown at lib/PhpParser/BuilderHelpers.php:77 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of nikic/PHP-Parser@fbd47f7ebc (2026-08-17).
Data as JSON: /api/errors/b0f2a6ba5893c2a6.
Report an issue: GitHub.