@@ -26,17 +26,17 @@ class DecoderTest extends TestCase
2626 [
2727 'expected ' => ['Foo ' ],
2828 'input ' => [0x1 , 0x4 , // Foo
29- 0x43 , 0x46 , 0x6f , 0x6f , ],
29+ 0x43 , 0x46 , 0x6F , 0x6F , ],
3030 'name ' => 'one element ' ,
3131 ],
3232 [
3333 'expected ' => ['Foo ' , '人 ' ],
3434 'input ' => [
3535 0x2 , 0x4 ,
3636 // Foo
37- 0x43 , 0x46 , 0x6f , 0x6f ,
37+ 0x43 , 0x46 , 0x6F , 0x6F ,
3838 // 人
39- 0x43 , 0xe4 , 0xba , 0xba ,
39+ 0x43 , 0xE4 , 0xBA , 0xBA ,
4040 ],
4141 'name ' => 'two elements ' ,
4242 ],
@@ -93,62 +93,62 @@ class DecoderTest extends TestCase
9393 private $ maps = [
9494 [
9595 'expected ' => [],
96- 'input ' => [0xe0 ],
96+ 'input ' => [0xE0 ],
9797 'name ' => 'empty ' ,
9898 ],
9999 [
100100 'expected ' => ['en ' => 'Foo ' ],
101- 'input ' => [0xe1 , // en
102- 0x42 , 0x65 , 0x6e ,
101+ 'input ' => [0xE1 , // en
102+ 0x42 , 0x65 , 0x6E ,
103103 // Foo
104- 0x43 , 0x46 , 0x6f , 0x6f , ],
104+ 0x43 , 0x46 , 0x6F , 0x6F , ],
105105 'name ' => 'one key ' ,
106106 ],
107107 [
108108 'expected ' => ['en ' => 'Foo ' , 'zh ' => '人 ' ],
109109 'input ' => [
110- 0xe2 ,
110+ 0xE2 ,
111111 // en
112- 0x42 , 0x65 , 0x6e ,
112+ 0x42 , 0x65 , 0x6E ,
113113 // Foo
114- 0x43 , 0x46 , 0x6f , 0x6f ,
114+ 0x43 , 0x46 , 0x6F , 0x6F ,
115115 // zh
116- 0x42 , 0x7a , 0x68 ,
116+ 0x42 , 0x7A , 0x68 ,
117117 // 人
118- 0x43 , 0xe4 , 0xba , 0xba ,
118+ 0x43 , 0xE4 , 0xBA , 0xBA ,
119119 ],
120120 'name ' => 'two keys ' ,
121121 ],
122122 [
123123 'expected ' => ['name ' => ['en ' => 'Foo ' , 'zh ' => '人 ' ]],
124124 'input ' => [
125- 0xe1 ,
125+ 0xE1 ,
126126 // name
127- 0x44 , 0x6e , 0x61 , 0x6d , 0x65 , 0xe2 ,
127+ 0x44 , 0x6E , 0x61 , 0x6D , 0x65 , 0xE2 ,
128128 // en
129- 0x42 , 0x65 , 0x6e ,
129+ 0x42 , 0x65 , 0x6E ,
130130 // Foo
131- 0x43 , 0x46 , 0x6f , 0x6f ,
131+ 0x43 , 0x46 , 0x6F , 0x6F ,
132132 // zh
133- 0x42 , 0x7a , 0x68 ,
133+ 0x42 , 0x7A , 0x68 ,
134134 // 人
135- 0x43 , 0xe4 , 0xba , 0xba ,
135+ 0x43 , 0xE4 , 0xBA , 0xBA ,
136136 ],
137137 'name ' => 'nested ' ,
138138 ],
139139 [
140140 'expected ' => ['languages ' => ['en ' , 'zh ' ]],
141141 'input ' => [
142- 0xe1 ,
142+ 0xE1 ,
143143 // languages
144- 0x49 , 0x6c , 0x61 , 0x6e , 0x67 , 0x75 , 0x61 ,
144+ 0x49 , 0x6C , 0x61 , 0x6E , 0x67 , 0x75 , 0x61 ,
145145 0x67 , 0x65 , 0x73 ,
146146 // array
147147 0x2 , 0x4 ,
148148 // en
149- 0x42 , 0x65 , 0x6e ,
149+ 0x42 , 0x65 , 0x6E ,
150150 // zh
151- 0x42 , 0x7a , 0x68 ,
151+ 0x42 , 0x7A , 0x68 ,
152152 ],
153153 'name ' => 'map with array in it ' ,
154154 ],
@@ -162,17 +162,17 @@ private function pointers(): array
162162 $ v = [
163163 ['expected ' => 0 , 'input ' => [0x20 , 0x0 ]],
164164 ['expected ' => 5 , 'input ' => [0x20 , 0x5 ]],
165- ['expected ' => 10 , 'input ' => [0x20 , 0xa ]],
166- ['expected ' => 1023 , 'input ' => [0x23 , 0xff ]],
167- ['expected ' => 3017 , 'input ' => [0x28 , 0x3 , 0xc9 ]],
168- ['expected ' => 524283 , 'input ' => [0x2f , 0xf7 , 0xfb ]],
169- ['expected ' => 526335 , 'input ' => [0x2f , 0xff , 0xff ]],
170- ['expected ' => 134217726 , 'input ' => [0x37 , 0xf7 , 0xf7 , 0xfe ]],
171- ['expected ' => 2147483647 , 'input ' => [0x38 , 0x7f , 0xff , 0xff , 0xff ]],
165+ ['expected ' => 10 , 'input ' => [0x20 , 0xA ]],
166+ ['expected ' => 1023 , 'input ' => [0x23 , 0xFF ]],
167+ ['expected ' => 3017 , 'input ' => [0x28 , 0x3 , 0xC9 ]],
168+ ['expected ' => 524283 , 'input ' => [0x2F , 0xF7 , 0xFB ]],
169+ ['expected ' => 526335 , 'input ' => [0x2F , 0xFF , 0xFF ]],
170+ ['expected ' => 134217726 , 'input ' => [0x37 , 0xF7 , 0xF7 , 0xFE ]],
171+ ['expected ' => 2147483647 , 'input ' => [0x38 , 0x7F , 0xFF , 0xFF , 0xFF ]],
172172 ];
173173
174174 if (\PHP_INT_MAX > 4294967295 ) {
175- array_push ($ v , ['expected ' => 4294967295 , 'input ' => [0x38 , 0xff , 0xff , 0xff , 0xff ]]);
175+ array_push ($ v , ['expected ' => 4294967295 , 'input ' => [0x38 , 0xFF , 0xFF , 0xFF , 0xFF ]]);
176176 }
177177
178178 return $ v ;
@@ -182,28 +182,28 @@ private function pointers(): array
182182 * @var array<array<string, mixed>>
183183 */
184184 private $ uint16 = [
185- ['expected ' => 0 , 'input ' => [0xa0 ]],
186- ['expected ' => 255 , 'input ' => [0xa1 , 0xff ]],
187- ['expected ' => 500 , 'input ' => [0xa2 , 0x1 , 0xf4 ]],
188- ['expected ' => 10872 , 'input ' => [0xa2 , 0x2a , 0x78 ]],
189- ['expected ' => 65535 , 'input ' => [0xa2 , 0xff , 0xff ]],
185+ ['expected ' => 0 , 'input ' => [0xA0 ]],
186+ ['expected ' => 255 , 'input ' => [0xA1 , 0xFF ]],
187+ ['expected ' => 500 , 'input ' => [0xA2 , 0x1 , 0xF4 ]],
188+ ['expected ' => 10872 , 'input ' => [0xA2 , 0x2A , 0x78 ]],
189+ ['expected ' => 65535 , 'input ' => [0xA2 , 0xFF , 0xFF ]],
190190 ];
191191
192192 /**
193193 * @var array<array<string, mixed>>
194194 */
195195 private $ int32 = [
196196 ['expected ' => 0 , 'input ' => [0x0 , 0x1 ]],
197- ['expected ' => -1 , 'input ' => [0x4 , 0x1 , 0xff , 0xff , 0xff , 0xff ]],
198- ['expected ' => 255 , 'input ' => [0x1 , 0x1 , 0xff ]],
199- ['expected ' => -255 , 'input ' => [0x4 , 0x1 , 0xff , 0xff , 0xff , 0x1 ]],
200- ['expected ' => 500 , 'input ' => [0x2 , 0x1 , 0x1 , 0xf4 ]],
201- ['expected ' => -500 , 'input ' => [0x4 , 0x1 , 0xff , 0xff , 0xfe , 0xc ]],
202- ['expected ' => 65535 , 'input ' => [0x2 , 0x1 , 0xff , 0xff ]],
203- ['expected ' => -65535 , 'input ' => [0x4 , 0x1 , 0xff , 0xff , 0x0 , 0x1 ]],
204- ['expected ' => 16777215 , 'input ' => [0x3 , 0x1 , 0xff , 0xff , 0xff ]],
205- ['expected ' => -16777215 , 'input ' => [0x4 , 0x1 , 0xff , 0x0 , 0x0 , 0x1 ]],
206- ['expected ' => 2147483647 , 'input ' => [0x4 , 0x1 , 0x7f , 0xff , 0xff , 0xff ]],
197+ ['expected ' => -1 , 'input ' => [0x4 , 0x1 , 0xFF , 0xFF , 0xFF , 0xFF ]],
198+ ['expected ' => 255 , 'input ' => [0x1 , 0x1 , 0xFF ]],
199+ ['expected ' => -255 , 'input ' => [0x4 , 0x1 , 0xFF , 0xFF , 0xFF , 0x1 ]],
200+ ['expected ' => 500 , 'input ' => [0x2 , 0x1 , 0x1 , 0xF4 ]],
201+ ['expected ' => -500 , 'input ' => [0x4 , 0x1 , 0xFF , 0xFF , 0xFE , 0xC ]],
202+ ['expected ' => 65535 , 'input ' => [0x2 , 0x1 , 0xFF , 0xFF ]],
203+ ['expected ' => -65535 , 'input ' => [0x4 , 0x1 , 0xFF , 0xFF , 0x0 , 0x1 ]],
204+ ['expected ' => 16777215 , 'input ' => [0x3 , 0x1 , 0xFF , 0xFF , 0xFF ]],
205+ ['expected ' => -16777215 , 'input ' => [0x4 , 0x1 , 0xFF , 0x0 , 0x0 , 0x1 ]],
206+ ['expected ' => 2147483647 , 'input ' => [0x4 , 0x1 , 0x7F , 0xFF , 0xFF , 0xFF ]],
207207 ['expected ' => -2147483647 , 'input ' => [0x4 , 0x1 , 0x80 , 0x0 , 0x0 , 0x1 ]],
208208 ];
209209
@@ -217,42 +217,42 @@ private function strings(): array
217217 ['expected ' => '1 ' , 'input ' => [0x41 , 0x31 ]],
218218 ['expected ' => '人 ' , 'input ' => [0x43 , 0xE4 , 0xBA , 0xBA ]],
219219 ['expected ' => '123 ' , 'input ' => [0x43 , 0x31 , 0x32 , 0x33 ]],
220- ['expected ' => '123456789012345678901234567 ' , 'input ' => [0x5b , 0x31 , 0x32 , 0x33 , 0x34 ,
220+ ['expected ' => '123456789012345678901234567 ' , 'input ' => [0x5B , 0x31 , 0x32 , 0x33 , 0x34 ,
221221 0x35 , 0x36 , 0x37 , 0x38 , 0x39 , 0x30 , 0x31 , 0x32 , 0x33 , 0x34 , 0x35 ,
222222 0x36 , 0x37 , 0x38 , 0x39 , 0x30 , 0x31 , 0x32 , 0x33 , 0x34 , 0x35 , 0x36 ,
223223 0x37 , ]],
224- ['expected ' => '1234567890123456789012345678 ' , 'input ' => [0x5c , 0x31 , 0x32 , 0x33 , 0x34 ,
224+ ['expected ' => '1234567890123456789012345678 ' , 'input ' => [0x5C , 0x31 , 0x32 , 0x33 , 0x34 ,
225225 0x35 , 0x36 , 0x37 , 0x38 , 0x39 , 0x30 , 0x31 , 0x32 , 0x33 , 0x34 , 0x35 ,
226226 0x36 , 0x37 , 0x38 , 0x39 , 0x30 , 0x31 , 0x32 , 0x33 , 0x34 , 0x35 , 0x36 ,
227227 0x37 , 0x38 , ]],
228- ['expected ' => '12345678901234567890123456789 ' , 'input ' => [0x5d , 0x0 , 0x31 , 0x32 , 0x33 ,
228+ ['expected ' => '12345678901234567890123456789 ' , 'input ' => [0x5D , 0x0 , 0x31 , 0x32 , 0x33 ,
229229 0x34 , 0x35 , 0x36 , 0x37 , 0x38 , 0x39 , 0x30 , 0x31 , 0x32 , 0x33 , 0x34 ,
230230 0x35 , 0x36 , 0x37 , 0x38 , 0x39 , 0x30 , 0x31 , 0x32 , 0x33 , 0x34 , 0x35 ,
231231 0x36 , 0x37 , 0x38 , 0x39 , ]],
232- ['expected ' => '123456789012345678901234567890 ' , 'input ' => [0x5d , 0x1 , 0x31 , 0x32 , 0x33 ,
232+ ['expected ' => '123456789012345678901234567890 ' , 'input ' => [0x5D , 0x1 , 0x31 , 0x32 , 0x33 ,
233233 0x34 , 0x35 , 0x36 , 0x37 , 0x38 , 0x39 , 0x30 , 0x31 , 0x32 , 0x33 , 0x34 ,
234234 0x35 , 0x36 , 0x37 , 0x38 , 0x39 , 0x30 , 0x31 , 0x32 , 0x33 , 0x34 , 0x35 ,
235235 0x36 , 0x37 , 0x38 , 0x39 , 0x30 , ]],
236236
237237 ['expected ' => str_repeat ('x ' , 500 ),
238238 'input ' => array_pad (
239- [0x5e , 0x0 , 0xd7 ],
239+ [0x5E , 0x0 , 0xD7 ],
240240 503 ,
241241 0x78
242242 ),
243243 ],
244244 [
245245 'expected ' => str_repeat ('x ' , 2000 ),
246246 'input ' => array_pad (
247- [0x5e , 0x6 , 0xb3 ],
247+ [0x5E , 0x6 , 0xB3 ],
248248 2003 ,
249249 0x78
250250 ),
251251 ],
252252 [
253253 'expected ' => str_repeat ('x ' , 70000 ),
254254 'input ' => array_pad (
255- [0x5f , 0x0 , 0x10 , 0x53 ],
255+ [0x5F , 0x0 , 0x10 , 0x53 ],
256256 70004 ,
257257 0x78
258258 ),
@@ -266,13 +266,13 @@ private function strings(): array
266266 private function uint32 (): array
267267 {
268268 return [
269- ['expected ' => 0 , 'input ' => [0xc0 ]],
270- ['expected ' => 255 , 'input ' => [0xc1 , 0xff ]],
271- ['expected ' => 500 , 'input ' => [0xc2 , 0x1 , 0xf4 ]],
272- ['expected ' => 10872 , 'input ' => [0xc2 , 0x2a , 0x78 ]],
273- ['expected ' => 65535 , 'input ' => [0xc2 , 0xff , 0xff ]],
274- ['expected ' => 16777215 , 'input ' => [0xc3 , 0xff , 0xff , 0xff ]],
275- ['expected ' => \PHP_INT_MAX < 4294967295 ? '4294967295 ' : 4294967295 , 'input ' => [0xc4 , 0xff , 0xff , 0xff , 0xff ]],
269+ ['expected ' => 0 , 'input ' => [0xC0 ]],
270+ ['expected ' => 255 , 'input ' => [0xC1 , 0xFF ]],
271+ ['expected ' => 500 , 'input ' => [0xC2 , 0x1 , 0xF4 ]],
272+ ['expected ' => 10872 , 'input ' => [0xC2 , 0x2A , 0x78 ]],
273+ ['expected ' => 65535 , 'input ' => [0xC2 , 0xFF , 0xFF ]],
274+ ['expected ' => 16777215 , 'input ' => [0xC3 , 0xFF , 0xFF , 0xFF ]],
275+ ['expected ' => \PHP_INT_MAX < 4294967295 ? '4294967295 ' : 4294967295 , 'input ' => [0xC4 , 0xFF , 0xFF , 0xFF , 0xFF ]],
276276 ];
277277 }
278278
@@ -285,7 +285,7 @@ private function bytes(): array
285285 $ bytes = unserialize (serialize ($ this ->strings ()));
286286
287287 foreach ($ bytes as $ key => $ test ) {
288- $ test ['input ' ][0 ] ^= 0xc0 ;
288+ $ test ['input ' ][0 ] ^= 0xC0 ;
289289 }
290290
291291 return $ bytes ;
@@ -297,8 +297,8 @@ public function generateLargeUint(int $bits): array
297297
298298 $ uints = [
299299 0 => [0x0 , $ ctrlByte ],
300- 500 => [0x2 , $ ctrlByte , 0x1 , 0xf4 ],
301- 10872 => [0x2 , $ ctrlByte , 0x2a , 0x78 ],
300+ 500 => [0x2 , $ ctrlByte , 0x1 , 0xF4 ],
301+ 10872 => [0x2 , $ ctrlByte , 0x2A , 0x78 ],
302302 ];
303303
304304 for ($ power = 1 ; $ power <= $ bits / 8 ; ++$ power ) {
@@ -311,7 +311,7 @@ public function generateLargeUint(int $bits): array
311311 }
312312 $ input = [$ power , $ ctrlByte ];
313313 for ($ i = 2 ; $ i < 2 + $ power ; ++$ i ) {
314- $ input [$ i ] = 0xff ;
314+ $ input [$ i ] = 0xFF ;
315315 }
316316 $ uints [$ expected ] = $ input ;
317317 }
0 commit comments