summaryrefslogtreecommitdiff
path: root/Zend/tests/traits/language008b.phpt
blob: 8f745126e3cc9346c457317976451f3aabb88325 (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
32
33
--TEST--
Visibility can be changed with the as aliasing construct as well.
--FILE--
<?php
error_reporting(E_ALL);

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

class MyClass {
   use HelloWorld { sayHello as private sayHelloWorld; }

   public function callPrivateAlias() {
      $this->sayHelloWorld();
   }
}

$o = new MyClass();
$o->sayHello();
$o->callPrivateAlias();
$o->sayHelloWorld();


?>
--EXPECTF--	
Hello World!Hello World!
Fatal error: Uncaught Error: Call to private method MyClass::sayHelloWorld() from context '' in %s:%d
Stack trace:
#0 {main}
  thrown in %s on line %d