@@ -259,47 +259,47 @@ public function testIniParseQuantityZeroWithMultiplier()
259
259
error_clear_last ();
260
260
$ this ->assertSame (0 , @ini_parse_quantity (' 0 K ' ));
261
261
$ this ->assertSame ('Invalid prefix "0 ", interpreting as "0" for backwards compatibility ' , error_get_last ()['message ' ]);
262
- $ this ->assertContains (error_get_last ()['type ' ], [E_WARNING , E_USER_WARNING ]);
262
+ $ this ->assertContains (error_get_last ()['type ' ], [\ E_WARNING , \ E_USER_WARNING ]);
263
263
}
264
264
265
265
public function testIniParseQuantityNoValidLeadingDigits ()
266
266
{
267
267
error_clear_last ();
268
268
$ this ->assertSame (0 , @ini_parse_quantity (' foo ' ));
269
269
$ this ->assertSame ('Invalid quantity " foo ": no valid leading digits, interpreting as "0" for backwards compatibility ' , error_get_last ()['message ' ]);
270
- $ this ->assertContains (error_get_last ()['type ' ], [E_WARNING , E_USER_WARNING ]);
270
+ $ this ->assertContains (error_get_last ()['type ' ], [\ E_WARNING , \ E_USER_WARNING ]);
271
271
}
272
272
273
273
public function testIniParseQuantityUnknownMultiplier ()
274
274
{
275
275
error_clear_last ();
276
276
$ this ->assertSame (2 , @ini_parse_quantity (' 0b102 ' ));
277
277
$ this ->assertSame ('Invalid quantity " 0b102 ": unknown multiplier "2", interpreting as " 0b10" for backwards compatibility ' , error_get_last ()['message ' ]);
278
- $ this ->assertContains (error_get_last ()['type ' ], [E_WARNING , E_USER_WARNING ]);
278
+ $ this ->assertContains (error_get_last ()['type ' ], [\ E_WARNING , \ E_USER_WARNING ]);
279
279
}
280
280
281
281
public function testIniParseQuantityNoDigitsAfterBasePrefix ()
282
282
{
283
283
error_clear_last ();
284
284
$ this ->assertSame (0 , @ini_parse_quantity (' 0x ' ));
285
285
$ this ->assertSame ('Invalid quantity " 0x ": no digits after base prefix, interpreting as "0" for backwards compatibility ' , error_get_last ()['message ' ]);
286
- $ this ->assertContains (error_get_last ()['type ' ], [E_WARNING , E_USER_WARNING ]);
286
+ $ this ->assertContains (error_get_last ()['type ' ], [\ E_WARNING , \ E_USER_WARNING ]);
287
287
}
288
288
289
289
public function testIniParseQuantityInvalidPrefix ()
290
290
{
291
291
error_clear_last ();
292
292
$ this ->assertSame (0 , @ini_parse_quantity ('0q12 ' ));
293
293
$ this ->assertSame ('Invalid prefix "0q", interpreting as "0" for backwards compatibility ' , error_get_last ()['message ' ]);
294
- $ this ->assertContains (error_get_last ()['type ' ], [E_WARNING , E_USER_WARNING ]);
294
+ $ this ->assertContains (error_get_last ()['type ' ], [\ E_WARNING , \ E_USER_WARNING ]);
295
295
}
296
296
297
297
public function testIniParseQuantityInvalidQuantity ()
298
298
{
299
299
error_clear_last ();
300
300
$ this ->assertSame (10240 , @ini_parse_quantity (' 10 kk ' ));
301
301
$ this ->assertSame ('Invalid quantity " 10 kk ", interpreting as " 10 k" for backwards compatibility ' , error_get_last ()['message ' ]);
302
- $ this ->assertContains (error_get_last ()['type ' ], [E_WARNING , E_USER_WARNING ]);
302
+ $ this ->assertContains (error_get_last ()['type ' ], [\ E_WARNING , \ E_USER_WARNING ]);
303
303
}
304
304
305
305
public function testIniParseQuantityNoLeadingDigits ()
@@ -308,47 +308,47 @@ public function testIniParseQuantityNoLeadingDigits()
308
308
error_clear_last ();
309
309
$ this ->assertSame (0 , @ini_parse_quantity (' K ' ));
310
310
$ this ->assertSame ('Invalid quantity " K ": no valid leading digits, interpreting as "0" for backwards compatibility ' , error_get_last ()['message ' ]);
311
- $ this ->assertContains (error_get_last ()['type ' ], [E_WARNING , E_USER_WARNING ]);
311
+ $ this ->assertContains (error_get_last ()['type ' ], [\ E_WARNING , \ E_USER_WARNING ]);
312
312
}
313
313
314
314
public function testIniParseQuantityOutOfRange ()
315
315
{
316
316
error_clear_last ();
317
317
$ this ->assertSame (-4096 , @ini_parse_quantity (' 0x-4K ' ));
318
318
$ this ->assertSame ('Invalid quantity " 0x-4K ": value is out of range, using overflow result for backwards compatibility ' , error_get_last ()['message ' ]);
319
- $ this ->assertContains (error_get_last ()['type ' ], [E_WARNING , E_USER_WARNING ]);
319
+ $ this ->assertContains (error_get_last ()['type ' ], [\ E_WARNING , \ E_USER_WARNING ]);
320
320
}
321
321
322
322
public function testIniParseQuantityOverflowTooManyDigits ()
323
323
{
324
324
error_clear_last ();
325
325
$ this ->assertSame (-1 , @ini_parse_quantity (' 99999999999999999999 ' ));
326
326
$ this ->assertSame ('Invalid quantity " 99999999999999999999 ": value is out of range, using overflow result for backwards compatibility ' , error_get_last ()['message ' ]);
327
- $ this ->assertContains (error_get_last ()['type ' ], [E_WARNING , E_USER_WARNING ]);
327
+ $ this ->assertContains (error_get_last ()['type ' ], [\ E_WARNING , \ E_USER_WARNING ]);
328
328
}
329
329
330
330
public function testIniParseQuantityOverflowWithMultiplier ()
331
331
{
332
332
error_clear_last ();
333
333
$ this ->assertSame (-7709325833709551616 , @ini_parse_quantity (' 10000000000G ' ));
334
334
$ this ->assertSame ('Invalid quantity " 10000000000G ": value is out of range, using overflow result for backwards compatibility ' , error_get_last ()['message ' ]);
335
- $ this ->assertContains (error_get_last ()['type ' ], [E_WARNING , E_USER_WARNING ]);
335
+ $ this ->assertContains (error_get_last ()['type ' ], [\ E_WARNING , \ E_USER_WARNING ]);
336
336
}
337
337
338
338
public function testIniParseQuantitySignAfterPrefixButNoDigits ()
339
339
{
340
340
error_clear_last ();
341
341
$ this ->assertSame (0 , @ini_parse_quantity (' 0b- ' ));
342
342
$ this ->assertSame ('Invalid quantity " 0b- ": no valid leading digits, interpreting as "0" for backwards compatibility ' , error_get_last ()['message ' ]);
343
- $ this ->assertContains (error_get_last ()['type ' ], [E_WARNING , E_USER_WARNING ]);
343
+ $ this ->assertContains (error_get_last ()['type ' ], [\ E_WARNING , \ E_USER_WARNING ]);
344
344
}
345
345
346
346
public function testIniParseQuantitySpecialCharactersAreEscaped ()
347
347
{
348
348
error_clear_last ();
349
349
$ this ->assertSame (0 , @ini_parse_quantity ("w- \n- \r- \t- \v- \f- \\- \x1B- \xCC- " ));
350
350
$ this ->assertSame ('Invalid quantity "w- \\n- \\r- \\t- \\v- \\f- \\\\- \\e- \\xCC-": no valid leading digits, interpreting as "0" for backwards compatibility ' , error_get_last ()['message ' ]);
351
- $ this ->assertContains (error_get_last ()['type ' ], [E_WARNING , E_USER_WARNING ]);
351
+ $ this ->assertContains (error_get_last ()['type ' ], [\ E_WARNING , \ E_USER_WARNING ]);
352
352
}
353
353
354
354
/**
@@ -357,27 +357,28 @@ public function testIniParseQuantitySpecialCharactersAreEscaped()
357
357
*/
358
358
public function testIniParseQuantityUsingBruteForce ()
359
359
{
360
- if (PHP_VERSION_ID < 80200 ) {
360
+ if (\ PHP_VERSION_ID < 80200 ) {
361
361
$ this ->markTestSkipped ('This test requires the PHP function as a reference. ' );
362
362
363
363
return ;
364
364
}
365
365
366
366
// Comment these lines to run the tests.
367
367
$ this ->markTestSkipped ('This test is slow and should only be used for local development. ' );
368
+
368
369
return ;
369
370
370
371
$ fn = function (string $ test ): void {
371
372
error_clear_last ();
372
- $ x = @ini_parse_quantity ($ test );
373
+ $ x = @ini_parse_quantity ($ test );
373
374
$ err_x = error_get_last ()['message ' ] ?? '' ;
374
375
375
376
error_clear_last ();
376
- $ y = @ini_parse_quantity ($ test );
377
+ $ y = @ini_parse_quantity ($ test );
377
378
$ err_y = error_get_last ()['message ' ] ?? '' ;
378
379
379
- $ this ->assertSame ($ x , $ y , 'Testing " ' . $ test . '" ' );
380
- $ this ->assertSame ($ err_x , $ err_y , 'Testing " ' . $ test . '" ' );
380
+ $ this ->assertSame ($ x , $ y , 'Testing " ' . $ test. '" ' );
381
+ $ this ->assertSame ($ err_x , $ err_y , 'Testing " ' . $ test. '" ' );
381
382
};
382
383
383
384
$ chars = [' ' , '- ' , '+ ' , '0 ' , '1 ' , '7 ' , '9 ' , 'a ' , 'b ' , 'o ' , 'f ' , 'g ' , 'k ' , 'm ' , 'x ' , 'z ' , '\\' ];
@@ -388,22 +389,22 @@ public function testIniParseQuantityUsingBruteForce()
388
389
$ fn ($ char1 );
389
390
390
391
foreach ($ chars as $ char2 ) {
391
- $ fn ($ char1 . $ char2 );
392
+ $ fn ($ char1. $ char2 );
392
393
393
394
foreach ($ chars as $ char3 ) {
394
- $ fn ($ char1 . $ char2 . $ char3 );
395
+ $ fn ($ char1. $ char2. $ char3 );
395
396
396
397
foreach ($ chars as $ char4 ) {
397
- $ fn ($ char1 . $ char2 . $ char3 . $ char4 );
398
+ $ fn ($ char1. $ char2. $ char3. $ char4 );
398
399
399
400
foreach ($ chars as $ char5 ) {
400
- $ fn ($ char1 . $ char2 . $ char3 . $ char4 . $ char5 );
401
+ $ fn ($ char1. $ char2. $ char3. $ char4. $ char5 );
401
402
402
403
foreach ($ chars as $ char6 ) {
403
- $ fn ($ char1 . $ char2 . $ char3 . $ char4 . $ char5 . $ char6 );
404
+ $ fn ($ char1. $ char2. $ char3. $ char4. $ char5. $ char6 );
404
405
405
406
foreach ($ chars as $ char7 ) {
406
- $ fn ($ char1 . $ char2 . $ char3 . $ char4 . $ char5 . $ char6 . $ char7 );
407
+ $ fn ($ char1. $ char2. $ char3. $ char4. $ char5. $ char6. $ char7 );
407
408
}
408
409
}
409
410
}
0 commit comments