ReflectionClass_constructor_001.phpt 605 B

123456789101112131415161718192021222324252627282930313233
  1. --TEST--
  2. ReflectionClass::__constructor()
  3. --FILE--
  4. <?php
  5. $r1 = new ReflectionClass("stdClass");
  6. $myInstance = new stdClass;
  7. $r2 = new ReflectionClass($myInstance);
  8. class TrickClass {
  9. function __toString() {
  10. //Return the name of another class
  11. return "Exception";
  12. }
  13. }
  14. $myTrickClass = new TrickClass;
  15. $r3 = new ReflectionClass($myTrickClass);
  16. var_dump($r1, $r2, $r3);
  17. ?>
  18. --EXPECTF--
  19. object(ReflectionClass)#%d (1) {
  20. ["name"]=>
  21. string(8) "stdClass"
  22. }
  23. object(ReflectionClass)#%d (1) {
  24. ["name"]=>
  25. string(8) "stdClass"
  26. }
  27. object(ReflectionClass)#%d (1) {
  28. ["name"]=>
  29. string(10) "TrickClass"
  30. }