composer update
This commit is contained in:
29
vendor/nikic/php-parser/test/code/formatPreservation/array_spread.test
vendored
Normal file
29
vendor/nikic/php-parser/test/code/formatPreservation/array_spread.test
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
Array spread
|
||||
-----
|
||||
<?php
|
||||
$items = [
|
||||
...$value
|
||||
];
|
||||
-----
|
||||
$array = $stmts[0]->expr->expr;
|
||||
$array->items[] = new Expr\ArrayItem(new Expr\Variable('b'));
|
||||
-----
|
||||
<?php
|
||||
$items = [
|
||||
...$value, $b
|
||||
];
|
||||
-----
|
||||
<?php
|
||||
$items =
|
||||
[
|
||||
... $value
|
||||
];
|
||||
-----
|
||||
$array = $stmts[0]->expr->expr;
|
||||
$array->items[] = new Expr\ArrayItem(new Expr\Variable('c'), null, false, [], true);
|
||||
-----
|
||||
<?php
|
||||
$items =
|
||||
[
|
||||
... $value, ...$c
|
||||
];
|
||||
97
vendor/nikic/php-parser/test/code/formatPreservation/arrow_function.test
vendored
Normal file
97
vendor/nikic/php-parser/test/code/formatPreservation/arrow_function.test
vendored
Normal file
@@ -0,0 +1,97 @@
|
||||
Arrow function
|
||||
-----
|
||||
<?php
|
||||
fn($a)
|
||||
=>
|
||||
$a;
|
||||
-----
|
||||
$stmts[0]->expr->expr = new Expr\Variable('b');
|
||||
-----
|
||||
<?php
|
||||
fn($a)
|
||||
=>
|
||||
$b;
|
||||
-----
|
||||
<?php
|
||||
fn(
|
||||
$a
|
||||
) => $a;
|
||||
-----
|
||||
$stmts[0]->expr->params[] = new Node\Param(new Expr\Variable('b'));
|
||||
-----
|
||||
<?php
|
||||
fn(
|
||||
$a, $b
|
||||
) => $a;
|
||||
-----
|
||||
<?php
|
||||
fn(
|
||||
$a
|
||||
)
|
||||
=>
|
||||
$a;
|
||||
-----
|
||||
// TODO: Format preserving currently not supported
|
||||
$stmts[0]->expr->params = [];
|
||||
-----
|
||||
<?php
|
||||
fn() => $a;
|
||||
-----
|
||||
<?php
|
||||
fn($a)
|
||||
: int
|
||||
=> $a;
|
||||
-----
|
||||
$stmts[0]->expr->returnType = new Node\Identifier('bool');
|
||||
-----
|
||||
<?php
|
||||
fn($a)
|
||||
: bool
|
||||
=> $a;
|
||||
-----
|
||||
<?php
|
||||
fn($a)
|
||||
: int
|
||||
=> $a;
|
||||
-----
|
||||
$stmts[0]->expr->returnType = null;
|
||||
-----
|
||||
<?php
|
||||
fn($a)
|
||||
=> $a;
|
||||
-----
|
||||
<?php
|
||||
fn($a)
|
||||
: int
|
||||
=> $a;
|
||||
|
||||
static fn($a)
|
||||
: int
|
||||
=> $a;
|
||||
-----
|
||||
// TODO: Format preserving currently not supported
|
||||
$stmts[0]->expr->static = true;
|
||||
$stmts[1]->expr->static = false;
|
||||
-----
|
||||
<?php
|
||||
static fn($a): int => $a;
|
||||
|
||||
fn($a): int => $a;
|
||||
-----
|
||||
<?php
|
||||
fn($a)
|
||||
: int
|
||||
=> $a;
|
||||
|
||||
fn&($a)
|
||||
: int
|
||||
=> $a;
|
||||
-----
|
||||
// TODO: Format preserving currently not supported
|
||||
$stmts[0]->expr->byRef = true;
|
||||
$stmts[1]->expr->byRef = false;
|
||||
-----
|
||||
<?php
|
||||
fn&($a): int => $a;
|
||||
|
||||
fn($a): int => $a;
|
||||
110
vendor/nikic/php-parser/test/code/formatPreservation/emptyListInsertion.test
vendored
Normal file
110
vendor/nikic/php-parser/test/code/formatPreservation/emptyListInsertion.test
vendored
Normal file
@@ -0,0 +1,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 {};
|
||||
@@ -73,13 +73,10 @@ function test($param0, Foo $param1) {}
|
||||
function test() {}
|
||||
-----
|
||||
$stmts[0]->params[] = new Node\Param(new Expr\Variable('param0'));
|
||||
/* Insertion into empty list not handled yet */
|
||||
-----
|
||||
<?php
|
||||
|
||||
function test($param0)
|
||||
{
|
||||
}
|
||||
function test($param0) {}
|
||||
-----
|
||||
<?php
|
||||
|
||||
|
||||
Reference in New Issue
Block a user