xref: /PHP-8.0/Zend/tests/traits/language014.phpt (revision d9219f99)
1--TEST--
2Aliasing leading to conflict should result in error message
3--FILE--
4<?php
5error_reporting(E_ALL);
6
7trait Hello {
8   public function hello() {
9     echo 'Hello';
10   }
11}
12
13trait World {
14   public function world() {
15     echo ' World!';
16   }
17}
18
19
20class MyClass {
21   use Hello, World { world as hello; }
22}
23
24$o = new MyClass();
25$o->hello();
26$o->world();
27
28?>
29--EXPECTF--
30Fatal error: Trait method World::world has not been applied as MyClass::hello, because of collision with Hello::hello in %s on line %d
31