blob: a41c4e484aa2df30242e5c892d14998b794ee610 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
--TEST--
Trait method overrides base class method and satisfies prototype
--FILE--
<?php
error_reporting(E_ALL);
abstract class Base {
public abstract function sayHello(array $a);
}
class SubClass extends Base {
public function sayHello(array $a) {
echo "World!\n";
}
}
$s = new SubClass();
$s->sayHello(array());
trait SayWorld {
public function sayHello(Base $d) {
echo 'World!';
}
}
class MyHelloWorld extends Base {
use SayWorld;
}
$o = new MyHelloWorld();
$o->sayHello(array());
?>
--EXPECTF--
World!
Fatal error: Declaration of MyHelloWorld::sayHello() must be compatible with Base::sayHello(array $a) in %s on line %d
|