1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110
|
Inserting into an empty list
-----
<?php
class
Test {}
interface
Test {}
-----
$stmts[0]->implements[] = new Node\Name('Iface');
$stmts[0]->implements[] = new Node\Name('Iface2');
$stmts[1]->extends[] = new Node\Name('Iface');
$stmts[1]->extends[] = new Node\Name('Iface2');
-----
<?php
class
Test implements Iface, Iface2 {}
interface
Test extends Iface, Iface2 {}
-----
<?php
function test
() {}
class Test {
public function
test
() {}
}
function
() {};
fn()
=> 42;
-----
$stmts[0]->params[] = new Node\Param(new Node\Expr\Variable('a'));
$stmts[0]->params[] = new Node\Param(new Node\Expr\Variable('b'));
$stmts[1]->stmts[0]->params[] = new Node\Param(new Node\Expr\Variable('a'));
$stmts[1]->stmts[0]->params[] = new Node\Param(new Node\Expr\Variable('b'));
$stmts[2]->expr->params[] = new Node\Param(new Node\Expr\Variable('a'));
$stmts[2]->expr->params[] = new Node\Param(new Node\Expr\Variable('b'));
$stmts[2]->expr->uses[] = new Node\Expr\Variable('c');
$stmts[2]->expr->uses[] = new Node\Expr\Variable('d');
$stmts[3]->expr->params[] = new Node\Param(new Node\Expr\Variable('a'));
$stmts[3]->expr->params[] = new Node\Param(new Node\Expr\Variable('b'));
-----
<?php
function test
($a, $b) {}
class Test {
public function
test
($a, $b) {}
}
function
($a, $b) use ($c, $d) {};
fn($a, $b)
=> 42;
-----
<?php
foo
();
$foo->
bar();
Foo
::bar ();
new
Foo
();
new class
()
extends Foo {};
-----
$stmts[0]->expr->args[] = new Node\Expr\Variable('a');
$stmts[0]->expr->args[] = new Node\Expr\Variable('b');
$stmts[1]->expr->args[] = new Node\Expr\Variable('a');
$stmts[1]->expr->args[] = new Node\Expr\Variable('b');
$stmts[2]->expr->args[] = new Node\Expr\Variable('a');
$stmts[2]->expr->args[] = new Node\Expr\Variable('b');
$stmts[3]->expr->args[] = new Node\Expr\Variable('a');
$stmts[3]->expr->args[] = new Node\Expr\Variable('b');
$stmts[4]->expr->args[] = new Node\Expr\Variable('a');
$stmts[4]->expr->args[] = new Node\Expr\Variable('b');
-----
<?php
foo
($a, $b);
$foo->
bar($a, $b);
Foo
::bar ($a, $b);
new
Foo
($a, $b);
new class
($a, $b)
extends Foo {};
|