language009.phpt 434 B

123456789101112131415161718192021222324252627282930313233343536
  1. --TEST--
  2. In instead definitions all trait whose methods are meant to be hidden can be listed.
  3. --FILE--
  4. <?php
  5. error_reporting(E_ALL);
  6. trait A {
  7. public function foo() {
  8. echo 'a';
  9. }
  10. }
  11. trait B {
  12. public function foo() {
  13. echo 'b';
  14. }
  15. }
  16. trait C {
  17. public function foo() {
  18. echo 'c';
  19. }
  20. }
  21. class MyClass {
  22. use C, A, B {
  23. B::foo insteadof A, C;
  24. }
  25. }
  26. $t = new MyClass;
  27. $t->foo();
  28. ?>
  29. --EXPECT--
  30. b