Disallow declarations outside of the global scope.
[hiphop-php.git] / hphp / test / slow / inout / tuple / tests / fb-intercept-argc.php
blob0f0c4a9411793db16725ca11787cc6a99fc3f652
1 <?hh
3 class Foo {
4 function bar(int $x, inout bool $y, inout string $z) {
5 $y = false;
6 $z = 'hello-world';
7 return $x;
11 function meep(inout $f, $g, inout $r) {
12 $f = 'apple';
13 $r = 'orange';
14 return $g;
17 function too_many($name, $obj_or_cls, inout $args, $ctx, inout $done) {
18 var_dump($args, $done);
19 $args = ['red', 'green', 'blue', 'apple', 'bannana', 'pear'];
20 $done = $ctx;
23 function too_few($name, $obj_or_cls, inout $args, $ctx, inout $done) {
24 var_dump($args, $done);
25 $args = ['foo'];
26 $done = $ctx;
29 function wrong_type($name, $obj_or_cls, inout $args, $ctx, inout $done) {
30 var_dump($args, $done);
31 $args = new stdclass;
32 $done = $ctx;
35 function main() {
36 fb_intercept('meep', 'too_many', true);
37 fb_intercept('Foo::bar', 'too_few', true);
38 $a = 1; $b = true; $c = 'c';
39 Foo::bar($a, inout $b, inout $c);
40 var_dump($a, $b, $c);
42 $a = 1; $b = true; $c = 'c';
43 meep(inout $a, $b, inout $c);
44 var_dump($a, $b, $c);
46 fb_intercept('meep', 'wrong_type', true);
47 $a = 1; $b = true; $c = 'c';
48 meep(inout $a, $b, inout $c);
49 var_dump($a, $b, $c);
52 main();