Annotation of embedaddon/php/Zend/tests/traits/language004.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Use instead to solve a conflict and as to access the method.
! 3: --FILE--
! 4: <?php
! 5: error_reporting(E_ALL);
! 6:
! 7: trait Hello {
! 8: public function saySomething() {
! 9: echo 'Hello';
! 10: }
! 11: }
! 12:
! 13: trait World {
! 14: public function saySomething() {
! 15: echo ' World';
! 16: }
! 17: }
! 18:
! 19: class MyHelloWorld {
! 20: use Hello, World {
! 21: Hello::saySomething insteadof World;
! 22: World::saySomething as sayWorld;
! 23: }
! 24: }
! 25:
! 26: $o = new MyHelloWorld();
! 27: $o->saySomething();
! 28: $o->sayWorld();
! 29: ?>
! 30: --EXPECTF--
! 31: Hello World
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>