BinaryOp.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php declare(strict_types=1);
  2. namespace PhpParser\Node\Expr;
  3. use PhpParser\Node\Expr;
  4. abstract class BinaryOp extends Expr
  5. {
  6. /** @var Expr The left hand side expression */
  7. public $left;
  8. /** @var Expr The right hand side expression */
  9. public $right;
  10. /**
  11. * Constructs a binary operator node.
  12. *
  13. * @param Expr $left The left hand side expression
  14. * @param Expr $right The right hand side expression
  15. * @param array $attributes Additional attributes
  16. */
  17. public function __construct(Expr $left, Expr $right, array $attributes = []) {
  18. $this->attributes = $attributes;
  19. $this->left = $left;
  20. $this->right = $right;
  21. }
  22. public function getSubNodeNames() : array {
  23. return ['left', 'right'];
  24. }
  25. /**
  26. * Get the operator sigil for this binary operation.
  27. *
  28. * In the case there are multiple possible sigils for an operator, this method does not
  29. * necessarily return the one used in the parsed code.
  30. *
  31. * @return string
  32. */
  33. abstract public function getOperatorSigil() : string;
  34. }