nikic/PHP-Parser · error · LogicException
Unexpected node of type "%s"
Error message
Unexpected node of type "%s"
What it means
Error "Unexpected node of type "%s"" thrown in nikic/PHP-Parser.
Source
Thrown at lib/PhpParser/Builder/Trait_.php:51
* Adds a statement.
*
* @param Stmt|PhpParser\Builder $stmt The statement to add
*
* @return $this The builder instance (for fluid interface)
*/
public function addStmt($stmt) {
$stmt = BuilderHelpers::normalizeNode($stmt);
if ($stmt instanceof Stmt\Property) {
$this->properties[] = $stmt;
} elseif ($stmt instanceof Stmt\ClassMethod) {
$this->methods[] = $stmt;
} elseif ($stmt instanceof Stmt\TraitUse) {
$this->uses[] = $stmt;
} elseif ($stmt instanceof Stmt\ClassConst) {
$this->constants[] = $stmt;
} else {
throw new \LogicException(sprintf('Unexpected node of type "%s"', $stmt->getType()));
}
return $this;
}
/**
* Adds an attribute group.
*
* @param Node\Attribute|Node\AttributeGroup $attribute
*
* @return $this The builder instance (for fluid interface)
*/
public function addAttribute($attribute) {
$this->attributeGroups[] = BuilderHelpers::normalizeAttribute($attribute);
return $this;
}
View on GitHub (pinned to fbd47f7ebc)
When it happens
Trigger: Thrown at lib/PhpParser/Builder/Trait_.php:51 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/b7cb9800aa39654b.
Report an issue: GitHub.