New_.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php declare(strict_types=1);
  2. namespace PhpParser\Node\Expr;
  3. use PhpParser\Node;
  4. use PhpParser\Node\Arg;
  5. use PhpParser\Node\Expr;
  6. use PhpParser\Node\VariadicPlaceholder;
  7. class New_ extends CallLike {
  8. /** @var Node\Name|Expr|Node\Stmt\Class_ Class name */
  9. public Node $class;
  10. /** @var array<Arg|VariadicPlaceholder> Arguments */
  11. public array $args;
  12. /**
  13. * Constructs a function call node.
  14. *
  15. * @param Node\Name|Expr|Node\Stmt\Class_ $class Class name (or class node for anonymous classes)
  16. * @param array<Arg|VariadicPlaceholder> $args Arguments
  17. * @param array<string, mixed> $attributes Additional attributes
  18. */
  19. public function __construct(Node $class, array $args = [], array $attributes = []) {
  20. $this->attributes = $attributes;
  21. $this->class = $class;
  22. $this->args = $args;
  23. }
  24. public function getSubNodeNames(): array {
  25. return ['class', 'args'];
  26. }
  27. public function getType(): string {
  28. return 'Expr_New';
  29. }
  30. public function getRawArgs(): array {
  31. return $this->args;
  32. }
  33. }