mirror of
https://github.com/php/php-src.git
synced 2024-10-17 14:32:37 +00:00
b501570ab0
#Getting accustomed to the infrastructure. #Any comments are welcome, especially with regard to syntax and keywords.
30 lines
569 B
PHP
30 lines
569 B
PHP
--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 private sayHelloWorld; }
|
|
|
|
public function callPrivateAlias() {
|
|
$this->sayHelloWorld();
|
|
}
|
|
}
|
|
|
|
$o = new MyClass();
|
|
$o->sayHello();
|
|
$o->callPrivateAlias();
|
|
$o->sayHelloWorld();
|
|
|
|
|
|
?>
|
|
--EXPECTF--
|
|
Hello World!Hello World!
|
|
Fatal error: Call to private method MyClass::sayHelloWorld() from context '' in %s on line %d
|