overridding-conflicting-property-initializer.phpt 544 B

1234567891011121314151617181920212223
  1. --TEST--
  2. Properties are considered incompatible if they are different in any of their
  3. defined characteristics. Thus, initialization values have to be equal, too.
  4. --FILE--
  5. <?php
  6. error_reporting(E_ALL);
  7. trait foo
  8. {
  9. public $zoo = 'foo::zoo';
  10. }
  11. class baz
  12. {
  13. use foo;
  14. public $zoo = 'baz::zoo';
  15. }
  16. $obj = new baz();
  17. echo $obj->zoo, "\n";
  18. ?>
  19. --EXPECTF--
  20. Fatal error: baz and foo define the same property ($zoo) in the composition of baz. However, the definition differs and is considered incompatible. Class was composed in %s on line %d