blob: 5ab676853f20e21b197f2ae94d2b376f1fc4cfed (
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
|
--TEST--
Traits can fulfill the requirements of abstract base classes.
--FILE--
<?php
error_reporting(E_ALL);
abstract class Base {
abstract function sayWorld();
}
trait Hello {
public function sayHello() {
echo 'Hello';
}
public function sayWorld() {
echo ' World!';
}
}
class MyHelloWorld extends Base {
use Hello;
}
$o = new MyHelloWorld();
$o->sayHello();
$o->sayWorld();
?>
--EXPECT--
Hello World!
|