xref: /PHP-7.2/ext/reflection/tests/bug63399.phpt (revision 7886f46b)
1--TEST--
2Bug #63399 (ReflectionClass::getTraitAliases() incorrectly resolves traitnames)
3--FILE--
4<?php
5trait Trait1 {
6        public function run() {}
7        public function say() {}
8}
9
10trait Trait2 {
11        public function run() {}
12        public function say() {}
13}
14
15class MyClass
16{
17    use Trait1, Trait2 {
18        Trait1::run as execute;
19        Trait1::say insteadof Trait2;
20        Trait2::run insteadof Trait1;
21        Trait2::say as talk;
22    }
23}
24
25$ref = new ReflectionClass('MyClass');
26
27print_r($ref->getTraitAliases());
28print_r($ref->getTraits());
29
30?>
31--EXPECT--
32Array
33(
34    [execute] => Trait1::run
35    [talk] => Trait2::say
36)
37Array
38(
39    [Trait1] => ReflectionClass Object
40        (
41            [name] => Trait1
42        )
43
44    [Trait2] => ReflectionClass Object
45        (
46            [name] => Trait2
47        )
48
49)
50