nikic/PHP-Parser · error · LogicException
Cannot set access modifier for not alias adaptation buider
Error message
Cannot set access modifier for not alias adaptation buider
What it means
Error "Cannot set access modifier for not alias adaptation buider" thrown in nikic/PHP-Parser.
Source
Thrown at lib/PhpParser/Builder/TraitUseAdaptation.php:120
if ($this->type !== self::TYPE_PRECEDENCE) {
throw new \LogicException('Cannot add overwritten traits for not precedence adaptation buider');
}
foreach ($traits as $trait) {
$this->insteadof[] = BuilderHelpers::normalizeName($trait);
}
return $this;
}
protected function setModifier(int $modifier): void {
if ($this->type === self::TYPE_UNDEFINED) {
$this->type = self::TYPE_ALIAS;
}
if ($this->type !== self::TYPE_ALIAS) {
throw new \LogicException('Cannot set access modifier for not alias adaptation buider');
}
if (is_null($this->modifier)) {
$this->modifier = $modifier;
} else {
throw new \LogicException('Multiple access type modifiers are not allowed');
}
}
/**
* Returns the built node.
*
* @return Node The built node
*/
public function getNode(): Node {
switch ($this->type) {
case self::TYPE_ALIAS:
return new Stmt\TraitUseAdaptation\Alias($this->trait, $this->method, $this->modifier, $this->alias);View on GitHub (pinned to fbd47f7ebc)
When it happens
Trigger: Thrown at lib/PhpParser/Builder/TraitUseAdaptation.php:120 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/a835d168f8ee6308.
Report an issue: GitHub.