Skip to content

Commit e4973fa

Browse files
author
Mark Baker
authored
Start work on refactoring the last of the Excel Statistical functions (#2033)
* Refactoring the last of the Excel Statistical functions
1 parent 160ae59 commit e4973fa

File tree

14 files changed

+581
-251
lines changed

14 files changed

+581
-251
lines changed

phpstan-baseline.neon

-5
Original file line numberDiff line numberDiff line change
@@ -1085,11 +1085,6 @@ parameters:
10851085
count: 1
10861086
path: src/PhpSpreadsheet/Calculation/LookupRef/VLookup.php
10871087

1088-
-
1089-
message: "#^Binary operation \"\\-\" between float\\|int and float\\|string results in an error\\.$#"
1090-
count: 4
1091-
path: src/PhpSpreadsheet/Calculation/Statistical.php
1092-
10931088
-
10941089
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\:\\:MAXIFS\\(\\) should return float but returns float\\|string\\|null\\.$#"
10951090
count: 1

src/PhpSpreadsheet/Calculation/Calculation.php

+13-13
Original file line numberDiff line numberDiff line change
@@ -848,7 +848,7 @@ class Calculation
848848
],
849849
'DEVSQ' => [
850850
'category' => Category::CATEGORY_STATISTICAL,
851-
'functionCall' => [Statistical::class, 'DEVSQ'],
851+
'functionCall' => [Statistical\Deviations::class, 'sumSquares'],
852852
'argumentCount' => '1+',
853853
],
854854
'DGET' => [
@@ -1185,7 +1185,7 @@ class Calculation
11851185
],
11861186
'GAUSS' => [
11871187
'category' => Category::CATEGORY_STATISTICAL,
1188-
'functionCall' => [Statistical::class, 'GAUSS'],
1188+
'functionCall' => [Statistical\Distributions\StandardNormal::class, 'gauss'],
11891189
'argumentCount' => '1',
11901190
],
11911191
'GCD' => [
@@ -1195,7 +1195,7 @@ class Calculation
11951195
],
11961196
'GEOMEAN' => [
11971197
'category' => Category::CATEGORY_STATISTICAL,
1198-
'functionCall' => [Statistical::class, 'GEOMEAN'],
1198+
'functionCall' => [Statistical\Averages\Mean::class, 'geometric'],
11991199
'argumentCount' => '1+',
12001200
],
12011201
'GESTEP' => [
@@ -1215,7 +1215,7 @@ class Calculation
12151215
],
12161216
'HARMEAN' => [
12171217
'category' => Category::CATEGORY_STATISTICAL,
1218-
'functionCall' => [Statistical::class, 'HARMEAN'],
1218+
'functionCall' => [Statistical\Averages\Mean::class, 'harmonic'],
12191219
'argumentCount' => '1+',
12201220
],
12211221
'HEX2BIN' => [
@@ -1529,12 +1529,12 @@ class Calculation
15291529
],
15301530
'KURT' => [
15311531
'category' => Category::CATEGORY_STATISTICAL,
1532-
'functionCall' => [Statistical::class, 'KURT'],
1532+
'functionCall' => [Statistical\Deviations::class, 'kurtosis'],
15331533
'argumentCount' => '1+',
15341534
],
15351535
'LARGE' => [
15361536
'category' => Category::CATEGORY_STATISTICAL,
1537-
'functionCall' => [Statistical::class, 'LARGE'],
1537+
'functionCall' => [Statistical\Size::class, 'large'],
15381538
'argumentCount' => '2',
15391539
],
15401540
'LCM' => [
@@ -2071,7 +2071,7 @@ class Calculation
20712071
],
20722072
'RANK.EQ' => [
20732073
'category' => Category::CATEGORY_STATISTICAL,
2074-
'functionCall' => [Statistical::class, 'RANK'],
2074+
'functionCall' => [Statistical\Percentiles::class, 'RANK'],
20752075
'argumentCount' => '2,3',
20762076
],
20772077
'RATE' => [
@@ -2218,7 +2218,7 @@ class Calculation
22182218
],
22192219
'SKEW' => [
22202220
'category' => Category::CATEGORY_STATISTICAL,
2221-
'functionCall' => [Statistical::class, 'SKEW'],
2221+
'functionCall' => [Statistical\Deviations::class, 'skew'],
22222222
'argumentCount' => '1+',
22232223
],
22242224
'SKEW.P' => [
@@ -2238,7 +2238,7 @@ class Calculation
22382238
],
22392239
'SMALL' => [
22402240
'category' => Category::CATEGORY_STATISTICAL,
2241-
'functionCall' => [Statistical::class, 'SMALL'],
2241+
'functionCall' => [Statistical\Size::class, 'small'],
22422242
'argumentCount' => '2',
22432243
],
22442244
'SORT' => [
@@ -2263,7 +2263,7 @@ class Calculation
22632263
],
22642264
'STANDARDIZE' => [
22652265
'category' => Category::CATEGORY_STATISTICAL,
2266-
'functionCall' => [Statistical::class, 'STANDARDIZE'],
2266+
'functionCall' => [Statistical\Standardize::class, 'execute'],
22672267
'argumentCount' => '3',
22682268
],
22692269
'STDEV' => [
@@ -2288,12 +2288,12 @@ class Calculation
22882288
],
22892289
'STDEVP' => [
22902290
'category' => Category::CATEGORY_STATISTICAL,
2291-
'functionCall' => [Statistical::class, 'STDEVP'],
2291+
'functionCall' => [Statistical\StandardDeviations::class, 'STDEVP'],
22922292
'argumentCount' => '1+',
22932293
],
22942294
'STDEVPA' => [
22952295
'category' => Category::CATEGORY_STATISTICAL,
2296-
'functionCall' => [Statistical::class, 'STDEVPA'],
2296+
'functionCall' => [Statistical\StandardDeviations::class, 'STDEVPA'],
22972297
'argumentCount' => '1+',
22982298
],
22992299
'STEYX' => [
@@ -2469,7 +2469,7 @@ class Calculation
24692469
],
24702470
'TRIMMEAN' => [
24712471
'category' => Category::CATEGORY_STATISTICAL,
2472-
'functionCall' => [Statistical::class, 'TRIMMEAN'],
2472+
'functionCall' => [Statistical\Averages\Mean::class, 'trim'],
24732473
'argumentCount' => '2',
24742474
],
24752475
'TRUE' => [

0 commit comments

Comments
 (0)