-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Our output for yield / yield from is currently not very nice, but also not easy to change.
- Loading branch information
Showing
7 changed files
with
127 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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]); | ||
die; | ||
die; | ||
die(1); | ||
die; | ||
die; | ||
die('foo'); | ||
clone $foo; | ||
eval('str'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
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); | ||
} | ||
----- | ||
<?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); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,4 +8,9 @@ echo 'Bar Foo'; | |
<?php | ||
|
||
echo 'Foo Bar'; | ||
echo 'Bar Foo'; | ||
echo 'Bar Foo'; | ||
----- | ||
<?php | ||
// avoid trim | ||
----- | ||
<?php |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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'; |