summaryrefslogtreecommitdiff
path: root/Zend/tests/traits/inheritance001.phpt
blob: e8195c4749c40d6acc3ef3b04aa533f8cef80a2f (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!