bug76773.phpt 454 B

123456789101112131415161718192021222324252627282930313233
  1. --TEST--
  2. Bug #76773 (Traits used on the parent are ignored for child classes)
  3. --FILE--
  4. <?php
  5. trait MyTrait
  6. {
  7. public function hello()
  8. {
  9. echo __CLASS__, "\n";
  10. if (\is_callable(array('parent', __FUNCTION__))) {
  11. parent::hello();
  12. }
  13. }
  14. }
  15. class ParentClass
  16. {
  17. use MyTrait;
  18. }
  19. class ChildClass extends ParentClass
  20. {
  21. use MyTrait;
  22. }
  23. $c = new ChildClass();
  24. $c->hello();
  25. ?>
  26. --EXPECT--
  27. ChildClass
  28. ParentClass