1--TEST--
2Test type inference of class consts - reference by static and self
3--INI--
4opcache.enable=1
5opcache.enable_cli=1
6opcache.optimization_level=-1
7opcache.opt_debug_level=0x20000
8opcache.preload=
9zend_test.observer.enabled=0
10--EXTENSIONS--
11opcache
12--FILE--
13<?php
14
15class Test1 {
16    public const FOO = 42;
17    public final const BAR = 42;
18    public const int BAZ = 42;
19
20    public function getSelfFoo(): int {
21        return self::FOO;
22    }
23
24    public function getSelfBar(): int {
25        return self::BAR;
26    }
27
28    public function getSelfBaz(): int {
29        return self::BAZ;
30    }
31
32    public function getStaticFoo(): int {
33        return static::FOO;
34    }
35
36    public function getStaticBar(): int {
37        return static::BAR;
38    }
39
40    public function getStaticBaz(): int {
41        return static::BAZ;
42    }
43}
44
45?>
46--EXPECTF--
47$_main:
48     ; (lines=1, args=0, vars=0, tmps=0)
49     ; (after optimizer)
50     ; %s
510000 RETURN int(1)
52
53Test1::getSelfFoo:
54     ; (lines=1, args=0, vars=0, tmps=0)
55     ; (after optimizer)
56     ; %s
570000 RETURN int(42)
58
59Test1::getSelfBar:
60     ; (lines=1, args=0, vars=0, tmps=0)
61     ; (after optimizer)
62     ; %s
630000 RETURN int(42)
64
65Test1::getSelfBaz:
66     ; (lines=1, args=0, vars=0, tmps=0)
67     ; (after optimizer)
68     ; %s
690000 RETURN int(42)
70
71Test1::getStaticFoo:
72     ; (lines=3, args=0, vars=0, tmps=1)
73     ; (after optimizer)
74     ; %s
750000 T0 = FETCH_CLASS_CONSTANT (static) (exception) string("FOO")
760001 VERIFY_RETURN_TYPE T0
770002 RETURN T0
78LIVE RANGES:
79     0: 0001 - 0002 (tmp/var)
80
81Test1::getStaticBar:
82     ; (lines=1, args=0, vars=0, tmps=0)
83     ; (after optimizer)
84     ; %s
850000 RETURN int(42)
86
87Test1::getStaticBaz:
88     ; (lines=2, args=0, vars=0, tmps=1)
89     ; (after optimizer)
90     ; %s
910000 T0 = FETCH_CLASS_CONSTANT (static) (exception) string("BAZ")
920001 RETURN T0
93