xref: /PHP-5.5/Zend/tests/traits/property003.phpt (revision 7357867b)
1--TEST--
2Conflicting properties with different visibility modifiers should result in a fatal error, since this indicates that the code is incompatible.
3--FILE--
4<?php
5error_reporting(E_ALL);
6
7trait THello1 {
8  public $hello;
9}
10
11trait THello2 {
12  private $hello;
13}
14
15echo "PRE-CLASS-GUARD\n";
16
17class TraitsTest {
18	use THello1;
19	use THello2;
20}
21
22echo "POST-CLASS-GUARD\n";
23
24$t = new TraitsTest;
25$t->hello = "foo";
26?>
27--EXPECTF--
28PRE-CLASS-GUARD
29
30Fatal 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