xref: /PHP-8.3/Zend/tests/bug62069_2.phpt (revision fff5771c)
1--TEST--
2Bug #62069: binding wrong traits if they have same name methods (variation 2)
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 {
23        func as f1;
24    }
25    use T2 {
26        func as f2;
27    }
28}
29
30$b = new Bar();
31$b->f2();
32
33?>
34--EXPECTF--
35Fatal 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
36