From 5282aa33da838e2e186d1e646daef7cc3b9b409c Mon Sep 17 00:00:00 2001 From: Thomas Meschke Date: Mon, 18 Nov 2024 11:05:26 +0100 Subject: [PATCH] replace pow with expression --- system/Files/File.php | 2 +- tests/system/Files/FileTest.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/system/Files/File.php b/system/Files/File.php index 598901a02ad2..93710e72ffc5 100644 --- a/system/Files/File.php +++ b/system/Files/File.php @@ -222,7 +222,7 @@ public function getDestination(string $destination, string $delimiter = '_', int protected function getSizeByUnitInternal(int $fileSizeBase, FileSizeUnit $unit, int $precision) { $exponent = $unit->value; - $divider = pow($fileSizeBase, $exponent); + $divider = $fileSizeBase ** $exponent; $size = $this->getSize() / $divider; diff --git a/tests/system/Files/FileTest.php b/tests/system/Files/FileTest.php index a359d4996ed9..464b625189c7 100644 --- a/tests/system/Files/FileTest.php +++ b/tests/system/Files/FileTest.php @@ -118,7 +118,7 @@ public function testGetSizeReturnsBytes(): void */ public function testGetSizeBinary(FileSizeUnit $unit): void { - $divider = pow(1024, $unit->value); + $divider = 1024 ** $unit->value; $file = new File(SYSTEMPATH . 'Common.php'); $size = number_format(filesize(SYSTEMPATH . 'Common.php') / $divider, 3); $this->assertSame($size, $file->getSizeByUnitBinary($unit)); @@ -136,7 +136,7 @@ public function testGetSizeBinaryBytes(): void */ public function testGetSizeMetric(FileSizeUnit $unit): void { - $divider = pow(1000, $unit->value); + $divider = 1000 ** $unit->value; $file = new File(SYSTEMPATH . 'Common.php'); $size = number_format(filesize(SYSTEMPATH . 'Common.php') / $divider, 3); $this->assertSame($size, $file->getSizeByUnitMetric($unit));