diff --git a/CHANGELOG.md b/CHANGELOG.md index 8069ae9..d8e24fd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 1.0.2 - WIP + +- Fix deprecations for PHP 8.4 + ## 1.0.1 - 2024-11-21 - Welcome PHP 8.4 diff --git a/src/Freq.php b/src/Freq.php index 12ba7aa..6b3711c 100644 --- a/src/Freq.php +++ b/src/Freq.php @@ -141,10 +141,9 @@ public static function frequencyTableBySize(array $data, int $chunkSize = 1): ar * each class is not a range. * * @param mixed[] $data - * @param ?int $category * @return int[] */ - public static function frequencyTable(array $data, int $category = null): array + public static function frequencyTable(array $data, ?int $category = null): array { $result = []; $min = floor((float) min($data)); diff --git a/src/Stat.php b/src/Stat.php index 9d56c9b..4d9fc30 100644 --- a/src/Stat.php +++ b/src/Stat.php @@ -291,7 +291,7 @@ public static function pvariance(array $data, ?int $round = null): float * * @return float the standard deviation of the numeric data */ - public static function stdev(array $data, int $round = null): float + public static function stdev(array $data, ?int $round = null): float { $variance = self::variance($data); diff --git a/src/Statistics.php b/src/Statistics.php index e681cd4..1f2f804 100755 --- a/src/Statistics.php +++ b/src/Statistics.php @@ -86,7 +86,7 @@ public function frequencies(bool $transformToInteger = false): array * @param int|null $round whether to round the result * @return array */ - public function relativeFrequencies(int $round = null): array + public function relativeFrequencies(?int $round = null): array { return Freq::relativeFrequencies($this->values, $round); } diff --git a/tests/StatFromCsvTest.php b/tests/StatFromCsvTest.php index 733b911..2ec7b17 100644 --- a/tests/StatFromCsvTest.php +++ b/tests/StatFromCsvTest.php @@ -8,7 +8,13 @@ if (($handle = fopen(getcwd() . '/tests/data/income.data.csv', 'r')) !== false) { $x = []; $y = []; - while (($data = fgetcsv($handle, 1000, ',')) !== false) { + while (($data = fgetcsv( + $handle, + 1000, + separator: ',', + enclosure: '"', + escape: "", + )) !== false) { $num = count($data); expect($num)->toEqual(3); $row++;