<?php
trait Test {
private $bridge;
public function implement()
{
if (!isset($this->final)){
parent::implement();
}
echo $this->foo;
}
}
class A {
use Test;
private $foo = 'bar';
private $final = 1;
public function __construct()
{
$this->implement();
}
public function foo()
{
echo $this->bridge;
}
}
class B extends A {
use Test;
private $foo = 'foo';
}
class C extends B {
use Test;
private $foo = 'buz';
}
new C();