Skip to content

Commit 3b322df

Browse files
author
Don Tre
committed
Updated docs
added method call with named argument added fluent method call
1 parent 0675a53 commit 3b322df

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

docs/nodes_overview.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1188,6 +1188,40 @@ $this->someProperty->methodName()
11881188

11891189
declare(strict_types=1);
11901190

1191+
use PhpParser\Node\Arg;
1192+
use PhpParser\Node\Expr\MethodCall;
1193+
use PhpParser\Node\Expr\Variable;
1194+
use PhpParser\Node\Identifier;
1195+
use PhpParser\Node\Scalar\String_;
1196+
1197+
$variable = new Variable('someObject');
1198+
1199+
$args = [];
1200+
$args[] = new Arg(new String_('yes'));
1201+
$args[] = new Arg(
1202+
value: new Variable('maybe'),
1203+
name: new Identifier(
1204+
name: 'argName'
1205+
)
1206+
);
1207+
1208+
$call = new MethodCall($variable, 'methodName', $args);
1209+
$callNext = new MethodCall($call, 'nextMethodName');
1210+
```
1211+
1212+
1213+
1214+
```php
1215+
$someObject->methodName('yes', argName: $maybe)->nextMethodName()
1216+
```
1217+
1218+
<br>
1219+
1220+
```php
1221+
<?php
1222+
1223+
declare(strict_types=1);
1224+
11911225
use PhpParser\Node\Arg;
11921226
use PhpParser\Node\Expr\MethodCall;
11931227
use PhpParser\Node\Expr\Variable;

0 commit comments

Comments
 (0)