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