xref: /PHP-8.4/ext/opcache/tests/jit/gh15652.phpt (revision 1e78cf94)
1--TEST--
2JIT: FETCH_OBJ 007
3--INI--
4opcache.enable=1
5opcache.enable_cli=1
6opcache.file_update_protection=0
7opcache.jit_buffer_size=1M
8opcache.jit_hot_func=2
9--FILE--
10<?php
11class C {}
12
13trait T {
14    public function equal(C $type): bool {
15        return $type instanceof self && $this->value === $type->value;
16    }
17}
18
19class C1 extends C {
20    use T;
21    public function __construct(private int $value) {}
22}
23
24class C2 extends C {
25    use T;
26}
27
28$x = new C1(1);
29var_dump($x->equal($x));
30var_dump($x->equal($x));
31$a = new C2("aaa");
32var_dump($a->equal($a));
33var_dump($a->equal($a));
34--EXPECTF--
35bool(true)
36bool(true)
37
38Warning: Undefined property: C2::$value in %sgh15652.php on line 6
39
40Warning: Undefined property: C2::$value in %sgh15652.php on line 6
41bool(true)
42
43Warning: Undefined property: C2::$value in %sgh15652.php on line 6
44
45Warning: Undefined property: C2::$value in %sgh15652.php on line 6
46bool(true)