# This was not tested and documented yet.
# Updated documentation in the RFC http://wiki.php.net/rfc/horizontalreuse
--- /dev/null
+--TEST--\r
+Traits with static methods.\r
+--CREDITS--\r
+Simas Toleikis simast@gmail.com\r
+--FILE--\r
+<?php\r
+\r
+ trait TestTrait {\r
+ public static function test() {\r
+ return 'Test';\r
+ }\r
+ }\r
+\r
+ class A {\r
+ use TestTrait;\r
+ }\r
+\r
+ echo A::test();\r
+\r
+?>\r
+--EXPECT--\r
+Test
\ No newline at end of file
--- /dev/null
+--TEST--\r
+Traits with static methods referenced using variable.\r
+--CREDITS--\r
+Simas Toleikis simast@gmail.com\r
+--FILE--\r
+<?php\r
+\r
+ trait TestTrait {\r
+ public static function test() {\r
+ return 'Test';\r
+ }\r
+ }\r
+\r
+ class A {\r
+ use TestTrait;\r
+ }\r
+\r
+ $class = "A";\r
+ echo $class::test();\r
+\r
+?>\r
+--EXPECT--\r
+Test
\ No newline at end of file
--- /dev/null
+--TEST--\r
+Traits with late static bindings.\r
+--CREDITS--\r
+Simas Toleikis simast@gmail.com\r
+--FILE--\r
+<?php\r
+\r
+ trait TestTrait {\r
+ public static function test() {\r
+ return static::$test;\r
+ }\r
+ }\r
+\r
+ class A {\r
+ use TestTrait;\r
+ protected static $test = "Test A";\r
+ }\r
+\r
+ class B extends A {\r
+ protected static $test = "Test B";\r
+ }\r
+\r
+ echo B::test();\r
+\r
+?>\r
+--EXPECT--\r
+Test B
\ No newline at end of file
--- /dev/null
+--TEST--\r
+Traits with __callStatic magic method.\r
+--CREDITS--\r
+Simas Toleikis simast@gmail.com\r
+--FILE--\r
+<?php\r
+\r
+ trait TestTrait {\r
+ public static function __callStatic($name, $arguments) {\r
+ return $name;\r
+ }\r
+ }\r
+\r
+ class A {\r
+ use TestTrait;\r
+ }\r
+\r
+ echo A::Test();\r
+\r
+?>\r
+--EXPECT--\r
+Test
\ No newline at end of file
--- /dev/null
+--TEST--\r
+Traits and forward_static_call().\r
+--CREDITS--\r
+Simas Toleikis simast@gmail.com\r
+--FILE--\r
+<?php\r
+\r
+ trait TestTrait {\r
+ public static function test() {\r
+ return 'Forwarded '.forward_static_call(array('A', 'test'));\r
+ }\r
+ }\r
+\r
+ class A {\r
+ public static function test() {\r
+ return "Test A";\r
+ }\r
+ }\r
+\r
+ class B extends A {\r
+ use TestTrait;\r
+ }\r
+\r
+ echo B::test();\r
+\r
+?>\r
+--EXPECT--\r
+Forwarded Test A
\ No newline at end of file
--- /dev/null
+--TEST--\r
+Traits and get_called_class().\r
+--CREDITS--\r
+Simas Toleikis simast@gmail.com\r
+--FILE--\r
+<?php\r
+\r
+ trait TestTrait {\r
+ public static function test() {\r
+ return get_called_class();\r
+ }\r
+ }\r
+\r
+ class A {\r
+ use TestTrait;\r
+ }\r
+\r
+ class B extends A { }\r
+\r
+ echo B::test();\r
+\r
+?>\r
+--EXPECT--\r
+B
\ No newline at end of file