xref: /PHP-8.2/Zend/tests/bug60536_004.phpt (revision 0b4778c3)
1--TEST--
2Introducing new private variables of the same name in a subclass is ok, and does not lead to any output. That is consistent with normal inheritance handling. (relevant to #60536)
3--FILE--
4<?php
5
6class Base {
7  private $hello;
8}
9
10trait THello1 {
11  private $hello;
12}
13
14// Now we use the trait, which happens to introduce another private variable
15// but they are distinct, and not related to each other, so no warning.
16echo "PRE-CLASS-GUARD\n";
17class SameNameInSubClassNoNotice extends Base {
18    use THello1;
19}
20echo "POST-CLASS-GUARD\n";
21
22// now the same with a class that defines the property itself,
23// that should give the expected strict warning.
24
25class Notice extends Base {
26    use THello1;
27    private $hello;
28}
29echo "POST-CLASS-GUARD2\n";
30?>
31--EXPECT--
32PRE-CLASS-GUARD
33POST-CLASS-GUARD
34POST-CLASS-GUARD2
35