1--TEST--
2Test semi-reserved method and constant names and trait conflict resolution
3--FILE--
4<?php
5
6trait TraitA
7{
8    public function catch(){ echo __METHOD__, PHP_EOL; }
9    private function list(){ echo __METHOD__, PHP_EOL; }
10}
11
12trait TraitB
13{
14    static $list = ['a' => ['b' => ['c']]];
15
16    public static function catch(){ echo __METHOD__, PHP_EOL; }
17    private static function throw(){ echo __METHOD__, PHP_EOL; }
18    private static function self(){ echo __METHOD__, PHP_EOL; }
19}
20
21trait TraitC
22{
23    public static function exit(){ echo __METHOD__, PHP_EOL; }
24    protected static function try(){ echo __METHOD__, PHP_EOL; }
25}
26
27class Foo
28{
29    use TraitA, TraitB {
30        TraitA
31            ::
32            catch insteadof namespace\TraitB;
33        TraitA::list as public foreach;
34        TraitB::throw as public;
35        TraitB::self as public;
36    }
37
38    use TraitC {
39        try as public attempt;
40        exit as die;
41        \TraitC::exit as bye;
42        namespace\TraitC::exit as byebye;
43        TraitC
44            ::
45            exit as farewell;
46    }
47}
48
49(new Foo)->catch();
50(new Foo)->foreach();
51Foo::throw();
52Foo::self();
53var_dump(Foo::$list['a']);
54Foo::attempt();
55Foo::die();
56Foo::bye();
57Foo::byebye();
58Foo::farewell();
59
60echo "\nDone\n";
61?>
62--EXPECT--
63TraitA::catch
64TraitA::list
65TraitB::throw
66TraitB::self
67array(1) {
68  ["b"]=>
69  array(1) {
70    [0]=>
71    string(1) "c"
72  }
73}
74TraitC::try
75TraitC::exit
76TraitC::exit
77TraitC::exit
78TraitC::exit
79
80Done
81