<?php
trait T
{
static $arr = [];
public static function a()
{
self::$arr[] = 'Tx';
static::$arr[] = 'Ty';
}
}
class C
{
use T;
public static function b()
{
self::$arr[] = 'Cx';
static::$arr[] = 'Cy';
}
}
class D
{
use T;
public static function b()
{
self::$arr[] = 'Dx';
static::$arr[] = 'Dy';
}
}
T::a(); // make no sense
C::a();
C::b();
D::a();
D::b();
assert(C::$arr === ['Tx', 'Ty', 'Cx', 'Cy']);
assert(D::$arr === ['Tx', 'Ty', 'Dx', 'Dy']);
T::a(); // make no sense
assert(C::$arr === ['Tx', 'Ty', 'Cx', 'Cy']);
assert(D::$arr === ['Tx', 'Ty', 'Dx', 'Dy']);
Deprecated: Calling static trait method T::a is deprecated, it should only be called on a class using the trait in /in/ThcGX on line 36
Deprecated: Accessing static trait property T::$arr is deprecated, it should only be accessed on a class using the trait in /in/ThcGX on line 8
Deprecated: Accessing static trait property T::$arr is deprecated, it should only be accessed on a class using the trait in /in/ThcGX on line 9
Deprecated: Calling static trait method T::a is deprecated, it should only be called on a class using the trait in /in/ThcGX on line 47
Deprecated: Accessing static trait property T::$arr is deprecated, it should only be accessed on a class using the trait in /in/ThcGX on line 8
Deprecated: Accessing static trait property T::$arr is deprecated, it should only be accessed on a class using the trait in /in/ThcGX on line 9