No Description

Ternary.php 985B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php declare(strict_types=1);
  2. namespace PhpParser\Node\Expr;
  3. use PhpParser\Node\Expr;
  4. class Ternary extends Expr
  5. {
  6. /** @var Expr Condition */
  7. public $cond;
  8. /** @var null|Expr Expression for true */
  9. public $if;
  10. /** @var Expr Expression for false */
  11. public $else;
  12. /**
  13. * Constructs a ternary operator node.
  14. *
  15. * @param Expr $cond Condition
  16. * @param null|Expr $if Expression for true
  17. * @param Expr $else Expression for false
  18. * @param array $attributes Additional attributes
  19. */
  20. public function __construct(Expr $cond, $if, Expr $else, array $attributes = []) {
  21. $this->attributes = $attributes;
  22. $this->cond = $cond;
  23. $this->if = $if;
  24. $this->else = $else;
  25. }
  26. public function getSubNodeNames() : array {
  27. return ['cond', 'if', 'else'];
  28. }
  29. public function getType() : string {
  30. return 'Expr_Ternary';
  31. }
  32. }