No Description

NullsafeMethodCall.php 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php declare(strict_types=1);
  2. namespace PhpParser\Node\Expr;
  3. use PhpParser\Node\Arg;
  4. use PhpParser\Node\Expr;
  5. use PhpParser\Node\Identifier;
  6. use PhpParser\Node\VariadicPlaceholder;
  7. class NullsafeMethodCall extends CallLike
  8. {
  9. /** @var Expr Variable holding object */
  10. public $var;
  11. /** @var Identifier|Expr Method name */
  12. public $name;
  13. /** @var array<Arg|VariadicPlaceholder> Arguments */
  14. public $args;
  15. /**
  16. * Constructs a nullsafe method call node.
  17. *
  18. * @param Expr $var Variable holding object
  19. * @param string|Identifier|Expr $name Method name
  20. * @param array<Arg|VariadicPlaceholder> $args Arguments
  21. * @param array $attributes Additional attributes
  22. */
  23. public function __construct(Expr $var, $name, array $args = [], array $attributes = []) {
  24. $this->attributes = $attributes;
  25. $this->var = $var;
  26. $this->name = \is_string($name) ? new Identifier($name) : $name;
  27. $this->args = $args;
  28. }
  29. public function getSubNodeNames() : array {
  30. return ['var', 'name', 'args'];
  31. }
  32. public function getType() : string {
  33. return 'Expr_NullsafeMethodCall';
  34. }
  35. public function getRawArgs(): array {
  36. return $this->args;
  37. }
  38. }