property004.phpt 601 B

1234567891011121314151617181920212223242526272829
  1. --TEST--
  2. Conflicting properties with different initial values are considered incompatible.
  3. --FILE--
  4. <?php
  5. trait THello1 {
  6. public $hello = "foo";
  7. }
  8. trait THello2 {
  9. private $hello = "bar";
  10. }
  11. echo "PRE-CLASS-GUARD\n";
  12. class TraitsTest {
  13. use THello1;
  14. use THello2;
  15. public function getHello() {
  16. return $this->hello;
  17. }
  18. }
  19. $t = new TraitsTest;
  20. ?>
  21. --EXPECTF--
  22. PRE-CLASS-GUARD
  23. 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