<?php
trait A {
public function smallTalk() {
echo 'a';
}
public function bigTalk() {
echo 'A';
}
}
trait B {
public function smallTalk() {
echo 'b';
}
public function bigTalk() {
echo 'B';
}
}
class Talker {
use A, B {
B::smallTalk insteadof A;
A::bigTalk insteadof B;
}
}
class Aliased_Talker {
use A, B {
B::smallTalk insteadof A;
A::bigTalk insteadof B;
B::bigTalk as talk;
}
}
$obj = new Aliased_Talker();
echo $obj->smallTalk();
echo $obj->bigTalk();
echo $obj->talk();
PD9waHAKdHJhaXQgQSB7CiAgICBwdWJsaWMgZnVuY3Rpb24gc21hbGxUYWxrKCkgewogICAgICAgIGVjaG8gJ2EnOwogICAgfQogICAgcHVibGljIGZ1bmN0aW9uIGJpZ1RhbGsoKSB7CiAgICAgICAgZWNobyAnQSc7CiAgICB9Cn0KCnRyYWl0IEIgewogICAgcHVibGljIGZ1bmN0aW9uIHNtYWxsVGFsaygpIHsKICAgICAgICBlY2hvICdiJzsKICAgIH0KICAgIHB1YmxpYyBmdW5jdGlvbiBiaWdUYWxrKCkgewogICAgICAgIGVjaG8gJ0InOwogICAgfQp9CgpjbGFzcyBUYWxrZXIgewogICAgdXNlIEEsIEIgewogICAgICAgIEI6OnNtYWxsVGFsayBpbnN0ZWFkb2YgQTsKICAgICAgICBBOjpiaWdUYWxrIGluc3RlYWRvZiBCOwogICAgfQp9CgpjbGFzcyBBbGlhc2VkX1RhbGtlciB7CiAgICB1c2UgQSwgQiB7CiAgICAgICAgQjo6c21hbGxUYWxrIGluc3RlYWRvZiBBOwogICAgICAgIEE6OmJpZ1RhbGsgaW5zdGVhZG9mIEI7CiAgICAgICAgQjo6YmlnVGFsayBhcyB0YWxrOwogICAgfQp9Cgokb2JqID0gbmV3IEFsaWFzZWRfVGFsa2VyKCk7CmVjaG8gJG9iai0+c21hbGxUYWxrKCk7CmVjaG8gJG9iai0+YmlnVGFsaygpOwplY2hvICRvYmotPnRhbGsoKTs=