update v 1.0.7.5

This commit is contained in:
Sujit Prasad
2016-06-13 20:41:55 +05:30
parent aa9786d829
commit 283d97e3ea
5078 changed files with 339851 additions and 175995 deletions

View File

@@ -27,7 +27,6 @@ function justForIndentation()
Even more text. */
$foo;
}
-----
function justForIndentation()
{
@@ -53,4 +52,16 @@ function justForIndentation()
More text.
Even more text. */
$foo;
}
-----
<?php
function test()
{
// empty
}
-----
function test()
{
// empty
}

View 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];

View 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;
}

View 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');

View File

@@ -40,21 +40,17 @@ FALSE;
378282246310005.0;
10000000000000002.0;
// strings (normalized to single quoted)
// strings (single quoted)
'a';
'a
b';
"a";
"a\nb";
'a\'b';
// strings (double quoted)
"a'b";
"a\b";
<<<'STR'
a\nb$a
{$b}
STR;
// strings (normalized to double quoted)
"$a";
"a$b";
"$a$b";
@@ -68,9 +64,6 @@ STR;
"\\{ $A }";
"{$$A}[B]";
"$$A[B]";
<<<STR
a\nb$a\n{$b}
STR;
// make sure indentation doesn't mess anything up
function foo()
@@ -81,6 +74,12 @@ b';
'a
b';
}
// shell exec (similar to double quoted string)
`foo`;
`foo$a`;
`foo{$a}bar`;
`\`\'\"`;
-----
// magic constants
__LINE__;
@@ -101,9 +100,9 @@ FALSE;
// integers (normalized to decimal)
0;
11;
9;
17;
3;
011;
0x11;
0b11;
// floats (normalized to ... something)
0.0;
0.0;
@@ -116,19 +115,16 @@ INF;
1.0E+84;
378282246310005.0;
10000000000000002.0;
// strings (normalized to single quoted)
'a';
'a
b';
// strings (single quoted)
'a';
'a
b';
"a";
"a\nb";
'a\'b';
'a\'b';
'a\\b';
'a\\nb$a
{$b}';
// strings (normalized to double quoted)
// strings (double quoted)
"a'b";
"a\\b";
"{$a}";
"a{$b}";
"{$a}{$b}";
@@ -142,14 +138,17 @@ b';
"\\{ {$A} }";
"{${$A}}[B]";
"\${$A['B']}";
"a\nb{$a}\n{$b}";
// make sure indentation doesn't mess anything up
function foo()
{
'a
b';
"a\nb";
'a
b';
'a
b';
}
// shell exec (similar to double quoted string)
`foo`;
`foo{$a}`;
`foo{$a}bar`;
`\`\\'\\"`;

View 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'];

View 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)();

View File

@@ -24,6 +24,7 @@ $a::$b[$c];
$a::$b[$c]($d);
$a::{$b[$c]}($d);
$a::{$b->c}();
A::$$b[$c]();
a();
$a();
$a()[$b];
@@ -36,6 +37,7 @@ $a::$b()[$c];
global $a, $$a, $$a[$b], $$a->b;
-----
!!php5
$a;
${$a};
${$a};
@@ -55,9 +57,10 @@ $a::b();
$a::b($c);
$a::$b();
$a::$b[$c];
$a::$b[$c]($d);
$a::$b[$c]($d);
$a::{$b[$c]}($d);
$a::{$b[$c]}($d);
$a::{$b->c}();
A::${$b[$c]}();
a();
$a();
$a()[$b];

View 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

View File

@@ -8,4 +8,9 @@ echo 'Bar Foo';
<?php
echo 'Foo Bar';
echo 'Bar Foo';
echo 'Bar Foo';
-----
<?php
-----
<?php

View File

@@ -0,0 +1,13 @@
break/continue
-----
<?php
continue;
continue 2;
break;
break 2;
-----
continue;
continue 2;
break;
break 2;

View File

@@ -2,7 +2,7 @@ Class
-----
<?php
class Foo
class Foo extends Bar implements ABC, \DEF, namespace\GHI
{
var $a = 'foo';
private $b = 'bar';
@@ -17,8 +17,15 @@ class Foo
public function foo() {}
abstract static function bar() {}
}
trait Bar
{
function test()
{
}
}
-----
class Foo
class Foo extends Bar implements ABC, \DEF, namespace\GHI
{
var $a = 'foo';
private $b = 'bar';
@@ -37,4 +44,10 @@ class Foo
static abstract function bar()
{
}
}
trait Bar
{
function test()
{
}
}

View 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;

View 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) {
}

View File

@@ -0,0 +1,10 @@
doWhile
-----
<?php
do {
} while (true);
-----
do {
} while (true);

View 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 (;;) {
}

View 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) {
}

View 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';

View File

@@ -0,0 +1,9 @@
goto
-----
<?php
marker:
goto marker;
-----
marker:
goto marker;

View 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};

View 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

View File

@@ -0,0 +1,16 @@
if/elseif/else
-----
<?php
if ($expr) {
} elseif ($expr2) {
} else {
}
-----
if ($expr) {
} elseif ($expr2) {
} else {
}

View File

@@ -0,0 +1,7 @@
throw
-----
<?php
throw $e;
-----
throw $e;

View 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 {
}

View File

@@ -0,0 +1,10 @@
while
-----
<?php
while (true) {
}
-----
while (true) {
}