php-src/Zend/tests/traits/bug64235b.phpt
Xinchen Hui 9a44a9806c Fixed bug #64235 (Insteadof not work for class method in 5.4.11)
As we discussed with stefan, we think previous of allowing use with
classes is a bug, should be forbided, anyway, the error message should
be improved.
2013-02-21 18:18:41 +08:00

36 lines
645 B
PHP

--TEST--
Bug #64235 (Insteadof not work for class method in 5.4.11)
--FILE--
<?php
class TestParentClass
{
public function method()
{
print_r('Parent method');
print "\n";
}
}
trait TestTrait
{
public function method()
{
print_r('Trait method');
print "\n";
}
}
class TestChildClass extends TestParentClass
{
use TestTrait
{
TestTrait::method as methodAlias;
TestParentClass::method as TestParent;
}
}
?>
--EXPECTF--
Fatal error: Class TestParentClass is not a trait, Only traits may be used in 'as' and 'insteadof' statements in %sbug64235b.php on line %d