New_.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. {
  9. /** @var Node\Name|Expr|Node\Stmt\Class_ Class name */
  10. public $class;
  11. /** @var array<Arg|VariadicPlaceholder> Arguments */
  12. public $args;
  13. /**
  14. * Constructs a function call node.
  15. *
  16. * @param Node\Name|Expr|Node\Stmt\Class_ $class Class name (or class node for anonymous classes)
  17. * @param array<Arg|VariadicPlaceholder> $args Arguments
  18. * @param array $attributes Additional attributes
  19. */
  20. public function __construct($class, array $args = [], array $attributes = []) {
  21. $this->attributes = $attributes;
  22. $this->class = $class;
  23. $this->args = $args;
  24. }
  25. public function getSubNodeNames() : array {
  26. return ['class', 'args'];
  27. }
  28. public function getType() : string {
  29. return 'Expr_New';
  30. }
  31. public function getRawArgs(): array {
  32. return $this->args;
  33. }
  34. }