Annotation of embedaddon/php/Zend/tests/traits/language006.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Express requirements of a trait by abstract methods.
                      3: --FILE--
                      4: <?php
                      5: error_reporting(E_ALL);
                      6: 
                      7: trait Hello {
                      8:    public function sayHelloWorld() {
                      9:      echo 'Hello'.$this->getWorld();
                     10:    }
                     11:    abstract public function getWorld();
                     12:  }
                     13: 
                     14: class MyHelloWorld {
                     15:    private $world;
                     16:    use Hello;
                     17:    public function getWorld() {
                     18:      return $this->world;
                     19:    }
                     20:    public function setWorld($val) {
                     21:      $this->world = $val;
                     22:    }
                     23: }
                     24: 
                     25: $o = new MyHelloWorld();
                     26: $o->setWorld(' World!');
                     27: $o->sayHelloWorld();
                     28: 
                     29: ?>
                     30: --EXPECTF--    
                     31: Hello World!

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