global statement removal: hphp/test [7/x]
[hiphop-php.git] / hphp / test / quick / impl_abstract_default_vals.php
blob57e7501d5731c568e78663c2c9af75d32b885b15
1 <?hh
2 // check default values and type hints, implementating abstract methods: pass
3 const D0 = 0;
4 const D1 = 1;
5 const D2 = 2;
6 const DD2 = 2.0;
7 const DNULL = null;
8 const DABC = 'abc';
9 const DTRUE = true;
11 abstract class A {
12 const i0 = 0;
13 const sabc = 'abc';
14 const f3 = 3.0;
15 abstract public function a(array $a1 = null, array $a2 = array());
16 abstract public function b(boolean $b1 = null);
17 abstract public function c(A $c1 = null);
18 abstract public function d(double $d1 = null, double $d2 = 2.0);
19 abstract public function f(float $f1 = null, float $f2 = 2.0);
20 abstract public function i(int $i1 = A::i0, integer $i2 = 2);
21 abstract public function s(string $s1 = null, string $s2 = A::sabc);
24 class B extends A {
25 const btrue = true;
26 const d3 = 3.0;
27 const ibig = 9123123123123;
28 public function a(array $a1 = null, array $a2 = array(), array $a3 = array(1, 2, 3), array $a4 = array("abc")) {}
29 public function b(boolean $b1 = null, boolean $b2 = false, boolean $b3 = DTRUE, boolean $b4 = B::btrue) {}
30 public function c(A $c1 = null) {}
31 public function d(double $d1 = null, double $d2 = 1.0) {} // , double $d3 = DD2, double $d4 = B::d3) {}
32 public function f(float $f1 = null, float $f2 = 1.0, float $f3 = DD2, float $f4 = A::f3) {}
33 public function i(int $i1 = null, integer $i2 = B::ibig, int $i3 = D2, int $i4 = A::i0) {}
34 public function s(string $s1 = null, string $s2 = "S", string $s3 = DABC, string $s4 = A::sabc) {}
37 $b = new B();
38 $b->a();
39 $b->b();
40 $b->c();
41 $b->d();
42 $b->i();
43 $b->s();
44 $b->f();
46 echo "Pass\n";