From 6e42fcdeaed6178fcce6c6aa680557a144b15356 Mon Sep 17 00:00:00 2001 From: Joshua Ramon Enslin Date: Sat, 8 Aug 2020 22:32:15 +0200 Subject: [PATCH] Fix type hints for human file size --- src/MDOutputHandler.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/MDOutputHandler.php b/src/MDOutputHandler.php index 397c0f2..4450684 100644 --- a/src/MDOutputHandler.php +++ b/src/MDOutputHandler.php @@ -31,15 +31,15 @@ class MDOutputHandler { * Function human_filesize translates byte-level filesizes to human readable ones. * Thanks to Jeffrey Sambells http://jeffreysambells.com/2012/10/25/human-readable-filesize-php * - * @param string $bytes A file size, e.g. returned from filesize(). + * @param integer $bytes A file size, e.g. returned from filesize(). * @param integer $decimals Number of decimal digits to allow. * * @return string */ - final private function _human_filesize(string $bytes, int $decimals = 2):string { + final private function _human_filesize(int $bytes, int $decimals = 2):string { $size = ['B','kB','MB','GB','TB','PB','EB','ZB','YB']; - $factor = floor((strlen($bytes) - 1) / 3); + $factor = floor((strlen((string)$bytes) - 1) / 3); return sprintf("%.{$decimals}f", $bytes / pow(1024, $factor)) . $size[$factor]; }