mirror of
https://github.com/php/php-src.git
synced 2024-10-17 14:32:37 +00:00
b501570ab0
#Getting accustomed to the infrastructure. #Any comments are welcome, especially with regard to syntax and keywords.
34 lines
738 B
PHP
34 lines
738 B
PHP
--TEST--
|
|
Aliasing leading to conflict should result in error message
|
|
--FILE--
|
|
<?php
|
|
error_reporting(E_ALL);
|
|
|
|
trait Hello {
|
|
public function sayHello() {
|
|
echo 'Hello';
|
|
}
|
|
}
|
|
|
|
trait World {
|
|
public function sayHello() {
|
|
echo ' World!';
|
|
}
|
|
}
|
|
|
|
|
|
class MyClass {
|
|
use Hello, World { sayHello as sayWorld; }
|
|
}
|
|
|
|
$o = new MyClass();
|
|
$o->sayHello();
|
|
$o->sayWorld();
|
|
|
|
?>
|
|
--EXPECTF--
|
|
Warning: Trait method sayWorld has not been applied, because there are collisions with other trait methods on MyClass in %s on line %d
|
|
|
|
Warning: Trait method sayHello has not been applied, because there are collisions with other trait methods on MyClass in %s on line %d
|
|
|
|
Fatal error: Call to undefined method MyClass::sayHello() in %s on line %d
|