bug60536_005.phpt 794 B

123456789101112131415161718192021222324252627282930313233
  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 consistent with normal inheritance handling. (relevant to #60536)
  3. --FILE--
  4. <?php
  5. class Base {
  6. protected $hello;
  7. }
  8. trait THello1 {
  9. protected $hello;
  10. }
  11. // Protected and public are handle more strict with a warning then what is
  12. // expected from normal inheritance since they can have easier coliding semantics
  13. echo "PRE-CLASS-GUARD\n";
  14. class SameNameInSubClassProducesNotice extends Base {
  15. use THello1;
  16. }
  17. echo "POST-CLASS-GUARD\n";
  18. // now the same with a class that defines the property itself, too.
  19. class Notice extends Base {
  20. use THello1;
  21. protected $hello;
  22. }
  23. echo "POST-CLASS-GUARD2\n";
  24. ?>
  25. --EXPECT--
  26. PRE-CLASS-GUARD
  27. POST-CLASS-GUARD
  28. POST-CLASS-GUARD2