<?php
trait P1 {
public $x;
}
trait P2 {
use P1;
public $y;
}
trait P3 {
use P2;
public $z;
}
class A {
use P1;
}
class B {
use P2;
}
class C {
use P2;
use P3;
}
$c = new C;
$c->x = 42;
$c->y = 37;
$c->z = 23;
var_dump($c);
Strict Standards: P2 and P3 define the same property ($y) in the composition of C. This might be incompatible, to improve maintainability consider using accessor methods in traits instead. Class was composed in /in/4AlZT on line 23
Strict Standards: P2 and P3 define the same property ($x) in the composition of C. This might be incompatible, to improve maintainability consider using accessor methods in traits instead. Class was composed in /in/4AlZT on line 23
object(C)#1 (3) {
["y"]=>
int(37)
["x"]=>
int(42)
["z"]=>
int(23)
}
Output for 5.4.2 - 5.4.10
Strict Standards: P2 and P3 define the same property ($y) in the composition of C. This might be incompatible, to improve maintainability consider using accessor methods in traits instead. Class was composed in /in/4AlZT on line 23
Strict Standards: P2 and P3 define the same property ($x) in the composition of C. This might be incompatible, to improve maintainability consider using accessor methods in traits instead. Class was composed in /in/4AlZT on line 23
object(C)#1 (3) {
["z"]=>
int(23)
["y"]=>
int(37)
["x"]=>
int(42)
}