the whole shebang
This commit is contained in:
18
vendor/nikic/php-parser/test/code/prettyPrinter/closure.test
vendored
Normal file
18
vendor/nikic/php-parser/test/code/prettyPrinter/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';
|
||||
};
|
56
vendor/nikic/php-parser/test/code/prettyPrinter/comments.test
vendored
Normal file
56
vendor/nikic/php-parser/test/code/prettyPrinter/comments.test
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
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;
|
||||
}
|
7
vendor/nikic/php-parser/test/code/prettyPrinter/include.test
vendored
Normal file
7
vendor/nikic/php-parser/test/code/prettyPrinter/include.test
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
Include
|
||||
-----
|
||||
<?php
|
||||
|
||||
(include $foo) && (include $bar);
|
||||
-----
|
||||
(include $foo) && (include $bar);
|
52
vendor/nikic/php-parser/test/code/prettyPrinter/inlineHTMLandPHPtest.file-test
vendored
Normal file
52
vendor/nikic/php-parser/test/code/prettyPrinter/inlineHTMLandPHPtest.file-test
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
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
|
58
vendor/nikic/php-parser/test/code/prettyPrinter/namespaces.test
vendored
Normal file
58
vendor/nikic/php-parser/test/code/prettyPrinter/namespaces.test
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
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/onlyInlineHTML.file-test
vendored
Normal file
11
vendor/nikic/php-parser/test/code/prettyPrinter/onlyInlineHTML.file-test
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
File containing only inline HTML
|
||||
-----
|
||||
Hallo World
|
||||
Foo Bar
|
||||
Bar Foo
|
||||
World Hallo
|
||||
-----
|
||||
Hallo World
|
||||
Foo Bar
|
||||
Bar Foo
|
||||
World Hallo
|
11
vendor/nikic/php-parser/test/code/prettyPrinter/onlyPHP.file-test
vendored
Normal file
11
vendor/nikic/php-parser/test/code/prettyPrinter/onlyPHP.file-test
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
File containing only PHP
|
||||
-----
|
||||
<?php
|
||||
|
||||
echo 'Foo Bar';
|
||||
echo 'Bar Foo';
|
||||
-----
|
||||
<?php
|
||||
|
||||
echo 'Foo Bar';
|
||||
echo 'Bar Foo';
|
45
vendor/nikic/php-parser/test/code/prettyPrinter/parentheses.test
vendored
Normal file
45
vendor/nikic/php-parser/test/code/prettyPrinter/parentheses.test
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
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;
|
||||
|
||||
(1 > 0) > (1 < 0);
|
||||
|
||||
// this will currently unnecessarily print !($a = $b). This is correct as far as operator precedence is concerned, but
|
||||
// the parentheses are not really necessary, because = takes only variables as the left hand side operator.
|
||||
!$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;
|
||||
(1 > 0) > (1 < 0);
|
||||
// this will currently unnecessarily print !($a = $b). This is correct as far as operator precedence is concerned, but
|
||||
// the parentheses are not really necessary, because = takes only variables as the left hand side operator.
|
||||
!($a = $b);
|
35
vendor/nikic/php-parser/test/code/prettyPrinter/switch.test
vendored
Normal file
35
vendor/nikic/php-parser/test/code/prettyPrinter/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;
|
||||
}
|
Reference in New Issue
Block a user