Skip to content

Instantly share code, notes, and snippets.

@sotarok
Created September 18, 2010 11:48
Show Gist options
  • Save sotarok/585598 to your computer and use it in GitHub Desktop.
Save sotarok/585598 to your computer and use it in GitHub Desktop.
<?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';
}
}
trait C
{
use A, B {
B::smallTalk insteadof A;
A::bigTalk insteadof B;
B::bigTalk as talk;
}
}
class Talker
{
use A, B {
B::smallTalk insteadof A;
A::bigTalk insteadof B;
B::bigTalk as talk;
}
}
class Talker2
{
use C;
}
$t = new Talker();
$t->smallTalk();
$t2 = new Talker2();
$t2->smallTalk();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment