mirror of
https://github.com/php/php-src.git
synced 2024-10-16 22:12:33 +00:00
32 lines
400 B
Plaintext
32 lines
400 B
Plaintext
|
--TEST--
|
||
|
Traits are flattened recurivly.
|
||
|
--FILE--
|
||
|
<?php
|
||
|
error_reporting(E_ALL);
|
||
|
|
||
|
trait Hello {
|
||
|
public function sayHello() {
|
||
|
echo 'Hello ';
|
||
|
}
|
||
|
}
|
||
|
|
||
|
trait World {
|
||
|
public function sayWorld() {
|
||
|
echo 'World!';
|
||
|
}
|
||
|
}
|
||
|
|
||
|
trait HelloWorld {
|
||
|
use Hello, World;
|
||
|
}
|
||
|
|
||
|
class MyHelloWorld {
|
||
|
use HelloWorld;
|
||
|
}
|
||
|
|
||
|
$o = new MyHelloWorld();
|
||
|
$o->sayHello();
|
||
|
$o->sayWorld();
|
||
|
?>
|
||
|
--EXPECTF--
|
||
|
Hello World!
|