ClassConstFetch.php 975 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php declare(strict_types=1);
  2. namespace PhpParser\Node\Expr;
  3. use PhpParser\Node\Expr;
  4. use PhpParser\Node\Identifier;
  5. use PhpParser\Node\Name;
  6. class ClassConstFetch extends Expr
  7. {
  8. /** @var Name|Expr Class name */
  9. public $class;
  10. /** @var Identifier|Error Constant name */
  11. public $name;
  12. /**
  13. * Constructs a class const fetch node.
  14. *
  15. * @param Name|Expr $class Class name
  16. * @param string|Identifier|Error $name Constant name
  17. * @param array $attributes Additional attributes
  18. */
  19. public function __construct($class, $name, array $attributes = []) {
  20. $this->attributes = $attributes;
  21. $this->class = $class;
  22. $this->name = \is_string($name) ? new Identifier($name) : $name;
  23. }
  24. public function getSubNodeNames() : array {
  25. return ['class', 'name'];
  26. }
  27. public function getType() : string {
  28. return 'Expr_ClassConstFetch';
  29. }
  30. }