xref: /PHP-8.0/Zend/tests/bug62069.phpt (revision fff5771c)
1--TEST--
2Bug #62069: binding wrong traits if they have same name methods
3--FILE--
4<?php
5
6trait T1 {
7    public function func() {
8        echo "From T1\n";
9    }
10}
11
12trait T2 {
13    public function func() {
14        echo "From T2\n";
15    }
16}
17
18class Bar {
19    public function func() {
20        echo "From Bar\n";
21    }
22    use T1, T2 {
23        func as f1;
24    }
25}
26
27$b = new Bar();
28$b->f2();
29
30?>
31--EXPECTF--
32Fatal error: An alias was defined for method func(), which exists in both T1 and T2. Use T1::func or T2::func to resolve the ambiguity in %s on line %d
33