StaticPropertyFetch.php 1.0 KB

123456789101112131415161718192021222324252627282930313233343536
  1. <?php declare(strict_types=1);
  2. namespace PhpParser\Node\Expr;
  3. use PhpParser\Node\Expr;
  4. use PhpParser\Node\Name;
  5. use PhpParser\Node\VarLikeIdentifier;
  6. class StaticPropertyFetch extends Expr
  7. {
  8. /** @var Name|Expr Class name */
  9. public $class;
  10. /** @var VarLikeIdentifier|Expr Property name */
  11. public $name;
  12. /**
  13. * Constructs a static property fetch node.
  14. *
  15. * @param Name|Expr $class Class name
  16. * @param string|VarLikeIdentifier|Expr $name Property 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 VarLikeIdentifier($name) : $name;
  23. }
  24. public function getSubNodeNames() : array {
  25. return ['class', 'name'];
  26. }
  27. public function getType() : string {
  28. return 'Expr_StaticPropertyFetch';
  29. }
  30. }