forked from glayzzle/php-parser
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunction.parser
More file actions
70 lines (67 loc) · 1.16 KB
/
function.parser
File metadata and controls
70 lines (67 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
Test function parser
--PASS--
function aa($a, $b = MY_CONST, $c = A | B) { }
--PASS--
function htmlspecialchars(
string $string,
int $flags = ENT_COMPAT | ENT_HTML401,
string $encoding = 'ini_get("default_charset")',
bool $double_encode = true
): string {}
--FAIL--
function aa();
--PASS ??--
function aa() {};
--FAIL--
function aa($b;) {}
--FAIL--
function $aa($b) {}
--FAIL--
function 123__aa() { }
--PASS--
function _123aa() { }
--PASS--
function _3aa() { }
--PASS--
function aa() { }
--PASS--
function a123a() { }
--PASS--
function __aa() { }
--PASS--
function aa(){
}
--PASS--
/**
* This is a comment
*/
function aa( /** here another comment **/ ){
// here is another comment
}
--PASS--
function &aa() { }
--PASS--
function aa($a) { }
--PASS--
function aa(array $a) { }
--PASS--
function aa(array &$a) { }
--PASS--
function aa(array &$a = [1, 2, 3]) { }
--PASS--
function aa(array &$a, $b) { }
--PASS--
function aa(&$a) { }
--PASS--
function aa(
&$a, $b
) {
}
--PASS--
function aa(&$a, $b = 5) {
echo 'Hello world';
}
function aa(&$a, $b = null) { }
function aa(&$a, $b = true) { }
function aa(&$a, $b = "aa") { }
function aa(&$a, $b = array('a' => 'b')) { }