xref: /PHP-8.0/Zend/tests/traits/language005.phpt (revision f8d79582)
1--TEST--
2Use instead to solve a conflict and as to access the method.
3--FILE--
4<?php
5error_reporting(E_ALL);
6
7trait A {
8   public function smallTalk() {
9     echo 'a';
10   }
11   public function bigTalk() {
12     echo 'A';
13   }
14}
15
16trait B {
17   public function smallTalk() {
18     echo 'b';
19   }
20   public function bigTalk() {
21     echo 'B';
22   }
23}
24
25class Talker {
26    use A, B {
27        B::smallTalk insteadof A;
28        A::bigTalk insteadof B;
29        B::bigTalk as talk;
30    }
31}
32
33$t = new Talker;
34$t->smallTalk();
35$t->bigTalk();
36$t->talk();
37
38?>
39--EXPECT--
40bAB
41