mirror of
https://github.com/php/php-src.git
synced 2024-10-17 06:22:53 +00:00
1d2a63da5f
#This change is made to have all possible cases of collisions consistently handled as fatal errors. #The reason to have it fatal is that most likely something changed unexpectedly and needs urgent attention by the developer, since it will fail eventually anyway for instance because the expected method is missing in the class. #Discussed in this thread: http://marc.info/?l=php-internals&m=129155790226876
31 lines
531 B
PHP
31 lines
531 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--
|
|
Fatal error: Trait method sayWorld has not been applied, because there are collisions with other trait methods on MyClass in %s on line %d
|