diff options
Diffstat (limited to 'Zend/tests/traits/language004.phpt')
-rw-r--r-- | Zend/tests/traits/language004.phpt | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/Zend/tests/traits/language004.phpt b/Zend/tests/traits/language004.phpt new file mode 100644 index 0000000..4df307a --- /dev/null +++ b/Zend/tests/traits/language004.phpt @@ -0,0 +1,31 @@ +--TEST-- +Use instead to solve a conflict and as to access the method. +--FILE-- +<?php +error_reporting(E_ALL); + +trait Hello { + public function saySomething() { + echo 'Hello'; + } +} + +trait World { + public function saySomething() { + echo ' World'; + } +} + +class MyHelloWorld { + use Hello, World { + Hello::saySomething insteadof World; + World::saySomething as sayWorld; + } +} + +$o = new MyHelloWorld(); +$o->saySomething(); +$o->sayWorld(); +?> +--EXPECTF-- +Hello World
\ No newline at end of file |