Annotation of embedaddon/php/Zend/tests/traits/property007.phpt, revision 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.
! 3: --FILE--
! 4: <?php
! 5: error_reporting(E_ALL | E_STRICT);
! 6:
! 7: class Base {
! 8: protected $hello;
! 9: }
! 10:
! 11: trait THello1 {
! 12: protected $hello;
! 13: }
! 14:
! 15: // Protected and public are handle more strict with a warning then what is
! 16: // expected from normal inheritance since they can have easier coliding semantics
! 17: echo "PRE-CLASS-GUARD\n";
! 18: class SameNameInSubClassProducesNotice 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, too.
! 24:
! 25: class Notice extends Base {
! 26: use THello1;
! 27: protected $hello;
! 28: }
! 29: echo "POST-CLASS-GUARD2\n";
! 30: ?>
! 31: --EXPECTF--
! 32: PRE-CLASS-GUARD
! 33:
! 34: Strict Standards: Base and THello1 define the same property ($hello) in the composition of SameNameInSubClassProducesNotice. This might be incompatible, to improve maintainability consider using accessor methods in traits instead. Class was composed in %s on line %d
! 35: POST-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-GUARD2
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>