From b9d2e9bb56d3057ba7d7a7f1d3c316db679306cd Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Sat, 16 Sep 2017 20:24:39 +0200 Subject: [PATCH] Fix types --- Utils/StringUtils.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Utils/StringUtils.php b/Utils/StringUtils.php index 67de10468..c9e1cdc6f 100644 --- a/Utils/StringUtils.php +++ b/Utils/StringUtils.php @@ -361,8 +361,8 @@ class StringUtils $size = mb_strlen($value); $countChars = self::mb_count_chars($value); - for ($i = 0; $i < $countChars; $i++) { - $p = $value[$i] / $size; + foreach ($countChars as $v) { + $p = $v / $size; $entroy -= $p * log($p) / log(2); } @@ -374,11 +374,11 @@ class StringUtils * * @param string $input String to count chars. * - * @return int + * @return array * * @since 1.0.0 */ - public static function mb_count_chars(string $input) : int + public static function mb_count_chars(string $input) : array { $l = mb_strlen($input, 'UTF-8'); $unique = [];