xref: /PHP-8.1/Zend/tests/traits/language003.phpt (revision d679f022)
1--TEST--
2Use instead to solve a conflict.
3--FILE--
4<?php
5error_reporting(E_ALL);
6
7trait Hello {
8   public function saySomething() {
9     echo 'Hello';
10   }
11}
12
13trait World {
14   public function saySomething() {
15     echo 'World';
16   }
17}
18
19class MyHelloWorld {
20   use Hello, World {
21     Hello::saySomething insteadof World;
22   }
23}
24
25$o = new MyHelloWorld();
26$o->saySomething();
27?>
28--EXPECT--
29Hello
30