Basic flow analysis on if statements
[hiphop-php.git] / hphp / test / slow / dyn-meth-caller-warn.php
blob5e9c9219af58fa9e14bdca229201ff946180d6e4
1 <?hh
3 class Foo {
4 <<__DynamicallyCallable>> function inst_dyn() { echo __FUNCTION__."\n"; }
5 function inst_meth() { echo __FUNCTION__."\n"; }
6 static function static_meth() { echo __FUNCTION__."\n"; }
9 <<__EntryPoint>>
10 function main() {
11 $z = HH\dynamic_meth_caller(Foo::class, 'inst_dyn');
12 $a = HH\dynamic_meth_caller(Foo::class, 'inst_meth');
13 $b = HH\dynamic_meth_caller(Foo::class, 'static_meth');
14 $c = HH\dynamic_meth_caller(Foo::class, 'not_a_meth');
16 var_dump($z, $a, $b, $c);
17 try { $z(new Foo); } catch (Exception $e) { var_dump($e->getMessage()); }
18 try { $a(new Foo); } catch (Exception $e) { var_dump($e->getMessage()); }
19 try { $b(new Foo); } catch (Exception $e) { var_dump($e->getMessage()); }
20 try { $c(new Foo); } catch (Exception $e) { var_dump($e->getMessage()); }