Annotation of embedaddon/php/Zend/tests/traits/language008b.phpt, revision 1.1

1.1     ! misho       1: --TEST--
        !             2: Visibility can be changed with the as aliasing construct as well.
        !             3: --FILE--
        !             4: <?php
        !             5: error_reporting(E_ALL);
        !             6: 
        !             7: trait HelloWorld {
        !             8:    public function sayHello() {
        !             9:      echo 'Hello World!';
        !            10:    }
        !            11: }
        !            12: 
        !            13: class MyClass {
        !            14:    use HelloWorld { sayHello as private sayHelloWorld; }
        !            15: 
        !            16:    public function callPrivateAlias() {
        !            17:       $this->sayHelloWorld();
        !            18:    }
        !            19: }
        !            20: 
        !            21: $o = new MyClass();
        !            22: $o->sayHello();
        !            23: $o->callPrivateAlias();
        !            24: $o->sayHelloWorld();
        !            25: 
        !            26: 
        !            27: ?>
        !            28: --EXPECTF--    
        !            29: Hello World!Hello World!
        !            30: Fatal error: Call to private method MyClass::sayHelloWorld() from context '' in %s on line %d

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>