Array_.php 831 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php declare(strict_types=1);
  2. namespace PhpParser\Node\Expr;
  3. use PhpParser\Node\ArrayItem;
  4. use PhpParser\Node\Expr;
  5. class Array_ extends Expr {
  6. // For use in "kind" attribute
  7. public const KIND_LONG = 1; // array() syntax
  8. public const KIND_SHORT = 2; // [] syntax
  9. /** @var ArrayItem[] Items */
  10. public array $items;
  11. /**
  12. * Constructs an array node.
  13. *
  14. * @param ArrayItem[] $items Items of the array
  15. * @param array<string, mixed> $attributes Additional attributes
  16. */
  17. public function __construct(array $items = [], array $attributes = []) {
  18. $this->attributes = $attributes;
  19. $this->items = $items;
  20. }
  21. public function getSubNodeNames(): array {
  22. return ['items'];
  23. }
  24. public function getType(): string {
  25. return 'Expr_Array';
  26. }
  27. }