ArrayItem.php 872 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. namespace PhpParser\Node\Expr;
  3. use PhpParser\Node\Expr;
  4. class ArrayItem extends Expr
  5. {
  6. /** @var null|Expr Key */
  7. public $key;
  8. /** @var Expr Value */
  9. public $value;
  10. /** @var bool Whether to assign by reference */
  11. public $byRef;
  12. /**
  13. * Constructs an array item node.
  14. *
  15. * @param Expr $value Value
  16. * @param null|Expr $key Key
  17. * @param bool $byRef Whether to assign by reference
  18. * @param array $attributes Additional attributes
  19. */
  20. public function __construct(Expr $value, Expr $key = null, $byRef = false, array $attributes = array()) {
  21. parent::__construct($attributes);
  22. $this->key = $key;
  23. $this->value = $value;
  24. $this->byRef = $byRef;
  25. }
  26. public function getSubNodeNames() {
  27. return array('key', 'value', 'byRef');
  28. }
  29. }