xref: /PHP-8.2/Zend/tests/traits/property004.phpt (revision f8d79582)
1--TEST--
2Conflicting properties with different initial values are considered incompatible.
3--FILE--
4<?php
5
6trait THello1 {
7  public $hello = "foo";
8}
9
10trait THello2 {
11  private $hello = "bar";
12}
13
14echo "PRE-CLASS-GUARD\n";
15
16class TraitsTest {
17    use THello1;
18    use THello2;
19    public function getHello() {
20        return $this->hello;
21    }
22}
23
24$t = new TraitsTest;
25?>
26--EXPECTF--
27PRE-CLASS-GUARD
28
29Fatal 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
30