Skip to content

Commit ac0fbf6

Browse files
LukeTowersnicolas-grekas
authored andcommitted
[HttpFoundation] Drop int return type from parseFilesize()
1 parent ccc835d commit ac0fbf6

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

Constraints/FileValidator.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,10 @@ private static function moreDecimalsThan(string $double, int $numberOfDecimals):
214214
/**
215215
* Convert the limit to the smallest possible number
216216
* (i.e. try "MB", then "kB", then "bytes").
217+
*
218+
* @param int|float $limit
217219
*/
218-
private function factorizeSizes(int $size, int $limit, bool $binaryFormat): array
220+
private function factorizeSizes(int $size, $limit, bool $binaryFormat): array
219221
{
220222
if ($binaryFormat) {
221223
$coef = self::MIB_BYTES;

Tests/Constraints/FileValidatorTest.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -459,14 +459,12 @@ public function uploadedFileErrorProvider()
459459
[, $limit, $suffix] = $method->invokeArgs(new FileValidator(), [0, UploadedFile::getMaxFilesize(), false]);
460460

461461
// it correctly parses the maxSize option and not only uses simple string comparison
462-
// 1000M should be bigger than the ini value
462+
// 1000G should be bigger than the ini value
463463
$tests[] = [(string) \UPLOAD_ERR_INI_SIZE, 'uploadIniSizeErrorMessage', [
464464
'{{ limit }}' => $limit,
465465
'{{ suffix }}' => $suffix,
466-
], '1000M'];
466+
], '1000G'];
467467

468-
// it correctly parses the maxSize option and not only uses simple string comparison
469-
// 1000M should be bigger than the ini value
470468
$tests[] = [(string) \UPLOAD_ERR_INI_SIZE, 'uploadIniSizeErrorMessage', [
471469
'{{ limit }}' => '0.1',
472470
'{{ suffix }}' => 'MB',

0 commit comments

Comments
 (0)