xref: /PHP-8.4/Zend/tests/traits/bug76773.phpt (revision af15923b)
1--TEST--
2Bug #76773 (Traits used on the parent are ignored for child classes)
3--FILE--
4<?php
5
6trait MyTrait
7{
8    public function hello()
9    {
10        echo __CLASS__, "\n";
11
12        if (get_parent_class(__CLASS__) !== false) {
13            parent::hello();
14        }
15    }
16}
17
18class ParentClass
19{
20    use MyTrait;
21}
22
23class ChildClass extends ParentClass
24{
25    use MyTrait;
26}
27
28$c = new ChildClass();
29$c->hello();
30?>
31--EXPECT--
32ChildClass
33ParentClass
34