ReflectionClass_getName_basic.phpt 468 B

12345678910111213141516171819202122232425
  1. --TEST--
  2. ReflectionClass::getName()
  3. --FILE--
  4. <?php
  5. class TrickClass {
  6. function __toString() {
  7. //Return the name of another class
  8. return "Exception";
  9. }
  10. }
  11. $r1 = new ReflectionClass("stdClass");
  12. $myInstance = new stdClass;
  13. $r2 = new ReflectionClass($myInstance);
  14. $r3 = new ReflectionClass("TrickClass");
  15. var_dump($r1->getName(), $r2->getName(), $r3->getName());
  16. ?>
  17. --EXPECT--
  18. string(8) "stdClass"
  19. string(8) "stdClass"
  20. string(10) "TrickClass"