1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00
Files
archived-php-src/Zend/tests/traits/inheritance001.phpt
2020-01-16 09:46:47 +01:00

25 lines
412 B
PHP

--TEST--
Trait method overwritten by a method defined in the class.
--FILE--
<?php
error_reporting(E_ALL);
trait HelloWorld {
public function sayHello() {
echo 'Hello World!';
}
}
class TheWorldIsNotEnough {
use HelloWorld;
public function sayHello() {
echo 'Hello Universe!';
}
}
$o = new TheWorldIsNotEnough();
$o->sayHello(); // echos Hello Universe!
?>
--EXPECT--
Hello Universe!