summaryrefslogtreecommitdiff
path: root/Zend/tests/traits/language004.phpt
blob: cd4f03a1dfb63d0dd6e368f84757aeb955e2e5e1 (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
--TEST--
Use instead to solve a conflict and as to access the method.
--FILE--
<?php
error_reporting(E_ALL);

trait Hello {
   public function saySomething() {
     echo 'Hello';
   }
}

trait World {
   public function saySomething() {
     echo ' World';
   }
}

class MyHelloWorld {
   use Hello, World {
     Hello::saySomething insteadof World;
	 World::saySomething as sayWorld;
   }
}

$o = new MyHelloWorld();
$o->saySomething();
$o->sayWorld();
?>
--EXPECTF--
Hello World