property003.phpt 625 B

1234567891011121314151617181920212223242526272829
  1. --TEST--
  2. Conflicting properties with different visibility modifiers should result in a fatal error, since this indicates that the code is incompatible.
  3. --FILE--
  4. <?php
  5. trait THello1 {
  6. public $hello;
  7. }
  8. trait THello2 {
  9. private $hello;
  10. }
  11. echo "PRE-CLASS-GUARD\n";
  12. class TraitsTest {
  13. use THello1;
  14. use THello2;
  15. }
  16. echo "POST-CLASS-GUARD\n";
  17. $t = new TraitsTest;
  18. $t->hello = "foo";
  19. ?>
  20. --EXPECTF--
  21. PRE-CLASS-GUARD
  22. Fatal error: THello1 and THello2 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