summaryrefslogtreecommitdiff
path: root/Zend/tests/traits/inheritance001.phpt
blob: 90cad90c46fc600d16344938d86ed6d357bbcb94 (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!
?>
--EXPECT--
Hello Universe!