diff --git a/Business/Marketing/NetPromoterScore.php b/Business/Marketing/NetPromoterScore.php index d8133d4a9..856f79a44 100644 --- a/Business/Marketing/NetPromoterScore.php +++ b/Business/Marketing/NetPromoterScore.php @@ -96,7 +96,7 @@ final class NetPromoterScore $count = 0; foreach ($this->scores as $score) { if ($score < 7) { - $count++; + ++$count; } } @@ -117,7 +117,7 @@ final class NetPromoterScore $count = 0; foreach ($this->scores as $score) { if ($score > 6 && $score < 9) { - $count++; + ++$count; } } @@ -138,7 +138,7 @@ final class NetPromoterScore $count = 0; foreach ($this->scores as $score) { if ($score > 8) { - $count++; + ++$count; } } diff --git a/Math/Number/Numbers.php b/Math/Number/Numbers.php index db0387040..b20c0b42c 100644 --- a/Math/Number/Numbers.php +++ b/Math/Number/Numbers.php @@ -114,7 +114,7 @@ final class Numbers if ($n & 1 == 1) { break; } else { - $count++; + ++$count; $n = $n >> 1; } } diff --git a/System/File/FileUtils.php b/System/File/FileUtils.php index 8179de921..79dcfb965 100644 --- a/System/File/FileUtils.php +++ b/System/File/FileUtils.php @@ -130,10 +130,11 @@ final class FileUtils */ public static function changeFileEncoding(string $file, string $encoding) : void { - $content = \file_get_contents($file); + $content = \file_get_contents($file); + $detected = \mb_detect_encoding($content); - if ($content !== false && \preg_match('!!u', $content)) { - \file_put_contents($file, \mb_convert_encoding($content, 'UTF-8', \mb_list_encodings())); + if ($content !== false) { + \file_put_contents($file, \mb_convert_encoding($content, $encoding, $detected === false ? \mb_list_encodings() : $detected)); } }