1<?php declare(strict_types=1); 2 3namespace PhpParser\Node\Stmt\TraitUseAdaptation; 4 5use PhpParser\Node; 6 7class Alias extends Node\Stmt\TraitUseAdaptation { 8 /** @var null|int New modifier */ 9 public ?int $newModifier; 10 /** @var null|Node\Identifier New name */ 11 public ?Node\Identifier $newName; 12 13 /** 14 * Constructs a trait use precedence adaptation node. 15 * 16 * @param null|Node\Name $trait Trait name 17 * @param string|Node\Identifier $method Method name 18 * @param null|int $newModifier New modifier 19 * @param null|string|Node\Identifier $newName New name 20 * @param array<string, mixed> $attributes Additional attributes 21 */ 22 public function __construct(?Node\Name $trait, $method, ?int $newModifier, $newName, array $attributes = []) { 23 $this->attributes = $attributes; 24 $this->trait = $trait; 25 $this->method = \is_string($method) ? new Node\Identifier($method) : $method; 26 $this->newModifier = $newModifier; 27 $this->newName = \is_string($newName) ? new Node\Identifier($newName) : $newName; 28 } 29 30 public function getSubNodeNames(): array { 31 return ['trait', 'method', 'newModifier', 'newName']; 32 } 33 34 public function getType(): string { 35 return 'Stmt_TraitUseAdaptation_Alias'; 36 } 37} 38