Skip to content

Commit a186c0f

Browse files
committed
fix failing jobs
1 parent a9862ec commit a186c0f

File tree

3 files changed

+6
-10
lines changed

3 files changed

+6
-10
lines changed

system/Files/File.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ public function getSize()
7373
/**
7474
* Retrieve the file size by unit, calculated in IEC standards with 1024 as base value.
7575
*
76-
* @param FileSizeUnit $unit
7776
* @phpstan-param positive-int $precision
7877
* @return false|int|string
7978
*/
@@ -85,7 +84,6 @@ public function getSizeByUnitBinary(FileSizeUnit $unit = FileSizeUnit::B, int $p
8584
/**
8685
* Retrieve the file size by unit, calculated in metric standards with 1000 as base value.
8786
*
88-
* @param FileSizeUnit $unit
8987
* @phpstan-param positive-int $precision
9088
* @return false|int|string
9189
*/
@@ -222,12 +220,10 @@ public function getDestination(string $destination, string $delimiter = '_', int
222220
protected function getSizeByUnitInternal(int $fileSizeBase, FileSizeUnit $unit, int $precision)
223221
{
224222
$exponent = $unit->value;
225-
$divider = $fileSizeBase ** $exponent;
223+
$divider = $fileSizeBase ** $exponent;
224+
$size = $this->getSize() / $divider;
226225

227-
$size = $this->getSize() / $divider;
228-
229-
if($unit !== FileSizeUnit::B)
230-
{
226+
if($unit !== FileSizeUnit::B) {
231227
$size = number_format($size, $precision);
232228
}
233229

system/Files/FileSizeUnit.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@
1313

1414
namespace CodeIgniter\Files;
1515

16-
enum FileSizeUnit : int
16+
enum FileSizeUnit: int
1717
{
1818
case B = 0;
1919
case KB = 1;
2020
case MB = 2;
2121
case GB = 3;
2222
case TB = 4;
23-
}
23+
}

tests/system/Files/FileTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ public function testGetDestination(): void
170170
}
171171

172172
/**
173-
* @return array<string, list<int>>
173+
* @return array<string, array<int, CodeIgniter\Files\FileSizeUnit>>
174174
*/
175175
public static function provideGetSizeData()
176176
{

0 commit comments

Comments
 (0)