xref: /php-src/Zend/tests/gh14009_001.phpt (revision c6b75f93)
1--TEST--
2GH-14009: Traits inherit prototype
3--FILE--
4<?php
5
6class P {
7    protected function common() {
8        throw new Exception('Unreachable');
9    }
10}
11
12class A extends P {
13    public function test(P $sibling) {
14        $sibling->common();
15    }
16}
17
18class B extends P {
19    protected function common() {
20        echo __METHOD__, "\n";
21    }
22}
23
24trait T {
25    protected function common() {
26        echo __METHOD__, "\n";
27    }
28}
29
30class C extends P {
31    use T;
32}
33
34$a = new A();
35$a->test(new B());
36$a->test(new C());
37
38?>
39--EXPECT--
40B::common
41T::common
42