@@ -15,30 +15,48 @@ function testTrim1(string $value): string {
15
15
return $ value ;
16
16
}
17
17
18
- function testMin2 (int $ value ): int {
18
+ function testMin2First (int $ value ): int {
19
19
$ value = min ($ value , 100 );
20
20
return $ value ;
21
21
}
22
22
23
+ function testMin2Second (int $ value ): int {
24
+ $ value = min (100 , $ value );
25
+ return $ value ;
26
+ }
27
+
23
28
function testMin2_TMP (int $ value ): int {
24
29
$ value = min ($ value + 1 , 100 );
25
30
return $ value ;
26
31
}
27
32
28
- function testStrstr3 (string $ value ): string {
33
+ function testStrstr3First (string $ value ): string {
29
34
$ value = strstr ($ value , "needle " , false );
30
35
return $ value ;
31
36
}
32
37
38
+ function testStrstr3Second (string $ value ): string {
39
+ $ value = strstr ("needles " , $ value , false );
40
+ return $ value ;
41
+ }
42
+
43
+ function testStrstr3Third (bool $ value ): string {
44
+ $ value = strstr ("needles " , "needle " , $ value );
45
+ return $ value ;
46
+ }
47
+
33
48
var_dump (testTrim1 (" boo " ));
34
- var_dump (testMin2 (5 ));
49
+ var_dump (testMin2First (5 ));
50
+ var_dump (testMin2Second (5 ));
35
51
var_dump (testMin2_TMP (5 ));
36
- var_dump (testStrstr3 ("needles " ));
52
+ var_dump (testStrstr3First ("needles " ));
53
+ var_dump (testStrstr3Second ("needle " ));
54
+ var_dump (testStrstr3Third (false ));
37
55
38
56
?>
39
57
--EXPECTF--
40
58
$_main:
41
- ; (lines=25 , args=0, vars=0, tmps=%d)
59
+ ; (lines=43 , args=0, vars=0, tmps=%d)
42
60
; (after optimizer)
43
61
; %s
44
62
0000 INIT_FCALL 1 %d string("var_dump")
@@ -48,24 +66,42 @@ $_main:
48
66
0004 SEND_VAR V0 1
49
67
0005 DO_ICALL
50
68
0006 INIT_FCALL 1 %d string("var_dump")
51
- 0007 INIT_FCALL 1 %d string("testmin2 ")
69
+ 0007 INIT_FCALL 1 112 string("testmin2first ")
52
70
0008 SEND_VAL int(5) 1
53
71
0009 V0 = DO_UCALL
54
72
0010 SEND_VAR V0 1
55
73
0011 DO_ICALL
56
74
0012 INIT_FCALL 1 %d string("var_dump")
57
- 0013 INIT_FCALL 1 %d string("testmin2_tmp ")
75
+ 0013 INIT_FCALL 1 112 string("testmin2second ")
58
76
0014 SEND_VAL int(5) 1
59
77
0015 V0 = DO_UCALL
60
78
0016 SEND_VAR V0 1
61
79
0017 DO_ICALL
62
80
0018 INIT_FCALL 1 %d string("var_dump")
63
- 0019 INIT_FCALL 1 %d string("teststrstr3 ")
64
- 0020 SEND_VAL string("needles" ) 1
81
+ 0019 INIT_FCALL 1 112 string("testmin2_tmp ")
82
+ 0020 SEND_VAL int(5 ) 1
65
83
0021 V0 = DO_UCALL
66
84
0022 SEND_VAR V0 1
67
85
0023 DO_ICALL
68
- 0024 RETURN int(1)
86
+ 0024 INIT_FCALL 1 96 string("var_dump")
87
+ 0025 INIT_FCALL 1 112 string("teststrstr3first")
88
+ 0026 SEND_VAL string("needles") 1
89
+ 0027 V0 = DO_UCALL
90
+ 0028 SEND_VAR V0 1
91
+ 0029 DO_ICALL
92
+ 0030 INIT_FCALL 1 96 string("var_dump")
93
+ 0031 INIT_FCALL 1 112 string("teststrstr3second")
94
+ 0032 SEND_VAL string("needle") 1
95
+ 0033 V0 = DO_UCALL
96
+ 0034 SEND_VAR V0 1
97
+ 0035 DO_ICALL
98
+ 0036 INIT_FCALL 1 96 string("var_dump")
99
+ 0037 INIT_FCALL 1 112 string("teststrstr3third")
100
+ 0038 SEND_VAL bool(false) 1
101
+ 0039 V0 = DO_UCALL
102
+ 0040 SEND_VAR V0 1
103
+ 0041 DO_ICALL
104
+ 0042 RETURN int(1)
69
105
70
106
testTrim1:
71
107
; (lines=4, args=1, vars=1, tmps=%d)
@@ -76,7 +112,7 @@ testTrim1:
76
112
0002 ASSIGN CV0($value) T1
77
113
0003 RETURN CV0($value)
78
114
79
- testMin2 :
115
+ testMin2First :
80
116
; (lines=5, args=1, vars=1, tmps=%d)
81
117
; (after optimizer)
82
118
; %s
@@ -86,6 +122,16 @@ testMin2:
86
122
0003 VERIFY_RETURN_TYPE CV0($value)
87
123
0004 RETURN CV0($value)
88
124
125
+ testMin2Second:
126
+ ; (lines=5, args=1, vars=1, tmps=%d)
127
+ ; (after optimizer)
128
+ ; %s
129
+ 0000 CV0($value) = RECV 1
130
+ 0001 T1 = FRAMELESS_ICALL_2(min) int(100) CV0($value)
131
+ 0002 CV0($value) = QM_ASSIGN T1
132
+ 0003 VERIFY_RETURN_TYPE CV0($value)
133
+ 0004 RETURN CV0($value)
134
+
89
135
testMin2_TMP:
90
136
; (lines=5, args=1, vars=1, tmps=%d)
91
137
; (after optimizer)
@@ -96,7 +142,7 @@ testMin2_TMP:
96
142
0003 VERIFY_RETURN_TYPE CV0($value)
97
143
0004 RETURN CV0($value)
98
144
99
- testStrstr3 :
145
+ testStrstr3First :
100
146
; (lines=6, args=1, vars=1, tmps=%d)
101
147
; (after optimizer)
102
148
; %s
@@ -106,9 +152,38 @@ testStrstr3:
106
152
0003 ASSIGN CV0($value) T1
107
153
0004 VERIFY_RETURN_TYPE CV0($value)
108
154
0005 RETURN CV0($value)
155
+ LIVE RANGES:
156
+ 1: 0002 - 0003 (tmp/var)
157
+
158
+ testStrstr3Second:
159
+ ; (lines=6, args=1, vars=1, tmps=%d)
160
+ ; (after optimizer)
161
+ ; %s
162
+ 0000 CV0($value) = RECV 1
163
+ 0001 T1 = FRAMELESS_ICALL_3(strstr) string("needles") CV0($value)
164
+ 0002 OP_DATA bool(false)
165
+ 0003 ASSIGN CV0($value) T1
166
+ 0004 VERIFY_RETURN_TYPE CV0($value)
167
+ 0005 RETURN CV0($value)
168
+ LIVE RANGES:
169
+ 1: 0002 - 0003 (tmp/var)
170
+
171
+ testStrstr3Third:
172
+ ; (lines=6, args=1, vars=1, tmps=%d)
173
+ ; (after optimizer)
174
+ ; %s
175
+ 0000 CV0($value) = RECV 1
176
+ 0001 T1 = FRAMELESS_ICALL_3(strstr) string("needles") string("needle")
177
+ 0002 OP_DATA CV0($value)
178
+ 0003 CV0($value) = QM_ASSIGN T1
179
+ 0004 VERIFY_RETURN_TYPE CV0($value)
180
+ 0005 RETURN CV0($value)
109
181
LIVE RANGES:
110
182
1: 0002 - 0003 (tmp/var)
111
183
string(3) "boo"
112
184
int(5)
185
+ int(5)
113
186
int(6)
114
187
string(7) "needles"
188
+ string(7) "needles"
189
+ string(7) "needles"
0 commit comments