methods_002.phpt 428 B

12345678910111213141516171819202122232425262728
  1. --TEST--
  2. Testing collision with magic methods
  3. --FILE--
  4. <?php
  5. trait foo {
  6. public function __clone() {
  7. var_dump(__FUNCTION__);
  8. }
  9. }
  10. trait baz {
  11. public function __clone() {
  12. var_dump(__FUNCTION__);
  13. }
  14. }
  15. class bar {
  16. use foo;
  17. use baz;
  18. }
  19. $o = new bar;
  20. var_dump(clone $o);
  21. ?>
  22. --EXPECTF--
  23. Fatal error: Trait method __clone has not been applied, because there are collisions with other trait methods on bar in %s on line %d