Implement __toString() for reflection classes
[hiphop-php.git] / hphp / test / slow / reflection / defaultconstructor_exceptions.php
blob18d09bd66308ec98fe17c2ad9cd99b5c6abd25d7
1 <?php
3 class D {
4 // default constructor
7 class P {
8 public function __construct() {
9 echo __METHOD__, ' ', get_class($this), "\n";
12 class C extends P {
13 // inherited constructor
16 function reflect($class_name) {
17 $c = new $class_name('a', 1, 2);
19 $rc = new ReflectionClass($class_name);
21 try {
22 $c2 = $rc->newInstance('a', 1, 2);
23 } catch (Exception $e) {
24 echo get_class($e), ': ', $e->getMessage(), "\n";
26 try {
27 $c2 = $rc->newInstanceArgs(array('a', 1, 2));
28 } catch (Exception $e) {
29 echo get_class($e), ': ', $e->getMessage(), "\n";
33 function main() {
34 reflect('D');
35 reflect('C');
36 reflect('P');
38 main();