static_003.phpt 419 B

123456789101112131415161718192021222324252627
  1. --TEST--
  2. Traits with late static bindings.
  3. --CREDITS--
  4. Simas Toleikis simast@gmail.com
  5. --FILE--
  6. <?php
  7. trait TestTrait {
  8. public static function test() {
  9. return static::$test;
  10. }
  11. }
  12. class A {
  13. use TestTrait;
  14. protected static $test = "Test A";
  15. }
  16. class B extends A {
  17. protected static $test = "Test B";
  18. }
  19. echo B::test();
  20. ?>
  21. --EXPECT--
  22. Test B