inheritance_007.phpt 777 B

12345678910111213141516171819202122232425262728293031323334353637383940
  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. Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; A has a deprecated constructor in %s on line %d
  18. array(2) {
  19. [0]=>
  20. object(ReflectionMethod)#%d (2) {
  21. ["name"]=>
  22. string(1) "B"
  23. ["class"]=>
  24. string(1) "A"
  25. }
  26. [1]=>
  27. object(ReflectionMethod)#%d (2) {
  28. ["name"]=>
  29. string(1) "A"
  30. ["class"]=>
  31. string(1) "A"
  32. }
  33. }
  34. In A::A
  35. In A::A
  36. In A::B