xref: /PHP-8.1/Zend/tests/traits/property002.phpt (revision f8d79582)
1--TEST--
2Non-conflicting properties should work just fine.
3--FILE--
4<?php
5
6trait THello1 {
7  public $hello = "hello";
8}
9
10trait THello2 {
11  private $world = "World!";
12}
13
14class TraitsTest {
15    use THello1;
16    use THello2;
17    function test() {
18        echo $this->hello . ' ' . $this->world;
19    }
20}
21
22var_dump(property_exists('TraitsTest', 'hello'));
23var_dump(property_exists('TraitsTest', 'world'));
24
25$t = new TraitsTest;
26$t->test();
27?>
28--EXPECT--
29bool(true)
30bool(true)
31hello World!
32