-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
113 additions
and
0 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,53 @@ | ||
--TEST-- | ||
Parameter type 'int' | ||
--SKIPIF-- | ||
<?php include(__DIR__ . '/../skipif.inc'); ?> | ||
--FILE-- | ||
<?php | ||
$code =<<<ZEP | ||
function test(int value) { } | ||
ZEP; | ||
|
||
$ir = zephir_parse_file($code, '(eval code)'); | ||
var_dump($ir); | ||
?> | ||
--EXPECT-- | ||
array(1) { | ||
[0]=> | ||
array(6) { | ||
["type"]=> | ||
string(8) "function" | ||
["name"]=> | ||
string(4) "test" | ||
["parameters"]=> | ||
array(1) { | ||
[0]=> | ||
array(9) { | ||
["type"]=> | ||
string(9) "parameter" | ||
["name"]=> | ||
string(5) "value" | ||
["const"]=> | ||
int(0) | ||
["data-type"]=> | ||
string(3) "int" | ||
["mandatory"]=> | ||
int(0) | ||
["reference"]=> | ||
int(0) | ||
["file"]=> | ||
string(11) "(eval code)" | ||
["line"]=> | ||
int(1) | ||
["char"]=> | ||
int(25) | ||
} | ||
} | ||
["file"]=> | ||
string(11) "(eval code)" | ||
["line"]=> | ||
int(1) | ||
["char"]=> | ||
int(9) | ||
} | ||
} |
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,60 @@ | ||
--TEST-- | ||
Function definition with mandatory return type | ||
--SKIPIF-- | ||
<?php include(__DIR__ . '/../skipif.inc'); ?> | ||
--FILE-- | ||
<?php | ||
$code =<<<ZEP | ||
function test() -> int { } | ||
ZEP; | ||
|
||
$ir = zephir_parse_file($code, '(eval code)'); | ||
var_dump($ir); | ||
?> | ||
--EXPECT-- | ||
array(1) { | ||
[0]=> | ||
array(6) { | ||
["type"]=> | ||
string(8) "function" | ||
["name"]=> | ||
string(4) "test" | ||
["return-type"]=> | ||
array(6) { | ||
["type"]=> | ||
string(11) "return-type" | ||
["list"]=> | ||
array(1) { | ||
[0]=> | ||
array(6) { | ||
["type"]=> | ||
string(21) "return-type-parameter" | ||
["data-type"]=> | ||
string(3) "int" | ||
["mandatory"]=> | ||
int(0) | ||
["file"]=> | ||
string(11) "(eval code)" | ||
["line"]=> | ||
int(1) | ||
["char"]=> | ||
int(25) | ||
} | ||
} | ||
["void"]=> | ||
int(0) | ||
["file"]=> | ||
string(11) "(eval code)" | ||
["line"]=> | ||
int(1) | ||
["char"]=> | ||
int(25) | ||
} | ||
["file"]=> | ||
string(11) "(eval code)" | ||
["line"]=> | ||
int(1) | ||
["char"]=> | ||
int(9) | ||
} | ||
} |