StaticVar.php 999 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php declare(strict_types=1);
  2. namespace PhpParser\Node;
  3. use PhpParser\Node;
  4. use PhpParser\NodeAbstract;
  5. class StaticVar extends NodeAbstract {
  6. /** @var Expr\Variable Variable */
  7. public Expr\Variable $var;
  8. /** @var null|Node\Expr Default value */
  9. public ?Expr $default;
  10. /**
  11. * Constructs a static variable node.
  12. *
  13. * @param Expr\Variable $var Name
  14. * @param null|Node\Expr $default Default value
  15. * @param array<string, mixed> $attributes Additional attributes
  16. */
  17. public function __construct(
  18. Expr\Variable $var, ?Node\Expr $default = null, array $attributes = []
  19. ) {
  20. $this->attributes = $attributes;
  21. $this->var = $var;
  22. $this->default = $default;
  23. }
  24. public function getSubNodeNames(): array {
  25. return ['var', 'default'];
  26. }
  27. public function getType(): string {
  28. return 'StaticVar';
  29. }
  30. }
  31. // @deprecated compatibility alias
  32. class_alias(StaticVar::class, Stmt\StaticVar::class);