bug60536_004.phpt 818 B

12345678910111213141516171819202122232425262728293031323334
  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. private $hello;
  7. }
  8. trait THello1 {
  9. private $hello;
  10. }
  11. // Now we use the trait, which happens to introduce another private variable
  12. // but they are distinct, and not related to each other, so no warning.
  13. echo "PRE-CLASS-GUARD\n";
  14. class SameNameInSubClassNoNotice extends Base {
  15. use THello1;
  16. }
  17. echo "POST-CLASS-GUARD\n";
  18. // now the same with a class that defines the property itself,
  19. // that should give the expected strict warning.
  20. class Notice extends Base {
  21. use THello1;
  22. private $hello;
  23. }
  24. echo "POST-CLASS-GUARD2\n";
  25. ?>
  26. --EXPECT--
  27. PRE-CLASS-GUARD
  28. POST-CLASS-GUARD
  29. POST-CLASS-GUARD2