language008a.phpt 406 B

1234567891011121314151617181920212223
  1. --TEST--
  2. Visibility can be changed with the as aliasing construct as well.
  3. --FILE--
  4. <?php
  5. error_reporting(E_ALL);
  6. trait HelloWorld {
  7. public function sayHello() {
  8. echo 'Hello World!';
  9. }
  10. }
  11. class MyClass {
  12. use HelloWorld { sayHello as protected; }
  13. }
  14. $o = new MyClass;
  15. $o->sayHello();
  16. ?>
  17. --EXPECTF--
  18. Fatal error: Call to protected method MyClass::sayHello() from context '' in %s on line %d