mirror of
https://github.com/phabelio/PHP-Parser.git
synced 2024-11-26 12:04:39 +01:00
Make NullsafeMethodCall extend from CallLike
This commit is contained in:
parent
6f1f206862
commit
4122ff3a91
@ -5,23 +5,24 @@ namespace PhpParser\Node\Expr;
|
||||
use PhpParser\Node\Arg;
|
||||
use PhpParser\Node\Expr;
|
||||
use PhpParser\Node\Identifier;
|
||||
use PhpParser\Node\VariadicPlaceholder;
|
||||
|
||||
class NullsafeMethodCall extends Expr
|
||||
class NullsafeMethodCall extends CallLike
|
||||
{
|
||||
/** @var Expr Variable holding object */
|
||||
public $var;
|
||||
/** @var Identifier|Expr Method name */
|
||||
public $name;
|
||||
/** @var Arg[] Arguments */
|
||||
/** @var array<Arg|VariadicPlaceholder> Arguments */
|
||||
public $args;
|
||||
|
||||
/**
|
||||
* Constructs a nullsafe method call node.
|
||||
*
|
||||
* @param Expr $var Variable holding object
|
||||
* @param string|Identifier|Expr $name Method name
|
||||
* @param Arg[] $args Arguments
|
||||
* @param array $attributes Additional attributes
|
||||
* @param Expr $var Variable holding object
|
||||
* @param string|Identifier|Expr $name Method name
|
||||
* @param array<Arg|VariadicPlaceholder> $args Arguments
|
||||
* @param array $attributes Additional attributes
|
||||
*/
|
||||
public function __construct(Expr $var, $name, array $args = [], array $attributes = []) {
|
||||
$this->attributes = $attributes;
|
||||
@ -37,4 +38,8 @@ class NullsafeMethodCall extends Expr
|
||||
public function getType() : string {
|
||||
return 'Expr_NullsafeMethodCall';
|
||||
}
|
||||
|
||||
public function getRawArgs(): array {
|
||||
return $this->args;
|
||||
}
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ A::foo(...);
|
||||
|
||||
// These are invalid, but accepted on the parser level.
|
||||
new Foo(...);
|
||||
$this?->foo(...);
|
||||
|
||||
#[Foo(...)]
|
||||
function foo() {}
|
||||
@ -75,7 +76,21 @@ array(
|
||||
0: // These are invalid, but accepted on the parser level.
|
||||
)
|
||||
)
|
||||
4: Stmt_Function(
|
||||
4: Stmt_Expression(
|
||||
expr: Expr_NullsafeMethodCall(
|
||||
var: Expr_Variable(
|
||||
name: this
|
||||
)
|
||||
name: Identifier(
|
||||
name: foo
|
||||
)
|
||||
args: array(
|
||||
0: VariadicPlaceholder(
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
5: Stmt_Function(
|
||||
attrGroups: array(
|
||||
0: AttributeGroup(
|
||||
attrs: array(
|
||||
|
Loading…
Reference in New Issue
Block a user