php-src/Zend/tests/traits/conflict002.phpt
Stefan Marr b501570ab0 Added traits test cases. No engine changes for now. [TRAITS]
#Getting accustomed to the infrastructure.
#Any comments are welcome, especially with regard to syntax and keywords.
2010-04-15 21:39:20 +00:00

32 lines
507 B
PHP

--TEST--
Overwridden methods do not cause a conflict.
--FILE--
<?php
error_reporting(E_ALL);
trait HelloWorld {
public function sayHello() {
echo 'Hello World!';
}
}
trait HelloWorld2 {
public function sayHello() {
echo 'Hello World2!';
}
}
class TheWorldIsNotEnough {
use HelloWorld;
use HelloWorld2;
public function sayHello() {
echo 'Hello Universe!';
}
}
$o = new TheWorldIsNotEnough();
$o->sayHello(); // echos Hello Universe!
?>
--EXPECTF--
Hello Universe!