summaryrefslogtreecommitdiff
path: root/Zend/tests/traits/inheritance001.phpt
blob: 22d4ba666a1a030781116efcffbed53d0a803746 (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
--TEST--
Trait method overwridden by a method defined in the class.
--FILE--
<?php
error_reporting(E_ALL);

trait HelloWorld {
   public function sayHello() {
     echo 'Hello World!';
   }
}

class TheWorldIsNotEnough {
   use HelloWorld;
   public function sayHello() {
     echo 'Hello Universe!';
   }
}

$o = new TheWorldIsNotEnough();
$o->sayHello(); // echos Hello Universe!
?>
--EXPECTF--
Hello Universe!