php-src/Zend/tests/traits/language008a.phpt
Stefan Marr b501570ab0 Added traits test cases. No engine changes for now. [TRAITS]
#Getting accustomed to the infrastructure.
#Any comments are welcome, especially with regard to syntax and keywords.
2010-04-15 21:39:20 +00:00

23 lines
406 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 protected; }
}
$o = new MyClass;
$o->sayHello();
?>
--EXPECTF--
Fatal error: Call to protected method MyClass::sayHello() from context '' in %s on line %d