property002.phpt 484 B

12345678910111213141516171819202122232425262728293031
  1. --TEST--
  2. Non-conflicting properties should work just fine.
  3. --FILE--
  4. <?php
  5. trait THello1 {
  6. public $hello = "hello";
  7. }
  8. trait THello2 {
  9. private $world = "World!";
  10. }
  11. class TraitsTest {
  12. use THello1;
  13. use THello2;
  14. function test() {
  15. echo $this->hello . ' ' . $this->world;
  16. }
  17. }
  18. var_dump(property_exists('TraitsTest', 'hello'));
  19. var_dump(property_exists('TraitsTest', 'world'));
  20. $t = new TraitsTest;
  21. $t->test();
  22. ?>
  23. --EXPECT--
  24. bool(true)
  25. bool(true)
  26. hello World!