mirror of
https://github.com/php/php-src.git
synced 2024-10-16 22:12:33 +00:00
05a9649043
#That was suggested several times already, but am still not sure whether that really reads better. #Especially since only the trait is mentioned, since the method name would be duplicated anyway.
29 lines
397 B
PHP
29 lines
397 B
PHP
--TEST--
|
|
Use instead to solve a conflict.
|
|
--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;
|
|
}
|
|
}
|
|
|
|
$o = new MyHelloWorld();
|
|
$o->saySomething();
|
|
?>
|
|
--EXPECTF--
|
|
Hello
|