1--TEST--
2Direct access to static trait members is deprecated
3--FILE--
4<?php
5
6trait T {
7    public static $foo;
8    public static function foo() {
9        echo "Foo\n";
10    }
11    public static function __callStatic($name, $args) {
12        echo "CallStatic($name)\n";
13    }
14}
15
16class C {
17    use T;
18}
19
20function test() {
21    T::$foo = 42;
22    var_dump(T::$foo);
23    T::foo();
24    T::bar();
25    echo "\n";
26}
27
28// Call twice to test cache slot behavior.
29test();
30test();
31
32C::$foo = 42;
33var_dump(C::$foo);
34C::foo();
35C::bar();
36
37?>
38--EXPECTF--
39Deprecated: Accessing static trait property T::$foo is deprecated, it should only be accessed on a class using the trait in %s on line %d
40
41Deprecated: Accessing static trait property T::$foo is deprecated, it should only be accessed on a class using the trait in %s on line %d
42int(42)
43
44Deprecated: Calling static trait method T::foo is deprecated, it should only be called on a class using the trait in %s on line %d
45Foo
46
47Deprecated: Calling static trait method T::bar is deprecated, it should only be called on a class using the trait in %s on line %d
48CallStatic(bar)
49
50
51Deprecated: Accessing static trait property T::$foo is deprecated, it should only be accessed on a class using the trait in %s on line %d
52
53Deprecated: Accessing static trait property T::$foo is deprecated, it should only be accessed on a class using the trait in %s on line %d
54int(42)
55
56Deprecated: Calling static trait method T::foo is deprecated, it should only be called on a class using the trait in %s on line %d
57Foo
58
59Deprecated: Calling static trait method T::bar is deprecated, it should only be called on a class using the trait in %s on line %d
60CallStatic(bar)
61
62int(42)
63Foo
64CallStatic(bar)
65