No Description

Const_.php 971B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php declare(strict_types=1);
  2. namespace PhpParser\Node;
  3. use PhpParser\NodeAbstract;
  4. class Const_ extends NodeAbstract
  5. {
  6. /** @var Identifier Name */
  7. public $name;
  8. /** @var Expr Value */
  9. public $value;
  10. /** @var Name Namespaced name (if using NameResolver) */
  11. public $namespacedName;
  12. /**
  13. * Constructs a const node for use in class const and const statements.
  14. *
  15. * @param string|Identifier $name Name
  16. * @param Expr $value Value
  17. * @param array $attributes Additional attributes
  18. */
  19. public function __construct($name, Expr $value, array $attributes = []) {
  20. $this->attributes = $attributes;
  21. $this->name = \is_string($name) ? new Identifier($name) : $name;
  22. $this->value = $value;
  23. }
  24. public function getSubNodeNames() : array {
  25. return ['name', 'value'];
  26. }
  27. public function getType() : string {
  28. return 'Const';
  29. }
  30. }