1Removing from list nodes
2-----
3<?php $foo; $bar; $baz;
4-----
5array_splice($stmts, 1, 1, []);
6-----
7<?php $foo; $baz;
8-----
9<?php
10function foo(
11    $a,
12    $b,
13    $c
14) {}
15-----
16array_pop($stmts[0]->params);
17-----
18<?php
19function foo(
20    $a,
21    $b
22) {}
23-----
24<?php
25function foo(
26    $a,
27    $b,
28    $c
29) {}
30-----
31array_pop($stmts[0]->params);
32$stmts[0]->params[] = new Node\Param(new Expr\Variable('x'));
33$stmts[0]->params[] = new Node\Param(new Expr\Variable('y'));
34-----
35<?php
36function foo(
37    $a,
38    $b,
39    $x,
40    $y
41) {}
42-----
43<?php
44function test(): A
45|B
46|C {}
47-----
48array_pop($stmts[0]->returnType->types);
49-----
50<?php
51function test(): A
52|B {}
53-----
54<?php $a; $b; $c;
55-----
56array_splice($stmts, 0, 1, []);
57-----
58<?php $b; $c;
59-----
60<?php $a; $b; $c;
61-----
62array_splice($stmts, 0, 2, []);
63-----
64<?php $c;
65-----
66<?php
67{ $x; }
68$y;
69-----
70array_splice($stmts, 0, 1, []);
71-----
72<?php
73$y;
74-----
75<?php
76$x;
77{ $y; }
78-----
79array_splice($stmts, 0, 1, []);
80-----
81<?php
82{ $y; }
83-----
84<?php
85$x;
86{ $y; }
87-----
88array_pop($stmts);
89-----
90<?php
91$x;
92-----
93<?php
94{ $x; }
95$y;
96-----
97array_pop($stmts);
98-----
99<?php
100{ $x; }
101-----
102<?php
103// Foo
104$x;
105$y;
106-----
107array_splice($stmts, 0, 1, []);
108-----
109<?php
110$y;
111-----
112<?php
113
114try {
115
116} catch (\InvalidArgumentException $e) {
117
118} catch (\Exception $e) {
119
120} catch (\LogicException $e) {
121
122} catch (\Throwable $e) {
123
124}
125-----
126$catch = $stmts[0]->catches[2];
127unset($stmts[0]->catches[2]);
128$stmts[0]->catches = array_values($stmts[0]->catches);
129array_splice($stmts[0]->catches, 1, 0, [$catch]);
130-----
131<?php
132
133try {
134
135} catch (\InvalidArgumentException $e) {
136
137} catch (\LogicException $e) {
138
139} catch (\Exception $e) {
140
141} catch (\Throwable $e) {
142
143}
144-----
145<?php
146
147try {
148
149} catch (\InvalidArgumentException $e) {
150
151} catch (\Exception $e) {
152
153} catch (\LogicException $e) {
154
155} catch (\Throwable $e) {
156
157}
158-----
159unset($stmts[0]->catches[2]);
160$stmts[0]->catches = array_values($stmts[0]->catches);
161-----
162<?php
163
164try {
165
166} catch (\InvalidArgumentException $e) {
167
168} catch (\Exception $e) {
169
170} catch (\Throwable $e) {
171
172}
173
174-----
175<?php
176class Foo
177{
178    private $id;
179
180    public function getId()
181    {
182    }
183
184    public function getFoo()
185    {
186    }
187}
188-----
189$stmts[0]->stmts[2] = new Node\Stmt\ClassMethod('getBar');
190$stmts[0]->stmts[3] = new Node\Stmt\ClassMethod('getBaz');
191-----
192<?php
193class Foo
194{
195    private $id;
196
197    public function getId()
198    {
199    }
200    function getBar()
201    {
202    }
203    function getBaz()
204    {
205    }
206}
207-----
208<?php
209class Test {
210    use A, B;
211}
212-----
213unset($stmts[0]->stmts[0]->traits[0]);
214-----
215<?php
216class Test {
217    use B;
218}
219