xref: /PHP-7.2/Zend/tests/traits/conflict002.phpt (revision f1d7e3ca)
1--TEST--
2Overwridden methods do not cause a conflict.
3--FILE--
4<?php
5error_reporting(E_ALL);
6
7trait HelloWorld {
8   public function sayHello() {
9     echo 'Hello World!';
10   }
11}
12
13trait HelloWorld2 {
14   public function sayHello() {
15     echo 'Hello World2!';
16   }
17}
18
19
20class TheWorldIsNotEnough {
21   use HelloWorld;
22   use HelloWorld2;
23   public function sayHello() {
24     echo 'Hello Universe!';
25   }
26}
27
28$o = new TheWorldIsNotEnough();
29$o->sayHello(); // echos Hello Universe!
30?>
31--EXPECTF--
32Hello Universe!
33