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

1.1       misho       1: --TEST--
                      2: Introducing new private variables of the same name in a subclass is ok, and does not lead to any output. That is consitent with normal inheritance handling. (relevant to #60536)
                      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: // Now we use the trait, which happens to introduce another private variable
                     16: // but they are distinct, and not related to each other, so no warning.
                     17: echo "PRE-CLASS-GUARD\n";
                     18: class SameNameInSubClassNoNotice extends Base {
                     19:     use THello1;
                     20: }
                     21: echo "POST-CLASS-GUARD\n";
                     22: 
                     23: // now the same with a class that defines the property itself,
                     24: // that should give the expected strict warning.
                     25: 
                     26: class Notice extends Base {
                     27:     use THello1;
                     28:     private $hello;
                     29: }
                     30: echo "POST-CLASS-GUARD2\n";
                     31: ?>
                     32: --EXPECTF--    
                     33: PRE-CLASS-GUARD
                     34: POST-CLASS-GUARD
                     35: 
                     36: 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 %sbug60536_004.php on line %d
                     37: POST-CLASS-GUARD2

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