99
1010/**
1111 * @coversNothing
12+ *
13+ * @internal
1214 */
1315class DecoderTest extends TestCase
1416{
@@ -23,17 +25,17 @@ class DecoderTest extends TestCase
2325 ],
2426 [
2527 'expected ' => ['Foo ' ],
26- 'input ' => [0x1 , 0x4 , /* Foo */
28+ 'input ' => [0x1 , 0x4 , // Foo
2729 0x43 , 0x46 , 0x6f , 0x6f , ],
2830 'name ' => 'one element ' ,
2931 ],
3032 [
3133 'expected ' => ['Foo ' , '人 ' ],
3234 'input ' => [
3335 0x2 , 0x4 ,
34- /* Foo */
36+ // Foo
3537 0x43 , 0x46 , 0x6f , 0x6f ,
36- /* 人 */
38+ // 人
3739 0x43 , 0xe4 , 0xba , 0xba ,
3840 ],
3941 'name ' => 'two elements ' ,
@@ -96,23 +98,23 @@ class DecoderTest extends TestCase
9698 ],
9799 [
98100 'expected ' => ['en ' => 'Foo ' ],
99- 'input ' => [0xe1 , /* en */
101+ 'input ' => [0xe1 , // en
100102 0x42 , 0x65 , 0x6e ,
101- /* Foo */
103+ // Foo
102104 0x43 , 0x46 , 0x6f , 0x6f , ],
103105 'name ' => 'one key ' ,
104106 ],
105107 [
106108 'expected ' => ['en ' => 'Foo ' , 'zh ' => '人 ' ],
107109 'input ' => [
108110 0xe2 ,
109- /* en */
111+ // en
110112 0x42 , 0x65 , 0x6e ,
111- /* Foo */
113+ // Foo
112114 0x43 , 0x46 , 0x6f , 0x6f ,
113- /* zh */
115+ // zh
114116 0x42 , 0x7a , 0x68 ,
115- /* 人 */
117+ // 人
116118 0x43 , 0xe4 , 0xba , 0xba ,
117119 ],
118120 'name ' => 'two keys ' ,
@@ -121,15 +123,15 @@ class DecoderTest extends TestCase
121123 'expected ' => ['name ' => ['en ' => 'Foo ' , 'zh ' => '人 ' ]],
122124 'input ' => [
123125 0xe1 ,
124- /* name */
126+ // name
125127 0x44 , 0x6e , 0x61 , 0x6d , 0x65 , 0xe2 ,
126- /* en */
128+ // en
127129 0x42 , 0x65 , 0x6e ,
128- /* Foo */
130+ // Foo
129131 0x43 , 0x46 , 0x6f , 0x6f ,
130- /* zh */
132+ // zh
131133 0x42 , 0x7a , 0x68 ,
132- /* 人 */
134+ // 人
133135 0x43 , 0xe4 , 0xba , 0xba ,
134136 ],
135137 'name ' => 'nested ' ,
@@ -138,14 +140,14 @@ class DecoderTest extends TestCase
138140 'expected ' => ['languages ' => ['en ' , 'zh ' ]],
139141 'input ' => [
140142 0xe1 ,
141- /* languages */
143+ // languages
142144 0x49 , 0x6c , 0x61 , 0x6e , 0x67 , 0x75 , 0x61 ,
143145 0x67 , 0x65 , 0x73 ,
144- /* array */
146+ // array
145147 0x2 , 0x4 ,
146- /* en */
148+ // en
147149 0x42 , 0x65 , 0x6e ,
148- /* zh */
150+ // zh
149151 0x42 , 0x7a , 0x68 ,
150152 ],
151153 'name ' => 'map with array in it ' ,
@@ -166,8 +168,8 @@ private function pointers(): array
166168 ['expected ' => 524283 , 'input ' => [0x2f , 0xf7 , 0xfb ]],
167169 ['expected ' => 526335 , 'input ' => [0x2f , 0xff , 0xff ]],
168170 ['expected ' => 134217726 , 'input ' => [0x37 , 0xf7 , 0xf7 , 0xfe ]],
169- ['expected ' => PHP_INT_MAX < 4294967295 ? '2147483647 ' : 2147483647 , 'input ' => [0x38 , 0x7f , 0xff , 0xff , 0xff ]],
170- ['expected ' => PHP_INT_MAX < 4294967295 ? '4294967295 ' : 4294967295 , 'input ' => [0x38 , 0xff , 0xff , 0xff , 0xff ]],
171+ ['expected ' => \ PHP_INT_MAX < 4294967295 ? '2147483647 ' : 2147483647 , 'input ' => [0x38 , 0x7f , 0xff , 0xff , 0xff ]],
172+ ['expected ' => \ PHP_INT_MAX < 4294967295 ? '4294967295 ' : 4294967295 , 'input ' => [0x38 , 0xff , 0xff , 0xff , 0xff ]],
171173 ];
172174 }
173175
@@ -205,7 +207,7 @@ private function pointers(): array
205207 */
206208 private function strings (): array
207209 {
208- $ strings = [
210+ return [
209211 ['expected ' => '' , 'input ' => [0x40 ]],
210212 ['expected ' => '1 ' , 'input ' => [0x41 , 0x31 ]],
211213 ['expected ' => '人 ' , 'input ' => [0x43 , 0xE4 , 0xBA , 0xBA ]],
@@ -228,15 +230,15 @@ private function strings(): array
228230 0x36 , 0x37 , 0x38 , 0x39 , 0x30 , ]],
229231
230232 ['expected ' => str_repeat ('x ' , 500 ),
231- 'input ' => array_pad (
233+ 'input ' => array_pad (
232234 [0x5e , 0x0 , 0xd7 ],
233235 503 ,
234236 0x78
235237 ),
236238 ],
237239 [
238- 'expected ' => str_repeat ('x ' , 2000 ),
239- 'input ' => array_pad (
240+ 'expected ' => str_repeat ('x ' , 2000 ),
241+ 'input ' => array_pad (
240242 [0x5e , 0x6 , 0xb3 ],
241243 2003 ,
242244 0x78
@@ -251,8 +253,6 @@ private function strings(): array
251253 ),
252254 ],
253255 ];
254-
255- return $ strings ;
256256 }
257257
258258 /**
@@ -267,7 +267,7 @@ private function uint32(): array
267267 ['expected ' => 10872 , 'input ' => [0xc2 , 0x2a , 0x78 ]],
268268 ['expected ' => 65535 , 'input ' => [0xc2 , 0xff , 0xff ]],
269269 ['expected ' => 16777215 , 'input ' => [0xc3 , 0xff , 0xff , 0xff ]],
270- ['expected ' => PHP_INT_MAX < 4294967295 ? '4294967295 ' : 4294967295 , 'input ' => [0xc4 , 0xff , 0xff , 0xff , 0xff ]],
270+ ['expected ' => \ PHP_INT_MAX < 4294967295 ? '4294967295 ' : 4294967295 , 'input ' => [0xc4 , 0xff , 0xff , 0xff , 0xff ]],
271271 ];
272272 }
273273
0 commit comments