bug62069.phpt 553 B

1234567891011121314151617181920212223242526272829303132
  1. --TEST--
  2. Bug #62069: binding wrong traits if they have same name methods
  3. --FILE--
  4. <?php
  5. trait T1 {
  6. public function func() {
  7. echo "From T1\n";
  8. }
  9. }
  10. trait T2 {
  11. public function func() {
  12. echo "From T2\n";
  13. }
  14. }
  15. class Bar {
  16. public function func() {
  17. echo "From Bar\n";
  18. }
  19. use T1, T2 {
  20. func as f1;
  21. }
  22. }
  23. $b = new Bar();
  24. $b->f2();
  25. ?>
  26. --EXPECTF--
  27. Fatal error: An alias was defined for method func(), which exists in both T1 and T2. Use T1::func or T2::func to resolve the ambiguity in %s on line %d