3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php trait Trait1 { public function init() { echo("Trait1 - init\n"); } } trait Trait2 { public function init() { echo("Trait2 - init\n"); } } class Test { use Trait1, Trait2 { Trait1::init as private method1trait1; Trait2::init insteadof Trait1; } final public function __construct() { $this->init(); $this->method1trait1(); } } $test = new Test(); $reflection = new ReflectionClass( $test ); foreach($reflection->getTraitAliases() as $k => $v) { echo $k.' => '.$v."\n"; }
based on bbc88
Output for 5.6.0 - 5.6.30, hhvm-3.15.4, 7.0.0 - 7.2.0
Trait2 - init Trait1 - init method1trait1 => Trait1::init