First commit
This commit is contained in:
commit
c6e2478c40
13918 changed files with 2303184 additions and 0 deletions
67
vendor/nikic/php-parser/test/code/prettyPrinter/comments.test
vendored
Normal file
67
vendor/nikic/php-parser/test/code/prettyPrinter/comments.test
vendored
Normal file
|
@ -0,0 +1,67 @@
|
|||
Comments
|
||||
-----
|
||||
<?php
|
||||
|
||||
function justForIndentation()
|
||||
{
|
||||
// Some text
|
||||
# Some text
|
||||
/* Some text */
|
||||
/** Some text */
|
||||
/**
|
||||
* Some text.
|
||||
* Some more text.
|
||||
*/
|
||||
/*
|
||||
* Some text.
|
||||
* Some more text.
|
||||
*/
|
||||
/*
|
||||
Some text.
|
||||
Some more text.
|
||||
*/
|
||||
/* Some text.
|
||||
More text. */
|
||||
/* Some text.
|
||||
More text.
|
||||
Even more text. */
|
||||
$foo;
|
||||
}
|
||||
-----
|
||||
function justForIndentation()
|
||||
{
|
||||
// Some text
|
||||
# Some text
|
||||
/* Some text */
|
||||
/** Some text */
|
||||
/**
|
||||
* Some text.
|
||||
* Some more text.
|
||||
*/
|
||||
/*
|
||||
* Some text.
|
||||
* Some more text.
|
||||
*/
|
||||
/*
|
||||
Some text.
|
||||
Some more text.
|
||||
*/
|
||||
/* Some text.
|
||||
More text. */
|
||||
/* Some text.
|
||||
More text.
|
||||
Even more text. */
|
||||
$foo;
|
||||
}
|
||||
-----
|
||||
<?php
|
||||
|
||||
function test()
|
||||
{
|
||||
// empty
|
||||
}
|
||||
-----
|
||||
function test()
|
||||
{
|
||||
// empty
|
||||
}
|
53
vendor/nikic/php-parser/test/code/prettyPrinter/commentsInCommaList.test
vendored
Normal file
53
vendor/nikic/php-parser/test/code/prettyPrinter/commentsInCommaList.test
vendored
Normal file
|
@ -0,0 +1,53 @@
|
|||
Comments in arrays and function calls
|
||||
-----
|
||||
<?php
|
||||
|
||||
$arr = [
|
||||
// Foo
|
||||
$foo,
|
||||
// Bar
|
||||
$bar,
|
||||
// Discarded
|
||||
];
|
||||
[
|
||||
// Foo
|
||||
$foo,
|
||||
,
|
||||
// Bar
|
||||
$bar,
|
||||
] = $arr;
|
||||
foo(
|
||||
// Foo
|
||||
$foo,
|
||||
// Bar
|
||||
$bar
|
||||
);
|
||||
new Foo(
|
||||
// Foo
|
||||
$foo
|
||||
);
|
||||
-----
|
||||
!!php7
|
||||
$arr = [
|
||||
// Foo
|
||||
$foo,
|
||||
// Bar
|
||||
$bar,
|
||||
];
|
||||
[
|
||||
// Foo
|
||||
$foo,
|
||||
,
|
||||
// Bar
|
||||
$bar,
|
||||
] = $arr;
|
||||
foo(
|
||||
// Foo
|
||||
$foo,
|
||||
// Bar
|
||||
$bar
|
||||
);
|
||||
new Foo(
|
||||
// Foo
|
||||
$foo
|
||||
);
|
27
vendor/nikic/php-parser/test/code/prettyPrinter/expr/anonymousClass.test
vendored
Normal file
27
vendor/nikic/php-parser/test/code/prettyPrinter/expr/anonymousClass.test
vendored
Normal file
|
@ -0,0 +1,27 @@
|
|||
Anonymous classes
|
||||
-----
|
||||
<?php
|
||||
|
||||
new class {};
|
||||
new class extends A implements B, C {};
|
||||
new class($a) extends A {
|
||||
private $a;
|
||||
public function __construct($a) {
|
||||
$this->a = $a;
|
||||
}
|
||||
};
|
||||
-----
|
||||
new class
|
||||
{
|
||||
};
|
||||
new class extends A implements B, C
|
||||
{
|
||||
};
|
||||
new class($a) extends A
|
||||
{
|
||||
private $a;
|
||||
public function __construct($a)
|
||||
{
|
||||
$this->a = $a;
|
||||
}
|
||||
};
|
14
vendor/nikic/php-parser/test/code/prettyPrinter/expr/arrayDestructuring.test
vendored
Normal file
14
vendor/nikic/php-parser/test/code/prettyPrinter/expr/arrayDestructuring.test
vendored
Normal file
|
@ -0,0 +1,14 @@
|
|||
Array destructuring
|
||||
-----
|
||||
<?php
|
||||
|
||||
[$a, $b] = [$c, $d];
|
||||
[, $a, , , $b, ,] = $foo;
|
||||
[, [[$a]], $b] = $bar;
|
||||
['a' => $b, 'b' => $a] = $baz;
|
||||
-----
|
||||
!!php7
|
||||
[$a, $b] = [$c, $d];
|
||||
[, $a, , , $b, ] = $foo;
|
||||
[, [[$a]], $b] = $bar;
|
||||
['a' => $b, 'b' => $a] = $baz;
|
13
vendor/nikic/php-parser/test/code/prettyPrinter/expr/call.test
vendored
Normal file
13
vendor/nikic/php-parser/test/code/prettyPrinter/expr/call.test
vendored
Normal file
|
@ -0,0 +1,13 @@
|
|||
Calls
|
||||
-----
|
||||
<?php
|
||||
|
||||
f($a);
|
||||
f(&$a);
|
||||
f(...$a);
|
||||
f($a, &$b, ...$c);
|
||||
-----
|
||||
f($a);
|
||||
f(&$a);
|
||||
f(...$a);
|
||||
f($a, &$b, ...$c);
|
18
vendor/nikic/php-parser/test/code/prettyPrinter/expr/closure.test
vendored
Normal file
18
vendor/nikic/php-parser/test/code/prettyPrinter/expr/closure.test
vendored
Normal file
|
@ -0,0 +1,18 @@
|
|||
Closures
|
||||
-----
|
||||
<?php
|
||||
|
||||
$closureWithArgs = function ($arg1, $arg2) {
|
||||
$comment = 'closure body';
|
||||
};
|
||||
|
||||
$closureWithArgsAndVars = function ($arg1, $arg2) use($var1, $var2) {
|
||||
$comment = 'closure body';
|
||||
};
|
||||
-----
|
||||
$closureWithArgs = function ($arg1, $arg2) {
|
||||
$comment = 'closure body';
|
||||
};
|
||||
$closureWithArgsAndVars = function ($arg1, $arg2) use($var1, $var2) {
|
||||
$comment = 'closure body';
|
||||
};
|
13
vendor/nikic/php-parser/test/code/prettyPrinter/expr/constant_deref.test
vendored
Normal file
13
vendor/nikic/php-parser/test/code/prettyPrinter/expr/constant_deref.test
vendored
Normal file
|
@ -0,0 +1,13 @@
|
|||
Constant/literal dereferencing
|
||||
-----
|
||||
<?php
|
||||
|
||||
FOO[0];
|
||||
FOO::BAR[0];
|
||||
'FOO'[0];
|
||||
array(FOO)[0];
|
||||
-----
|
||||
FOO[0];
|
||||
FOO::BAR[0];
|
||||
'FOO'[0];
|
||||
array(FOO)[0];
|
86
vendor/nikic/php-parser/test/code/prettyPrinter/expr/docStrings.test
vendored
Normal file
86
vendor/nikic/php-parser/test/code/prettyPrinter/expr/docStrings.test
vendored
Normal file
|
@ -0,0 +1,86 @@
|
|||
Literals
|
||||
-----
|
||||
<?php
|
||||
|
||||
<<<'STR'
|
||||
STR;
|
||||
<<<STR
|
||||
STR;
|
||||
|
||||
<<<'STR'
|
||||
A
|
||||
B
|
||||
STR;
|
||||
<<<STR
|
||||
A
|
||||
B
|
||||
STR;
|
||||
|
||||
<<<'STR'
|
||||
a\nb$c
|
||||
STR;
|
||||
<<<STR
|
||||
a\\nb\$c
|
||||
STR;
|
||||
|
||||
<<<STR
|
||||
a$b
|
||||
{$c->d}
|
||||
STR;
|
||||
|
||||
call(
|
||||
<<<STR
|
||||
A
|
||||
STR
|
||||
, <<<STR
|
||||
B
|
||||
STR
|
||||
);
|
||||
|
||||
function test() {
|
||||
<<<STR
|
||||
Foo
|
||||
STR;
|
||||
<<<STR
|
||||
Bar
|
||||
STR;
|
||||
}
|
||||
-----
|
||||
<<<'STR'
|
||||
STR;
|
||||
<<<STR
|
||||
STR;
|
||||
<<<'STR'
|
||||
A
|
||||
B
|
||||
STR;
|
||||
<<<STR
|
||||
A
|
||||
B
|
||||
STR;
|
||||
<<<'STR'
|
||||
a\nb$c
|
||||
STR;
|
||||
<<<STR
|
||||
a\\nb\$c
|
||||
STR;
|
||||
<<<STR
|
||||
a{$b}
|
||||
{$c->d}
|
||||
STR;
|
||||
call(<<<STR
|
||||
A
|
||||
STR
|
||||
, <<<STR
|
||||
B
|
||||
STR
|
||||
);
|
||||
function test()
|
||||
{
|
||||
<<<STR
|
||||
Foo
|
||||
STR;
|
||||
<<<STR
|
||||
Bar
|
||||
STR;
|
||||
}
|
7
vendor/nikic/php-parser/test/code/prettyPrinter/expr/include.test
vendored
Normal file
7
vendor/nikic/php-parser/test/code/prettyPrinter/expr/include.test
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
Include
|
||||
-----
|
||||
<?php
|
||||
|
||||
(include $foo) && (include $bar);
|
||||
-----
|
||||
(include $foo) && (include $bar);
|
29
vendor/nikic/php-parser/test/code/prettyPrinter/expr/intrinsics.test
vendored
Normal file
29
vendor/nikic/php-parser/test/code/prettyPrinter/expr/intrinsics.test
vendored
Normal file
|
@ -0,0 +1,29 @@
|
|||
isset, empty, unset, exit, die, clone, eval
|
||||
-----
|
||||
<?php
|
||||
|
||||
isset($a, $a[$b]);
|
||||
empty($a);
|
||||
empty('foo');
|
||||
unset($a, $a[$b]);
|
||||
exit;
|
||||
exit();
|
||||
exit(1);
|
||||
die;
|
||||
die();
|
||||
die('foo');
|
||||
clone $foo;
|
||||
eval('str');
|
||||
-----
|
||||
isset($a, $a[$b]);
|
||||
empty($a);
|
||||
empty('foo');
|
||||
unset($a, $a[$b]);
|
||||
exit;
|
||||
exit;
|
||||
exit(1);
|
||||
die;
|
||||
die;
|
||||
die('foo');
|
||||
clone $foo;
|
||||
eval('str');
|
19
vendor/nikic/php-parser/test/code/prettyPrinter/expr/list.test
vendored
Normal file
19
vendor/nikic/php-parser/test/code/prettyPrinter/expr/list.test
vendored
Normal file
|
@ -0,0 +1,19 @@
|
|||
list()
|
||||
-----
|
||||
<?php
|
||||
|
||||
list() = $a;
|
||||
list($a) = $b;
|
||||
list($a, $b, $c) = $d;
|
||||
list(, $a) = $b;
|
||||
list(, , $a, , $b) = $c;
|
||||
list(list($a)) = $b;
|
||||
list(, list(, list(, $a), $b)) = $c;
|
||||
-----
|
||||
list() = $a;
|
||||
list($a) = $b;
|
||||
list($a, $b, $c) = $d;
|
||||
list(, $a) = $b;
|
||||
list(, , $a, , $b) = $c;
|
||||
list(list($a)) = $b;
|
||||
list(, list(, list(, $a), $b)) = $c;
|
154
vendor/nikic/php-parser/test/code/prettyPrinter/expr/literals.test
vendored
Normal file
154
vendor/nikic/php-parser/test/code/prettyPrinter/expr/literals.test
vendored
Normal file
|
@ -0,0 +1,154 @@
|
|||
Literals
|
||||
-----
|
||||
<?php
|
||||
|
||||
// magic constants
|
||||
__LINE__;
|
||||
__FILE__;
|
||||
__DIR__;
|
||||
__FUNCTION__;
|
||||
__CLASS__;
|
||||
__TRAIT__;
|
||||
__METHOD__;
|
||||
__NAMESPACE__;
|
||||
|
||||
// not actually literals, but close
|
||||
null;
|
||||
true;
|
||||
false;
|
||||
NULL;
|
||||
TRUE;
|
||||
FALSE;
|
||||
|
||||
// integers (normalized to decimal)
|
||||
0;
|
||||
11;
|
||||
011;
|
||||
0x11;
|
||||
0b11;
|
||||
|
||||
// floats (normalized to ... something)
|
||||
0.;
|
||||
.0;
|
||||
0.0;
|
||||
0e1000;
|
||||
1.0;
|
||||
1e100;
|
||||
1e1000;
|
||||
1E-100;
|
||||
1000000000000000000000000000000000000000000000000000000000000000000000000000000000000;
|
||||
378282246310005.0;
|
||||
10000000000000002.0;
|
||||
|
||||
// strings (single quoted)
|
||||
'a';
|
||||
'a
|
||||
b';
|
||||
"a";
|
||||
"a\nb";
|
||||
'a\'b';
|
||||
|
||||
// strings (double quoted)
|
||||
"a'b";
|
||||
"a\b";
|
||||
"$a";
|
||||
"a$b";
|
||||
"$a$b";
|
||||
"$a $b";
|
||||
"a${b}c";
|
||||
"a{$b}c";
|
||||
"a$a[b]c";
|
||||
"\{$A}";
|
||||
"\{ $A }";
|
||||
"\\{$A}";
|
||||
"\\{ $A }";
|
||||
"{$$A}[B]";
|
||||
"$$A[B]";
|
||||
|
||||
// make sure indentation doesn't mess anything up
|
||||
function foo()
|
||||
{
|
||||
"a\nb";
|
||||
'a
|
||||
b';
|
||||
'a
|
||||
b';
|
||||
}
|
||||
|
||||
// shell exec (similar to double quoted string)
|
||||
`foo`;
|
||||
`foo$a`;
|
||||
`foo{$a}bar`;
|
||||
`\`\'\"`;
|
||||
-----
|
||||
// magic constants
|
||||
__LINE__;
|
||||
__FILE__;
|
||||
__DIR__;
|
||||
__FUNCTION__;
|
||||
__CLASS__;
|
||||
__TRAIT__;
|
||||
__METHOD__;
|
||||
__NAMESPACE__;
|
||||
// not actually literals, but close
|
||||
null;
|
||||
true;
|
||||
false;
|
||||
NULL;
|
||||
TRUE;
|
||||
FALSE;
|
||||
// integers (normalized to decimal)
|
||||
0;
|
||||
11;
|
||||
011;
|
||||
0x11;
|
||||
0b11;
|
||||
// floats (normalized to ... something)
|
||||
0.0;
|
||||
0.0;
|
||||
0.0;
|
||||
0.0;
|
||||
1.0;
|
||||
1.0E+100;
|
||||
\INF;
|
||||
1.0E-100;
|
||||
1.0E+84;
|
||||
378282246310005.0;
|
||||
10000000000000002.0;
|
||||
// strings (single quoted)
|
||||
'a';
|
||||
'a
|
||||
b';
|
||||
"a";
|
||||
"a\nb";
|
||||
'a\'b';
|
||||
// strings (double quoted)
|
||||
"a'b";
|
||||
"a\\b";
|
||||
"{$a}";
|
||||
"a{$b}";
|
||||
"{$a}{$b}";
|
||||
"{$a} {$b}";
|
||||
"a{$b}c";
|
||||
"a{$b}c";
|
||||
"a{$a['b']}c";
|
||||
"\\{{$A}}";
|
||||
"\\{ {$A} }";
|
||||
"\\{$A}";
|
||||
"\\{ {$A} }";
|
||||
"{${$A}}[B]";
|
||||
"\${$A['B']}";
|
||||
// make sure indentation doesn't mess anything up
|
||||
function foo()
|
||||
{
|
||||
"a\nb";
|
||||
'a
|
||||
b';
|
||||
'a
|
||||
b';
|
||||
}
|
||||
// shell exec (similar to double quoted string)
|
||||
`foo`;
|
||||
`foo{$a}`;
|
||||
`foo{$a}bar`;
|
||||
`\`\\'\\"`;
|
35
vendor/nikic/php-parser/test/code/prettyPrinter/expr/numbers.test
vendored
Normal file
35
vendor/nikic/php-parser/test/code/prettyPrinter/expr/numbers.test
vendored
Normal file
|
@ -0,0 +1,35 @@
|
|||
Number literals
|
||||
-----
|
||||
<?php
|
||||
|
||||
0;
|
||||
+0;
|
||||
-0;
|
||||
0.0;
|
||||
-0.0;
|
||||
42;
|
||||
-42;
|
||||
42.0;
|
||||
-42.0;
|
||||
42.5;
|
||||
-42.5;
|
||||
1e42;
|
||||
-1e42;
|
||||
1e1000;
|
||||
-1e1000;
|
||||
-----
|
||||
0;
|
||||
+0;
|
||||
-0;
|
||||
0.0;
|
||||
-0.0;
|
||||
42;
|
||||
-42;
|
||||
42.0;
|
||||
-42.0;
|
||||
42.5;
|
||||
-42.5;
|
||||
1.0E+42;
|
||||
-1.0E+42;
|
||||
\INF;
|
||||
-\INF;
|
144
vendor/nikic/php-parser/test/code/prettyPrinter/expr/operators.test
vendored
Normal file
144
vendor/nikic/php-parser/test/code/prettyPrinter/expr/operators.test
vendored
Normal file
|
@ -0,0 +1,144 @@
|
|||
Basic operators
|
||||
-----
|
||||
<?php
|
||||
|
||||
$a ** $b;
|
||||
|
||||
++$a;
|
||||
--$a;
|
||||
$a++;
|
||||
$a--;
|
||||
|
||||
@$a;
|
||||
~$a;
|
||||
-$a;
|
||||
+$a;
|
||||
|
||||
(int) $a;
|
||||
(integer) $a;
|
||||
(float) $a;
|
||||
(double) $a;
|
||||
(real) $a;
|
||||
(string) $a;
|
||||
(binary) $a;
|
||||
(array) $a;
|
||||
(object) $a;
|
||||
(bool) $a;
|
||||
(boolean) $a;
|
||||
(unset) $a;
|
||||
|
||||
$a * $b;
|
||||
$a / $b;
|
||||
$a % $b;
|
||||
$a + $b;
|
||||
$a - $b;
|
||||
$a . $b;
|
||||
$a << $b;
|
||||
$a >> $b;
|
||||
$a < $b;
|
||||
$a <= $b;
|
||||
$a > $b;
|
||||
$a >= $b;
|
||||
$a == $b;
|
||||
$a != $b;
|
||||
$a <> $b;
|
||||
$a === $b;
|
||||
$a !== $b;
|
||||
$a <=> $b;
|
||||
$a & $b;
|
||||
$a ^ $b;
|
||||
$a | $b;
|
||||
$a && $b;
|
||||
$a || $b;
|
||||
$a ? $b : $c;
|
||||
$a ?: $c;
|
||||
$a ?? $c;
|
||||
|
||||
$a = $b;
|
||||
$a **= $b;
|
||||
$a *= $b;
|
||||
$a /= $b;
|
||||
$a %= $b;
|
||||
$a += $b;
|
||||
$a -= $b;
|
||||
$a .= $b;
|
||||
$a <<= $b;
|
||||
$a >>= $b;
|
||||
$a &= $b;
|
||||
$a ^= $b;
|
||||
$a |= $b;
|
||||
$a =& $b;
|
||||
|
||||
$a and $b;
|
||||
$a xor $b;
|
||||
$a or $b;
|
||||
|
||||
$a instanceof Foo;
|
||||
$a instanceof $b;
|
||||
-----
|
||||
$a ** $b;
|
||||
++$a;
|
||||
--$a;
|
||||
$a++;
|
||||
$a--;
|
||||
@$a;
|
||||
~$a;
|
||||
-$a;
|
||||
+$a;
|
||||
(int) $a;
|
||||
(int) $a;
|
||||
(double) $a;
|
||||
(double) $a;
|
||||
(double) $a;
|
||||
(string) $a;
|
||||
(string) $a;
|
||||
(array) $a;
|
||||
(object) $a;
|
||||
(bool) $a;
|
||||
(bool) $a;
|
||||
(unset) $a;
|
||||
$a * $b;
|
||||
$a / $b;
|
||||
$a % $b;
|
||||
$a + $b;
|
||||
$a - $b;
|
||||
$a . $b;
|
||||
$a << $b;
|
||||
$a >> $b;
|
||||
$a < $b;
|
||||
$a <= $b;
|
||||
$a > $b;
|
||||
$a >= $b;
|
||||
$a == $b;
|
||||
$a != $b;
|
||||
$a != $b;
|
||||
$a === $b;
|
||||
$a !== $b;
|
||||
$a <=> $b;
|
||||
$a & $b;
|
||||
$a ^ $b;
|
||||
$a | $b;
|
||||
$a && $b;
|
||||
$a || $b;
|
||||
$a ? $b : $c;
|
||||
$a ?: $c;
|
||||
$a ?? $c;
|
||||
$a = $b;
|
||||
$a **= $b;
|
||||
$a *= $b;
|
||||
$a /= $b;
|
||||
$a %= $b;
|
||||
$a += $b;
|
||||
$a -= $b;
|
||||
$a .= $b;
|
||||
$a <<= $b;
|
||||
$a >>= $b;
|
||||
$a &= $b;
|
||||
$a ^= $b;
|
||||
$a |= $b;
|
||||
$a =& $b;
|
||||
$a and $b;
|
||||
$a xor $b;
|
||||
$a or $b;
|
||||
$a instanceof Foo;
|
||||
$a instanceof $b;
|
77
vendor/nikic/php-parser/test/code/prettyPrinter/expr/parentheses.test
vendored
Normal file
77
vendor/nikic/php-parser/test/code/prettyPrinter/expr/parentheses.test
vendored
Normal file
|
@ -0,0 +1,77 @@
|
|||
Pretty printer generates least-parentheses output
|
||||
-----
|
||||
<?php
|
||||
|
||||
echo 'abc' . 'cde' . 'fgh';
|
||||
echo 'abc' . ('cde' . 'fgh');
|
||||
|
||||
echo 'abc' . 1 + 2 . 'fgh';
|
||||
echo 'abc' . (1 + 2) . 'fgh';
|
||||
|
||||
echo 1 * 2 + 3 / 4 % 5 . 6;
|
||||
echo 1 * (2 + 3) / (4 % (5 . 6));
|
||||
|
||||
$a = $b = $c = $d = $f && true;
|
||||
($a = $b = $c = $d = $f) && true;
|
||||
$a = $b = $c = $d = $f and true;
|
||||
$a = $b = $c = $d = ($f and true);
|
||||
|
||||
$a ? $b : $c ? $d : $e ? $f : $g;
|
||||
$a ? $b : ($c ? $d : ($e ? $f : $g));
|
||||
$a ? $b ? $c : $d : $f;
|
||||
|
||||
$a ?? $b ?? $c;
|
||||
($a ?? $b) ?? $c;
|
||||
$a ?? ($b ? $c : $d);
|
||||
$a || ($b ?? $c);
|
||||
|
||||
(1 > 0) > (1 < 0);
|
||||
++$a + $b;
|
||||
$a + $b++;
|
||||
|
||||
$a ** $b ** $c;
|
||||
($a ** $b) ** $c;
|
||||
-1 ** 2;
|
||||
|
||||
yield from $a and yield from $b;
|
||||
yield from ($a and yield from $b);
|
||||
|
||||
print ($a and print $b);
|
||||
|
||||
// The following will currently add unnecessary parentheses, because the pretty printer is not aware that assignment
|
||||
// and incdec only work on variables.
|
||||
!$a = $b;
|
||||
++$a ** $b;
|
||||
$a ** $b++;
|
||||
-----
|
||||
echo 'abc' . 'cde' . 'fgh';
|
||||
echo 'abc' . ('cde' . 'fgh');
|
||||
echo 'abc' . 1 + 2 . 'fgh';
|
||||
echo 'abc' . (1 + 2) . 'fgh';
|
||||
echo 1 * 2 + 3 / 4 % 5 . 6;
|
||||
echo 1 * (2 + 3) / (4 % (5 . 6));
|
||||
$a = $b = $c = $d = $f && true;
|
||||
($a = $b = $c = $d = $f) && true;
|
||||
$a = $b = $c = $d = $f and true;
|
||||
$a = $b = $c = $d = ($f and true);
|
||||
$a ? $b : $c ? $d : $e ? $f : $g;
|
||||
$a ? $b : ($c ? $d : ($e ? $f : $g));
|
||||
$a ? $b ? $c : $d : $f;
|
||||
$a ?? $b ?? $c;
|
||||
($a ?? $b) ?? $c;
|
||||
$a ?? ($b ? $c : $d);
|
||||
$a || ($b ?? $c);
|
||||
(1 > 0) > (1 < 0);
|
||||
++$a + $b;
|
||||
$a + $b++;
|
||||
$a ** $b ** $c;
|
||||
($a ** $b) ** $c;
|
||||
-1 ** 2;
|
||||
yield from $a and yield from $b;
|
||||
yield from ($a and yield from $b);
|
||||
print ($a and print $b);
|
||||
// The following will currently add unnecessary parentheses, because the pretty printer is not aware that assignment
|
||||
// and incdec only work on variables.
|
||||
!($a = $b);
|
||||
(++$a) ** $b;
|
||||
$a ** ($b++);
|
11
vendor/nikic/php-parser/test/code/prettyPrinter/expr/shortArraySyntax.test
vendored
Normal file
11
vendor/nikic/php-parser/test/code/prettyPrinter/expr/shortArraySyntax.test
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
Short array syntax
|
||||
-----
|
||||
<?php
|
||||
|
||||
[];
|
||||
array(1, 2, 3);
|
||||
['a' => 'b', 'c' => 'd'];
|
||||
-----
|
||||
[];
|
||||
array(1, 2, 3);
|
||||
['a' => 'b', 'c' => 'd'];
|
23
vendor/nikic/php-parser/test/code/prettyPrinter/expr/stringEscaping.test
vendored
Normal file
23
vendor/nikic/php-parser/test/code/prettyPrinter/expr/stringEscaping.test
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
Escape sequences in double-quoted strings
|
||||
-----
|
||||
<?php
|
||||
"\n\r\t\f\v\$\"\\";
|
||||
"@@{ implode(range("\0", "\37")) }@@";
|
||||
"\0000\0001";
|
||||
|
||||
<<<DOC
|
||||
\n\r\t\f\v\$\"\\
|
||||
@@{ implode(range("\0", "\37")) }@@
|
||||
\0000\0001
|
||||
DOC;
|
||||
|
||||
-----
|
||||
"\n\r\t\f\v\$\"\\";
|
||||
"\0\1\2\3\4\5\6\7\10\t\n\v\f\r\16\17\20\21\22\23\24\25\26\27\30\31\32\33\34\35\36\37";
|
||||
"\0000\0001";
|
||||
<<<DOC
|
||||
@@{ "\n\r" }@@\t\f\v\$\\"\\
|
||||
\0\1\2\3\4\5\6\7\10\t@@{ "\n" }@@\v\f@@{ "\r" }@@\16\17\20\21\22\23\24\25\26\27\30\31\32\33\34\35\36\37
|
||||
\0000\0001
|
||||
DOC
|
||||
;
|
23
vendor/nikic/php-parser/test/code/prettyPrinter/expr/uvs.test
vendored
Normal file
23
vendor/nikic/php-parser/test/code/prettyPrinter/expr/uvs.test
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
Uniform variable syntax
|
||||
-----
|
||||
<?php
|
||||
|
||||
(function() {})();
|
||||
array('a', 'b')()();
|
||||
A::$b::$c;
|
||||
$A::$b[$c]();
|
||||
$A::{$b[$c]}();
|
||||
A::$$b[$c]();
|
||||
($a->b)();
|
||||
(A::$b)();
|
||||
-----
|
||||
!!php7
|
||||
(function () {
|
||||
})();
|
||||
array('a', 'b')()();
|
||||
A::$b::$c;
|
||||
$A::$b[$c]();
|
||||
$A::{$b[$c]}();
|
||||
A::${$b}[$c]();
|
||||
($a->b)();
|
||||
(A::$b)();
|
73
vendor/nikic/php-parser/test/code/prettyPrinter/expr/variables.test
vendored
Normal file
73
vendor/nikic/php-parser/test/code/prettyPrinter/expr/variables.test
vendored
Normal file
|
@ -0,0 +1,73 @@
|
|||
Variables
|
||||
-----
|
||||
<?php
|
||||
|
||||
$a;
|
||||
$$a;
|
||||
${$a};
|
||||
$a->b;
|
||||
$a->b();
|
||||
$a->b($c);
|
||||
$a->$b();
|
||||
$a->{$b}();
|
||||
$a->$b[$c]();
|
||||
$$a->b;
|
||||
$a[$b];
|
||||
$a[$b]();
|
||||
$$a[$b];
|
||||
$a::B;
|
||||
$a::$b;
|
||||
$a::b();
|
||||
$a::b($c);
|
||||
$a::$b();
|
||||
$a::$b[$c];
|
||||
$a::$b[$c]($d);
|
||||
$a::{$b[$c]}($d);
|
||||
$a::{$b->c}();
|
||||
A::$$b[$c]();
|
||||
a();
|
||||
$a();
|
||||
$a()[$b];
|
||||
$a->b()[$c];
|
||||
$a::$b()[$c];
|
||||
(new A)->b;
|
||||
(new A())->b();
|
||||
(new $$a)[$b];
|
||||
(new $a->b)->c;
|
||||
|
||||
global $a, $$a, $$a[$b], $$a->b;
|
||||
-----
|
||||
!!php5
|
||||
$a;
|
||||
${$a};
|
||||
${$a};
|
||||
$a->b;
|
||||
$a->b();
|
||||
$a->b($c);
|
||||
$a->{$b}();
|
||||
$a->{$b}();
|
||||
$a->{$b[$c]}();
|
||||
${$a}->b;
|
||||
$a[$b];
|
||||
$a[$b]();
|
||||
${$a[$b]};
|
||||
$a::B;
|
||||
$a::$b;
|
||||
$a::b();
|
||||
$a::b($c);
|
||||
$a::$b();
|
||||
$a::$b[$c];
|
||||
$a::{$b[$c]}($d);
|
||||
$a::{$b[$c]}($d);
|
||||
$a::{$b->c}();
|
||||
A::${$b[$c]}();
|
||||
a();
|
||||
$a();
|
||||
$a()[$b];
|
||||
$a->b()[$c];
|
||||
$a::$b()[$c];
|
||||
(new A())->b;
|
||||
(new A())->b();
|
||||
(new ${$a}())[$b];
|
||||
(new $a->b())->c;
|
||||
global $a, ${$a}, ${$a[$b]}, ${$a->b};
|
46
vendor/nikic/php-parser/test/code/prettyPrinter/expr/yield.test
vendored
Normal file
46
vendor/nikic/php-parser/test/code/prettyPrinter/expr/yield.test
vendored
Normal file
|
@ -0,0 +1,46 @@
|
|||
Yield
|
||||
-----
|
||||
<?php
|
||||
|
||||
function gen()
|
||||
{
|
||||
yield;
|
||||
yield $a;
|
||||
yield $a => $b;
|
||||
$a = yield;
|
||||
$a = (yield $b);
|
||||
$a = (yield $b => $c);
|
||||
}
|
||||
// TODO Get rid of parens for cases 2 and 3
|
||||
-----
|
||||
function gen()
|
||||
{
|
||||
yield;
|
||||
(yield $a);
|
||||
(yield $a => $b);
|
||||
$a = yield;
|
||||
$a = (yield $b);
|
||||
$a = (yield $b => $c);
|
||||
}
|
||||
// TODO Get rid of parens for cases 2 and 3
|
||||
-----
|
||||
<?php
|
||||
|
||||
function gen()
|
||||
{
|
||||
$a = yield $b;
|
||||
$a = yield $b => $c;
|
||||
yield from $a;
|
||||
$a = yield from $b;
|
||||
}
|
||||
// TODO Get rid of parens for last case
|
||||
-----
|
||||
!!php7
|
||||
function gen()
|
||||
{
|
||||
$a = (yield $b);
|
||||
$a = (yield $b => $c);
|
||||
yield from $a;
|
||||
$a = (yield from $b);
|
||||
}
|
||||
// TODO Get rid of parens for last case
|
58
vendor/nikic/php-parser/test/code/prettyPrinter/inlineHTMLandPHPtest.file-test
vendored
Normal file
58
vendor/nikic/php-parser/test/code/prettyPrinter/inlineHTMLandPHPtest.file-test
vendored
Normal file
|
@ -0,0 +1,58 @@
|
|||
File containing both inline HTML and PHP
|
||||
-----
|
||||
HTML
|
||||
<?php
|
||||
echo 'PHP';
|
||||
-----
|
||||
HTML
|
||||
<?php
|
||||
echo 'PHP';
|
||||
-----
|
||||
<?php
|
||||
echo 'PHP';
|
||||
?>
|
||||
HTML
|
||||
-----
|
||||
<?php
|
||||
|
||||
echo 'PHP';
|
||||
?>
|
||||
HTML
|
||||
-----
|
||||
HTML
|
||||
<?php
|
||||
echo 'PHP';
|
||||
?>
|
||||
HTML
|
||||
-----
|
||||
HTML
|
||||
<?php
|
||||
echo 'PHP';
|
||||
?>
|
||||
HTML
|
||||
-----
|
||||
HTML
|
||||
<?php
|
||||
echo 'PHP';
|
||||
?>
|
||||
HTML
|
||||
<?php
|
||||
echo 'PHP';
|
||||
?>
|
||||
HTML
|
||||
-----
|
||||
HTML
|
||||
<?php
|
||||
echo 'PHP';
|
||||
?>
|
||||
HTML
|
||||
<?php
|
||||
echo 'PHP';
|
||||
?>
|
||||
HTML
|
||||
-----
|
||||
HTML<?php echo 'PHP'; ?>HTML
|
||||
-----
|
||||
HTML<?php
|
||||
echo 'PHP';
|
||||
?>HTML
|
19
vendor/nikic/php-parser/test/code/prettyPrinter/onlyInlineHTML.file-test
vendored
Normal file
19
vendor/nikic/php-parser/test/code/prettyPrinter/onlyInlineHTML.file-test
vendored
Normal file
|
@ -0,0 +1,19 @@
|
|||
File containing only inline HTML
|
||||
-----
|
||||
Hallo World
|
||||
Foo Bar
|
||||
Bar Foo
|
||||
World Hallo
|
||||
-----
|
||||
Hallo World
|
||||
Foo Bar
|
||||
Bar Foo
|
||||
World Hallo
|
||||
-----
|
||||
|
||||
|
||||
Test
|
||||
-----
|
||||
|
||||
|
||||
Test
|
16
vendor/nikic/php-parser/test/code/prettyPrinter/onlyPHP.file-test
vendored
Normal file
16
vendor/nikic/php-parser/test/code/prettyPrinter/onlyPHP.file-test
vendored
Normal file
|
@ -0,0 +1,16 @@
|
|||
File containing only PHP
|
||||
-----
|
||||
<?php
|
||||
|
||||
echo 'Foo Bar';
|
||||
echo 'Bar Foo';
|
||||
-----
|
||||
<?php
|
||||
|
||||
echo 'Foo Bar';
|
||||
echo 'Bar Foo';
|
||||
-----
|
||||
<?php
|
||||
|
||||
-----
|
||||
<?php
|
20
vendor/nikic/php-parser/test/code/prettyPrinter/stmt/alias.test
vendored
Normal file
20
vendor/nikic/php-parser/test/code/prettyPrinter/stmt/alias.test
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
Aliases (namespacing)
|
||||
-----
|
||||
<?php
|
||||
|
||||
use A\B;
|
||||
use C\D as E;
|
||||
use F\G as H, J;
|
||||
|
||||
use function foo\bar;
|
||||
use function foo\bar as baz;
|
||||
use const foo\BAR;
|
||||
use const foo\BAR as BAZ;
|
||||
-----
|
||||
use A\B;
|
||||
use C\D as E;
|
||||
use F\G as H, J;
|
||||
use function foo\bar;
|
||||
use function foo\bar as baz;
|
||||
use const foo\BAR;
|
||||
use const foo\BAR as BAZ;
|
13
vendor/nikic/php-parser/test/code/prettyPrinter/stmt/break_continue.test
vendored
Normal file
13
vendor/nikic/php-parser/test/code/prettyPrinter/stmt/break_continue.test
vendored
Normal file
|
@ -0,0 +1,13 @@
|
|||
break/continue
|
||||
-----
|
||||
<?php
|
||||
|
||||
continue;
|
||||
continue 2;
|
||||
break;
|
||||
break 2;
|
||||
-----
|
||||
continue;
|
||||
continue 2;
|
||||
break;
|
||||
break 2;
|
53
vendor/nikic/php-parser/test/code/prettyPrinter/stmt/class.test
vendored
Normal file
53
vendor/nikic/php-parser/test/code/prettyPrinter/stmt/class.test
vendored
Normal file
|
@ -0,0 +1,53 @@
|
|||
Class
|
||||
-----
|
||||
<?php
|
||||
|
||||
class Foo extends Bar implements ABC, \DEF, namespace\GHI
|
||||
{
|
||||
var $a = 'foo';
|
||||
private $b = 'bar';
|
||||
static $c = 'baz';
|
||||
function test()
|
||||
{
|
||||
$this->a = 'bar';
|
||||
echo 'test';
|
||||
}
|
||||
|
||||
protected function baz() {}
|
||||
public function foo() {}
|
||||
abstract static function bar() {}
|
||||
}
|
||||
|
||||
trait Bar
|
||||
{
|
||||
function test()
|
||||
{
|
||||
}
|
||||
}
|
||||
-----
|
||||
class Foo extends Bar implements ABC, \DEF, namespace\GHI
|
||||
{
|
||||
var $a = 'foo';
|
||||
private $b = 'bar';
|
||||
static $c = 'baz';
|
||||
function test()
|
||||
{
|
||||
$this->a = 'bar';
|
||||
echo 'test';
|
||||
}
|
||||
protected function baz()
|
||||
{
|
||||
}
|
||||
public function foo()
|
||||
{
|
||||
}
|
||||
static abstract function bar()
|
||||
{
|
||||
}
|
||||
}
|
||||
trait Bar
|
||||
{
|
||||
function test()
|
||||
{
|
||||
}
|
||||
}
|
20
vendor/nikic/php-parser/test/code/prettyPrinter/stmt/class_const.test
vendored
Normal file
20
vendor/nikic/php-parser/test/code/prettyPrinter/stmt/class_const.test
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
Class constants
|
||||
-----
|
||||
<?php
|
||||
|
||||
class Foo
|
||||
{
|
||||
const A = 1, B = 2;
|
||||
public const C = 3, D = 4;
|
||||
protected const E = 5, F = 6;
|
||||
private const G = 7, H = 8;
|
||||
}
|
||||
-----
|
||||
!!php7
|
||||
class Foo
|
||||
{
|
||||
const A = 1, B = 2;
|
||||
public const C = 3, D = 4;
|
||||
protected const E = 5, F = 6;
|
||||
private const G = 7, H = 8;
|
||||
}
|
11
vendor/nikic/php-parser/test/code/prettyPrinter/stmt/const.test
vendored
Normal file
11
vendor/nikic/php-parser/test/code/prettyPrinter/stmt/const.test
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
Constant declarations
|
||||
-----
|
||||
<?php
|
||||
|
||||
const FOO = 'BAR';
|
||||
const FOO = 1 + 1;
|
||||
const FOO = BAR, BAR = FOO;
|
||||
-----
|
||||
const FOO = 'BAR';
|
||||
const FOO = 1 + 1;
|
||||
const FOO = BAR, BAR = FOO;
|
17
vendor/nikic/php-parser/test/code/prettyPrinter/stmt/declare.test
vendored
Normal file
17
vendor/nikic/php-parser/test/code/prettyPrinter/stmt/declare.test
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
declare
|
||||
-----
|
||||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
declare (ticks=1) {
|
||||
foo();
|
||||
}
|
||||
declare (ticks=2) {
|
||||
}
|
||||
-----
|
||||
declare (strict_types=1);
|
||||
declare (ticks=1) {
|
||||
foo();
|
||||
}
|
||||
declare (ticks=2) {
|
||||
}
|
10
vendor/nikic/php-parser/test/code/prettyPrinter/stmt/do_while.test
vendored
Normal file
10
vendor/nikic/php-parser/test/code/prettyPrinter/stmt/do_while.test
vendored
Normal file
|
@ -0,0 +1,10 @@
|
|||
doWhile
|
||||
-----
|
||||
<?php
|
||||
|
||||
do {
|
||||
|
||||
} while (true);
|
||||
-----
|
||||
do {
|
||||
} while (true);
|
28
vendor/nikic/php-parser/test/code/prettyPrinter/stmt/for.test
vendored
Normal file
28
vendor/nikic/php-parser/test/code/prettyPrinter/stmt/for.test
vendored
Normal file
|
@ -0,0 +1,28 @@
|
|||
for
|
||||
-----
|
||||
<?php
|
||||
|
||||
for ($i = 0; $i < 10; $i++) {
|
||||
|
||||
}
|
||||
|
||||
for ($i = 0,$j = 0; $i < 10; $i++) {
|
||||
|
||||
}
|
||||
|
||||
for ($i = 0; $i < 10;) {
|
||||
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
|
||||
}
|
||||
-----
|
||||
for ($i = 0; $i < 10; $i++) {
|
||||
}
|
||||
for ($i = 0, $j = 0; $i < 10; $i++) {
|
||||
}
|
||||
for ($i = 0; $i < 10;) {
|
||||
}
|
||||
for (;;) {
|
||||
}
|
28
vendor/nikic/php-parser/test/code/prettyPrinter/stmt/foreach.test
vendored
Normal file
28
vendor/nikic/php-parser/test/code/prettyPrinter/stmt/foreach.test
vendored
Normal file
|
@ -0,0 +1,28 @@
|
|||
foreach
|
||||
-----
|
||||
<?php
|
||||
|
||||
foreach ($arr as $val) {
|
||||
|
||||
}
|
||||
|
||||
foreach ($arr as &$val) {
|
||||
|
||||
}
|
||||
|
||||
foreach ($arr as $key => $val) {
|
||||
|
||||
}
|
||||
|
||||
foreach ($arr as $key => &$val) {
|
||||
|
||||
}
|
||||
-----
|
||||
foreach ($arr as $val) {
|
||||
}
|
||||
foreach ($arr as &$val) {
|
||||
}
|
||||
foreach ($arr as $key => $val) {
|
||||
}
|
||||
foreach ($arr as $key => &$val) {
|
||||
}
|
43
vendor/nikic/php-parser/test/code/prettyPrinter/stmt/function_signatures.test
vendored
Normal file
43
vendor/nikic/php-parser/test/code/prettyPrinter/stmt/function_signatures.test
vendored
Normal file
|
@ -0,0 +1,43 @@
|
|||
Function signatures
|
||||
-----
|
||||
<?php
|
||||
|
||||
interface A
|
||||
{
|
||||
function f1();
|
||||
function f2($a, $b);
|
||||
function f3(&$a);
|
||||
function f4(A\B $a);
|
||||
function f4(array $a);
|
||||
function f5(callable $a);
|
||||
function f6(&$a);
|
||||
function f7(...$a);
|
||||
function f8(&...$a);
|
||||
function f9(A &$a);
|
||||
function f10(A ...$a);
|
||||
function f11(A &$a);
|
||||
function f12(A &...$a);
|
||||
function f13($a) : array;
|
||||
function f14($a) : callable;
|
||||
function f15($a) : B\C;
|
||||
}
|
||||
-----
|
||||
interface A
|
||||
{
|
||||
function f1();
|
||||
function f2($a, $b);
|
||||
function f3(&$a);
|
||||
function f4(A\B $a);
|
||||
function f4(array $a);
|
||||
function f5(callable $a);
|
||||
function f6(&$a);
|
||||
function f7(...$a);
|
||||
function f8(&...$a);
|
||||
function f9(A &$a);
|
||||
function f10(A ...$a);
|
||||
function f11(A &$a);
|
||||
function f12(A &...$a);
|
||||
function f13($a) : array;
|
||||
function f14($a) : callable;
|
||||
function f15($a) : B\C;
|
||||
}
|
11
vendor/nikic/php-parser/test/code/prettyPrinter/stmt/global_static_variables.test
vendored
Normal file
11
vendor/nikic/php-parser/test/code/prettyPrinter/stmt/global_static_variables.test
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
Global and static variables
|
||||
-----
|
||||
<?php
|
||||
|
||||
global $a, $$a, ${$a[$a]};
|
||||
static $a, $b;
|
||||
static $a = 'foo', $b = 'bar';
|
||||
-----
|
||||
global $a, ${$a}, ${$a[$a]};
|
||||
static $a, $b;
|
||||
static $a = 'foo', $b = 'bar';
|
9
vendor/nikic/php-parser/test/code/prettyPrinter/stmt/goto.test
vendored
Normal file
9
vendor/nikic/php-parser/test/code/prettyPrinter/stmt/goto.test
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
goto
|
||||
-----
|
||||
<?php
|
||||
|
||||
marker:
|
||||
goto marker;
|
||||
-----
|
||||
marker:
|
||||
goto marker;
|
16
vendor/nikic/php-parser/test/code/prettyPrinter/stmt/groupUse.test
vendored
Normal file
16
vendor/nikic/php-parser/test/code/prettyPrinter/stmt/groupUse.test
vendored
Normal file
|
@ -0,0 +1,16 @@
|
|||
Group use declaration
|
||||
-----
|
||||
<?php
|
||||
use A\{B};
|
||||
use A\{B\C, D};
|
||||
use A\B\{C\D, E};
|
||||
use function A\{b\c, d};
|
||||
use const A\{B\C, D};
|
||||
use A\B\{C\D, function b\c, const D};
|
||||
-----
|
||||
use A\{B};
|
||||
use A\{B\C, D};
|
||||
use A\B\{C\D, E};
|
||||
use function A\{b\c, d};
|
||||
use const A\{B\C, D};
|
||||
use A\B\{C\D, function b\c, const D};
|
27
vendor/nikic/php-parser/test/code/prettyPrinter/stmt/haltCompiler.file-test
vendored
Normal file
27
vendor/nikic/php-parser/test/code/prettyPrinter/stmt/haltCompiler.file-test
vendored
Normal file
|
@ -0,0 +1,27 @@
|
|||
__halt_compiler
|
||||
-----
|
||||
<?php
|
||||
|
||||
echo 'foo';
|
||||
__halt_compiler();
|
||||
!!!
|
||||
???
|
||||
-----
|
||||
<?php
|
||||
|
||||
echo 'foo';
|
||||
__halt_compiler();
|
||||
!!!
|
||||
???
|
||||
-----
|
||||
<?php
|
||||
|
||||
echo 'foo';
|
||||
__halt_compiler();
|
||||
<?php
|
||||
-----
|
||||
<?php
|
||||
|
||||
echo 'foo';
|
||||
__halt_compiler();
|
||||
<?php
|
16
vendor/nikic/php-parser/test/code/prettyPrinter/stmt/if.test
vendored
Normal file
16
vendor/nikic/php-parser/test/code/prettyPrinter/stmt/if.test
vendored
Normal file
|
@ -0,0 +1,16 @@
|
|||
if/elseif/else
|
||||
-----
|
||||
<?php
|
||||
|
||||
if ($expr) {
|
||||
|
||||
} elseif ($expr2) {
|
||||
|
||||
} else {
|
||||
|
||||
}
|
||||
-----
|
||||
if ($expr) {
|
||||
} elseif ($expr2) {
|
||||
} else {
|
||||
}
|
19
vendor/nikic/php-parser/test/code/prettyPrinter/stmt/multiCatch.test
vendored
Normal file
19
vendor/nikic/php-parser/test/code/prettyPrinter/stmt/multiCatch.test
vendored
Normal file
|
@ -0,0 +1,19 @@
|
|||
Multi catch
|
||||
-----
|
||||
<?php
|
||||
try {
|
||||
$x;
|
||||
} catch (X|Y $e1) {
|
||||
$y;
|
||||
} catch (\A|B\C $e2) {
|
||||
$z;
|
||||
}
|
||||
-----
|
||||
!!php7
|
||||
try {
|
||||
$x;
|
||||
} catch (X|Y $e1) {
|
||||
$y;
|
||||
} catch (\A|B\C $e2) {
|
||||
$z;
|
||||
}
|
50
vendor/nikic/php-parser/test/code/prettyPrinter/stmt/namespaces.test
vendored
Normal file
50
vendor/nikic/php-parser/test/code/prettyPrinter/stmt/namespaces.test
vendored
Normal file
|
@ -0,0 +1,50 @@
|
|||
Namespaces
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Foo;
|
||||
|
||||
function foo()
|
||||
{
|
||||
}
|
||||
|
||||
namespace Bar;
|
||||
|
||||
function bar()
|
||||
{
|
||||
}
|
||||
-----
|
||||
namespace Foo;
|
||||
|
||||
function foo()
|
||||
{
|
||||
}
|
||||
namespace Bar;
|
||||
|
||||
function bar()
|
||||
{
|
||||
}
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Foo {
|
||||
function foo()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
namespace {
|
||||
function glob() {
|
||||
}
|
||||
}
|
||||
-----
|
||||
namespace Foo {
|
||||
function foo()
|
||||
{
|
||||
}
|
||||
}
|
||||
namespace {
|
||||
function glob()
|
||||
{
|
||||
}
|
||||
}
|
11
vendor/nikic/php-parser/test/code/prettyPrinter/stmt/nullable_types.test
vendored
Normal file
11
vendor/nikic/php-parser/test/code/prettyPrinter/stmt/nullable_types.test
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
Nullable types
|
||||
-----
|
||||
<?php
|
||||
function test(?Foo $bar, ?string $foo, ?\Xyz $zyx) : ?Baz
|
||||
{
|
||||
}
|
||||
-----
|
||||
!!php7
|
||||
function test(?Foo $bar, ?string $foo, ?\Xyz $zyx) : ?Baz
|
||||
{
|
||||
}
|
35
vendor/nikic/php-parser/test/code/prettyPrinter/stmt/switch.test
vendored
Normal file
35
vendor/nikic/php-parser/test/code/prettyPrinter/stmt/switch.test
vendored
Normal file
|
@ -0,0 +1,35 @@
|
|||
switch/case/default
|
||||
-----
|
||||
<?php
|
||||
|
||||
switch ($expr) {
|
||||
case 0:
|
||||
echo 'First case, with a break';
|
||||
break;
|
||||
case 1:
|
||||
echo 'Second case, which falls through';
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
echo 'Third case, return instead of break';
|
||||
return;
|
||||
default:
|
||||
echo 'Default case';
|
||||
break;
|
||||
}
|
||||
-----
|
||||
switch ($expr) {
|
||||
case 0:
|
||||
echo 'First case, with a break';
|
||||
break;
|
||||
case 1:
|
||||
echo 'Second case, which falls through';
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
echo 'Third case, return instead of break';
|
||||
return;
|
||||
default:
|
||||
echo 'Default case';
|
||||
break;
|
||||
}
|
7
vendor/nikic/php-parser/test/code/prettyPrinter/stmt/throw.test
vendored
Normal file
7
vendor/nikic/php-parser/test/code/prettyPrinter/stmt/throw.test
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
throw
|
||||
-----
|
||||
<?php
|
||||
|
||||
throw $e;
|
||||
-----
|
||||
throw $e;
|
25
vendor/nikic/php-parser/test/code/prettyPrinter/stmt/traitUse.test
vendored
Normal file
25
vendor/nikic/php-parser/test/code/prettyPrinter/stmt/traitUse.test
vendored
Normal file
|
@ -0,0 +1,25 @@
|
|||
Trait uses and adaptations
|
||||
-----
|
||||
<?php
|
||||
|
||||
class A
|
||||
{
|
||||
use B, C, D {
|
||||
f as g;
|
||||
f as private;
|
||||
f as private g;
|
||||
B::f as g;
|
||||
B::f insteadof C, D;
|
||||
}
|
||||
}
|
||||
-----
|
||||
class A
|
||||
{
|
||||
use B, C, D {
|
||||
f as g;
|
||||
f as private;
|
||||
f as private g;
|
||||
B::f as g;
|
||||
B::f insteadof C, D;
|
||||
}
|
||||
}
|
24
vendor/nikic/php-parser/test/code/prettyPrinter/stmt/tryCatch.test
vendored
Normal file
24
vendor/nikic/php-parser/test/code/prettyPrinter/stmt/tryCatch.test
vendored
Normal file
|
@ -0,0 +1,24 @@
|
|||
tryCatch
|
||||
-----
|
||||
<?php
|
||||
|
||||
try {
|
||||
|
||||
} catch (Exception $e) {
|
||||
|
||||
}
|
||||
|
||||
try {
|
||||
} catch (Exception $e) {
|
||||
|
||||
} finally {
|
||||
|
||||
}
|
||||
-----
|
||||
try {
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
try {
|
||||
} catch (Exception $e) {
|
||||
} finally {
|
||||
}
|
10
vendor/nikic/php-parser/test/code/prettyPrinter/stmt/while.test
vendored
Normal file
10
vendor/nikic/php-parser/test/code/prettyPrinter/stmt/while.test
vendored
Normal file
|
@ -0,0 +1,10 @@
|
|||
while
|
||||
-----
|
||||
<?php
|
||||
|
||||
while (true) {
|
||||
|
||||
}
|
||||
-----
|
||||
while (true) {
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue