xref: /PHP-7.2/Zend/tests/bug55086.phpt (revision 0124c286)
1--TEST--
2Bug #55086 (Namespace alias does not work inside trait's use block)
3--FILE--
4<?php
5namespace N1 {
6
7    trait T1 {
8        public function hello() { return 'hello from t1'; }
9    }
10
11    trait T2 {
12        public function hello() { return 'hello from t2'; }
13    }
14
15}
16namespace N2 {
17    use N1\T1;
18    use N1\T2;
19    class A {
20        use T1, T2 {
21            T1::hello insteadof T2;
22            T1::hello as foo;
23        }
24    }
25    $a = new A;
26    echo $a->hello(), PHP_EOL;
27    echo $a->foo(), PHP_EOL;
28    try {
29    } catch(namespace \Foo $e)
30    {
31    }
32}
33?>
34--EXPECT--
35hello from t1
36hello from t1
37