inheritance_007.phpt 624 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. --TEST--
  2. Ensure inherited old-style constructor doesn't block other methods
  3. --FILE--
  4. <?php
  5. class A {
  6. public function B () { echo "In " . __METHOD__ . "\n"; }
  7. public function A () { echo "In " . __METHOD__ . "\n"; }
  8. }
  9. class B extends A { }
  10. $rc = new ReflectionClass('B');
  11. var_dump($rc->getMethods());
  12. $b = new B();
  13. $b->a();
  14. $b->b();
  15. ?>
  16. --EXPECTF--
  17. array(2) {
  18. [0]=>
  19. &object(ReflectionMethod)#%d (2) {
  20. ["name"]=>
  21. string(1) "B"
  22. ["class"]=>
  23. string(1) "A"
  24. }
  25. [1]=>
  26. &object(ReflectionMethod)#%d (2) {
  27. ["name"]=>
  28. string(1) "A"
  29. ["class"]=>
  30. string(1) "A"
  31. }
  32. }
  33. In A::A
  34. In A::A
  35. In A::B