php-parser/test/code/formatPreservation/listRemoval.test
2020-08-23 17:35:37 +02:00

114 lines
1.2 KiB
Plaintext

Removing from list nodes
-----
<?php $foo; $bar; $baz;
-----
array_splice($stmts, 1, 1, []);
-----
<?php $foo; $baz;
-----
<?php
function foo(
$a,
$b,
$c
) {}
-----
array_pop($stmts[0]->params);
-----
<?php
function foo(
$a,
$b
) {}
-----
<?php
function foo(
$a,
$b,
$c
) {}
-----
array_pop($stmts[0]->params);
$stmts[0]->params[] = new Node\Param(new Expr\Variable('x'));
$stmts[0]->params[] = new Node\Param(new Expr\Variable('y'));
-----
<?php
function foo(
$a,
$b,
$x,
$y
) {}
-----
<?php
function test(): A
|B
|C {}
-----
array_pop($stmts[0]->returnType->types);
-----
<?php
function test(): A
|B {}
-----
<?php $a; $b; $c;
-----
array_splice($stmts, 0, 1, []);
-----
<?php $b; $c;
-----
<?php $a; $b; $c;
-----
array_splice($stmts, 0, 2, []);
-----
<?php $c;
-----
<?php
{ $x; }
$y;
-----
array_splice($stmts, 0, 1, []);
-----
<?php
$y;
-----
<?php
$x;
{ $y; }
-----
array_splice($stmts, 0, 1, []);
-----
<?php
$y;
-----
<?php
$x;
{ $y; }
-----
array_pop($stmts);
-----
<?php
$x;
-----
<?php
{ $x; }
$y;
-----
array_pop($stmts);
-----
<?php
$x;
-----
<?php
// Foo
$x;
$y;
-----
array_splice($stmts, 0, 1, []);
-----
<?php
$y;