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

1.1     ! misho       1: --TEST--
        !             2: The same rules are applied for properties that are defined in the class hierarchy. Thus, if the properties are compatible, a notice is issued, if not a fatal error occures.
        !             3: --FILE--
        !             4: <?php
        !             5: error_reporting(E_ALL | E_STRICT);
        !             6: 
        !             7: class Base {
        !             8:   private $hello;    
        !             9: }
        !            10: 
        !            11: trait THello1 {
        !            12:   private $hello;
        !            13: }
        !            14: 
        !            15: echo "PRE-CLASS-GUARD\n";
        !            16: class Notice extends Base {
        !            17:     use THello1;
        !            18:     private $hello;
        !            19: }
        !            20: echo "POST-CLASS-GUARD\n";
        !            21: 
        !            22: // now we do the test for a fatal error
        !            23: 
        !            24: class TraitsTest {
        !            25:        use THello1;
        !            26:     public $hello;
        !            27: }
        !            28: 
        !            29: echo "POST-CLASS-GUARD2\n";
        !            30: 
        !            31: $t = new TraitsTest;
        !            32: $t->hello = "foo";
        !            33: ?>
        !            34: --EXPECTF--    
        !            35: PRE-CLASS-GUARD
        !            36: 
        !            37: Strict Standards: Notice and THello1 define the same property ($hello) in the composition of Notice. This might be incompatible, to improve maintainability consider using accessor methods in traits instead. Class was composed in %s on line %d
        !            38: POST-CLASS-GUARD
        !            39: 
        !            40: Fatal error: TraitsTest and THello1 define the same property ($hello) in the composition of TraitsTest. However, the definition differs and is considered incompatible. Class was composed in %s on line %d

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