mirror of
https://github.com/php/php-src.git
synced 2024-10-17 14:32:37 +00:00
24 lines
413 B
Plaintext
24 lines
413 B
Plaintext
|
--TEST--
|
||
|
Trait method overwridden 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!
|
||
|
?>
|
||
|
--EXPECTF--
|
||
|
Hello Universe!
|