mirror of
https://github.com/php/php-src.git
synced 2024-10-17 14:32:37 +00:00
23 lines
406 B
Plaintext
23 lines
406 B
Plaintext
|
--TEST--
|
||
|
Visibility can be changed with the as aliasing construct as well.
|
||
|
--FILE--
|
||
|
<?php
|
||
|
error_reporting(E_ALL);
|
||
|
|
||
|
trait HelloWorld {
|
||
|
public function sayHello() {
|
||
|
echo 'Hello World!';
|
||
|
}
|
||
|
}
|
||
|
|
||
|
class MyClass {
|
||
|
use HelloWorld { sayHello as protected; }
|
||
|
}
|
||
|
|
||
|
|
||
|
$o = new MyClass;
|
||
|
$o->sayHello();
|
||
|
|
||
|
?>
|
||
|
--EXPECTF--
|
||
|
Fatal error: Call to protected method MyClass::sayHello() from context '' in %s on line %d
|