-
Notifications
You must be signed in to change notification settings - Fork 3k
/
xhp.php
55 lines (47 loc) · 1.09 KB
/
xhp.php
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
<?hh
abstract class :base {
// This is necessary because the generated __xhpAttributeDeclaration() has a
// call to parent::__xhpAttributeDeclaration().
protected static function __xhpAttributeDeclaration() {
return darray[];
}
public static function xhpAttributeDeclaration() {
return static::__xhpAttributeDeclaration();
}
}
class :node1 extends :base {
attribute
mixed checkme;
}
class :node2 extends :base {
attribute
Exception e,
mixed checkme;
}
class :node3 extends :base {
attribute
int num,
mixed checkme,
var beans,
string cheese;
}
class :node4 extends :base {
attribute
int num = 2,
mixed checkme,
var beans,
string cheese = "hi";
}
function test($x) {
echo "====================================================\n";
var_dump($x);
var_dump(is_array($x));
var_dump(is_varray($x));
var_dump(is_darray($x));
var_dump(is_vec($x));
var_dump(is_dict($x));
}
test(:node1::xhpAttributeDeclaration());
test(:node2::xhpAttributeDeclaration());
test(:node3::xhpAttributeDeclaration());
test(:node4::xhpAttributeDeclaration());