xref: /PHP-8.1/Zend/tests/traits/bug64235.phpt (revision 9a44a980)
1--TEST--
2Bug #64235 (Insteadof not work for class method in 5.4.11)
3--FILE--
4<?php
5
6class TestParentClass
7{
8    public function method()
9    {
10        print_r('Parent method');
11        print "\n";
12    }
13}
14
15trait TestTrait
16{
17    public function method()
18    {
19        print_r('Trait method');
20        print "\n";
21    }
22}
23
24class TestChildClass extends TestParentClass
25{
26    use TestTrait
27    {
28        TestTrait::method as methodAlias;
29        TestParentClass::method insteadof TestTrait;
30    }
31}
32?>
33--EXPECTF--
34Fatal error: Class TestParentClass is not a trait, Only traits may be used in 'as' and 'insteadof' statements in %sbug64235.php on line %d
35