Use validation classes rather than traits for Statistical functions, … (#1999)
* Use validation classes rather than traits for Statistical functions, and some verification of nullable arguments * Eliminate more of the issues resolved in phpstan baseline
This commit is contained in:
parent
33ec70668b
commit
ddd07ee504
|
|
@ -1500,36 +1500,6 @@ parameters:
|
|||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Averages.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Confidence\\:\\:validateFloat\\(\\) has parameter \\$value with no typehint specified\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Confidence.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Confidence\\:\\:validateInt\\(\\) has parameter \\$value with no typehint specified\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Confidence.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$number of function floor expects float, float\\|int\\|string given\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Confidence.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Percentiles\\:\\:validateFloat\\(\\) has parameter \\$value with no typehint specified\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Percentiles.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Percentiles\\:\\:validateInt\\(\\) has parameter \\$value with no typehint specified\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Percentiles.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$number of function floor expects float, float\\|int\\|string given\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Percentiles.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Percentiles\\:\\:percentileFilterValues\\(\\) has no return typehint specified\\.$#"
|
||||
count: 1
|
||||
|
|
@ -1540,36 +1510,6 @@ parameters:
|
|||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Percentiles.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Permutations\\:\\:validateFloat\\(\\) has parameter \\$value with no typehint specified\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Permutations.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Permutations\\:\\:validateInt\\(\\) has parameter \\$value with no typehint specified\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Permutations.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$number of function floor expects float, float\\|int\\|string given\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Permutations.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Trends\\:\\:validateFloat\\(\\) has parameter \\$value with no typehint specified\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Trends.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Trends\\:\\:validateInt\\(\\) has parameter \\$value with no typehint specified\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Trends.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$number of function floor expects float, float\\|int\\|string given\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Trends.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Trends\\:\\:checkTrendArrays\\(\\) has parameter \\$array1 with no typehint specified\\.$#"
|
||||
count: 1
|
||||
|
|
@ -1625,41 +1565,6 @@ parameters:
|
|||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Conditional.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\Beta\\:\\:validateFloat\\(\\) has parameter \\$value with no typehint specified\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/Beta.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\Beta\\:\\:validateInt\\(\\) has parameter \\$value with no typehint specified\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/Beta.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$number of function floor expects float, float\\|int\\|string given\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/Beta.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\Beta\\:\\:validateBool\\(\\) has parameter \\$value with no typehint specified\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/Beta.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\Beta\\:\\:validateProbability\\(\\) has no return typehint specified\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/Beta.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\Beta\\:\\:validateProbability\\(\\) has parameter \\$probability with no typehint specified\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/Beta.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\Beta\\:\\:calculateInverse\\(\\) has no return typehint specified\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/Beta.php
|
||||
|
||||
-
|
||||
message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\Beta\\:\\:\\$logBetaCacheP has no typehint specified\\.$#"
|
||||
count: 1
|
||||
|
|
@ -1675,106 +1580,11 @@ parameters:
|
|||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/Beta.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\Binomial\\:\\:validateFloat\\(\\) has parameter \\$value with no typehint specified\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/Binomial.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\Binomial\\:\\:validateInt\\(\\) has parameter \\$value with no typehint specified\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/Binomial.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$number of function floor expects float, float\\|int\\|string given\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/Binomial.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\Binomial\\:\\:validateBool\\(\\) has parameter \\$value with no typehint specified\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/Binomial.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\Binomial\\:\\:validateProbability\\(\\) has no return typehint specified\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/Binomial.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\Binomial\\:\\:validateProbability\\(\\) has parameter \\$probability with no typehint specified\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/Binomial.php
|
||||
|
||||
-
|
||||
message: "#^Binary operation \"\\*\" between int\\|string and \\(float\\|int\\) results in an error\\.$#"
|
||||
count: 3
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/Binomial.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\ChiSquared\\:\\:validateFloat\\(\\) has parameter \\$value with no typehint specified\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/ChiSquared.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\ChiSquared\\:\\:validateInt\\(\\) has parameter \\$value with no typehint specified\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/ChiSquared.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$number of function floor expects float, float\\|int\\|string given\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/ChiSquared.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\ChiSquared\\:\\:validateBool\\(\\) has parameter \\$value with no typehint specified\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/ChiSquared.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\ChiSquared\\:\\:validateProbability\\(\\) has no return typehint specified\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/ChiSquared.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\ChiSquared\\:\\:validateProbability\\(\\) has parameter \\$probability with no typehint specified\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/ChiSquared.php
|
||||
|
||||
-
|
||||
message: "#^Binary operation \"\\-\" between 1 and float\\|string results in an error\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/ChiSquared.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\ChiSquared\\:\\:test\\(\\) has no return typehint specified\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/ChiSquared.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\ChiSquared\\:\\:test\\(\\) has parameter \\$actual with no typehint specified\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/ChiSquared.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\ChiSquared\\:\\:test\\(\\) has parameter \\$expected with no typehint specified\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/ChiSquared.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\ChiSquared\\:\\:inverseLeftTailCalculation\\(\\) has no return typehint specified\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/ChiSquared.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\ChiSquared\\:\\:inverseLeftTailCalculation\\(\\) has parameter \\$degrees with no typehint specified\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/ChiSquared.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\ChiSquared\\:\\:inverseLeftTailCalculation\\(\\) has parameter \\$probability with no typehint specified\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/ChiSquared.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\ChiSquared\\:\\:pchisq\\(\\) has no return typehint specified\\.$#"
|
||||
count: 1
|
||||
|
|
@ -1835,221 +1645,11 @@ parameters:
|
|||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/ChiSquared.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\Exponential\\:\\:validateFloat\\(\\) has parameter \\$value with no typehint specified\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/Exponential.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\Exponential\\:\\:validateInt\\(\\) has parameter \\$value with no typehint specified\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/Exponential.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$number of function floor expects float, float\\|int\\|string given\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/Exponential.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\Exponential\\:\\:validateBool\\(\\) has parameter \\$value with no typehint specified\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/Exponential.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\Exponential\\:\\:validateProbability\\(\\) has no return typehint specified\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/Exponential.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\Exponential\\:\\:validateProbability\\(\\) has parameter \\$probability with no typehint specified\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/Exponential.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\F\\:\\:validateFloat\\(\\) has parameter \\$value with no typehint specified\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/F.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\F\\:\\:validateInt\\(\\) has parameter \\$value with no typehint specified\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/F.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$number of function floor expects float, float\\|int\\|string given\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/F.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\F\\:\\:validateBool\\(\\) has parameter \\$value with no typehint specified\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/F.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\F\\:\\:validateProbability\\(\\) has no return typehint specified\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/F.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\F\\:\\:validateProbability\\(\\) has parameter \\$probability with no typehint specified\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/F.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\Fisher\\:\\:validateFloat\\(\\) has parameter \\$value with no typehint specified\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/Fisher.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\Fisher\\:\\:validateInt\\(\\) has parameter \\$value with no typehint specified\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/Fisher.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$number of function floor expects float, float\\|int\\|string given\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/Fisher.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\Fisher\\:\\:validateBool\\(\\) has parameter \\$value with no typehint specified\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/Fisher.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\Fisher\\:\\:validateProbability\\(\\) has no return typehint specified\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/Fisher.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\Fisher\\:\\:validateProbability\\(\\) has parameter \\$probability with no typehint specified\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/Fisher.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\Gamma\\:\\:validateFloat\\(\\) has parameter \\$value with no typehint specified\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/Gamma.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\Gamma\\:\\:validateInt\\(\\) has parameter \\$value with no typehint specified\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/Gamma.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$number of function floor expects float, float\\|int\\|string given\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/Gamma.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\Gamma\\:\\:validateBool\\(\\) has parameter \\$value with no typehint specified\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/Gamma.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\Gamma\\:\\:validateProbability\\(\\) has no return typehint specified\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/Gamma.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\Gamma\\:\\:validateProbability\\(\\) has parameter \\$probability with no typehint specified\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/Gamma.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\HyperGeometric\\:\\:validateFloat\\(\\) has parameter \\$value with no typehint specified\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/HyperGeometric.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\HyperGeometric\\:\\:validateInt\\(\\) has parameter \\$value with no typehint specified\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/HyperGeometric.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$number of function floor expects float, float\\|int\\|string given\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/HyperGeometric.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\HyperGeometric\\:\\:validateBool\\(\\) has parameter \\$value with no typehint specified\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/HyperGeometric.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\HyperGeometric\\:\\:validateProbability\\(\\) has no return typehint specified\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/HyperGeometric.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\HyperGeometric\\:\\:validateProbability\\(\\) has parameter \\$probability with no typehint specified\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/HyperGeometric.php
|
||||
|
||||
-
|
||||
message: "#^Binary operation \"\\*\" between int\\|string and int\\|string results in an error\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/HyperGeometric.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\LogNormal\\:\\:validateFloat\\(\\) has parameter \\$value with no typehint specified\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/LogNormal.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\LogNormal\\:\\:validateInt\\(\\) has parameter \\$value with no typehint specified\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/LogNormal.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$number of function floor expects float, float\\|int\\|string given\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/LogNormal.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\LogNormal\\:\\:validateBool\\(\\) has parameter \\$value with no typehint specified\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/LogNormal.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\LogNormal\\:\\:validateProbability\\(\\) has no return typehint specified\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/LogNormal.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\LogNormal\\:\\:validateProbability\\(\\) has parameter \\$probability with no typehint specified\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/LogNormal.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\Normal\\:\\:validateFloat\\(\\) has parameter \\$value with no typehint specified\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/Normal.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\Normal\\:\\:validateInt\\(\\) has parameter \\$value with no typehint specified\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/Normal.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$number of function floor expects float, float\\|int\\|string given\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/Normal.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\Normal\\:\\:validateBool\\(\\) has parameter \\$value with no typehint specified\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/Normal.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\Normal\\:\\:validateProbability\\(\\) has no return typehint specified\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/Normal.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\Normal\\:\\:validateProbability\\(\\) has parameter \\$probability with no typehint specified\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/Normal.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\Normal\\:\\:inverseNcdf\\(\\) has no return typehint specified\\.$#"
|
||||
count: 1
|
||||
|
|
@ -2060,96 +1660,6 @@ parameters:
|
|||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/Normal.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\Poisson\\:\\:validateFloat\\(\\) has parameter \\$value with no typehint specified\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/Poisson.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\Poisson\\:\\:validateInt\\(\\) has parameter \\$value with no typehint specified\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/Poisson.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$number of function floor expects float, float\\|int\\|string given\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/Poisson.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\Poisson\\:\\:validateBool\\(\\) has parameter \\$value with no typehint specified\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/Poisson.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\Poisson\\:\\:validateProbability\\(\\) has no return typehint specified\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/Poisson.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\Poisson\\:\\:validateProbability\\(\\) has parameter \\$probability with no typehint specified\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/Poisson.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\StudentT\\:\\:validateFloat\\(\\) has parameter \\$value with no typehint specified\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/StudentT.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\StudentT\\:\\:validateInt\\(\\) has parameter \\$value with no typehint specified\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/StudentT.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$number of function floor expects float, float\\|int\\|string given\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/StudentT.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\StudentT\\:\\:validateBool\\(\\) has parameter \\$value with no typehint specified\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/StudentT.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\StudentT\\:\\:validateProbability\\(\\) has no return typehint specified\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/StudentT.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\StudentT\\:\\:validateProbability\\(\\) has parameter \\$probability with no typehint specified\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/StudentT.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\Weibull\\:\\:validateFloat\\(\\) has parameter \\$value with no typehint specified\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/Weibull.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\Weibull\\:\\:validateInt\\(\\) has parameter \\$value with no typehint specified\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/Weibull.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$number of function floor expects float, float\\|int\\|string given\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/Weibull.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\Weibull\\:\\:validateBool\\(\\) has parameter \\$value with no typehint specified\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/Weibull.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\Weibull\\:\\:validateProbability\\(\\) has no return typehint specified\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/Weibull.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\Weibull\\:\\:validateProbability\\(\\) has parameter \\$probability with no typehint specified\\.$#"
|
||||
count: 1
|
||||
path: src/PhpSpreadsheet/Calculation/Statistical/Distributions/Weibull.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Statistical\\\\Distributions\\\\GammaBase\\:\\:calculateDistribution\\(\\) has no return typehint specified\\.$#"
|
||||
count: 1
|
||||
|
|
|
|||
|
|
@ -1,27 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace PhpOffice\PhpSpreadsheet\Calculation\Statistical;
|
||||
|
||||
use PhpOffice\PhpSpreadsheet\Calculation\Exception;
|
||||
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
|
||||
|
||||
trait BaseValidations
|
||||
{
|
||||
protected static function validateFloat($value): float
|
||||
{
|
||||
if (!is_numeric($value)) {
|
||||
throw new Exception(Functions::VALUE());
|
||||
}
|
||||
|
||||
return (float) $value;
|
||||
}
|
||||
|
||||
protected static function validateInt($value): int
|
||||
{
|
||||
if (!is_numeric($value)) {
|
||||
throw new Exception(Functions::VALUE());
|
||||
}
|
||||
|
||||
return (int) floor($value);
|
||||
}
|
||||
}
|
||||
|
|
@ -7,8 +7,6 @@ use PhpOffice\PhpSpreadsheet\Calculation\Functions;
|
|||
|
||||
class Confidence
|
||||
{
|
||||
use BaseValidations;
|
||||
|
||||
/**
|
||||
* CONFIDENCE.
|
||||
*
|
||||
|
|
@ -27,9 +25,9 @@ class Confidence
|
|||
$size = Functions::flattenSingleValue($size);
|
||||
|
||||
try {
|
||||
$alpha = self::validateFloat($alpha);
|
||||
$stdDev = self::validateFloat($stdDev);
|
||||
$size = self::validateInt($size);
|
||||
$alpha = StatisticalValidations::validateFloat($alpha);
|
||||
$stdDev = StatisticalValidations::validateFloat($stdDev);
|
||||
$size = StatisticalValidations::validateInt($size);
|
||||
} catch (Exception $e) {
|
||||
return $e->getMessage();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,47 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace PhpOffice\PhpSpreadsheet\Calculation\Statistical\Distributions;
|
||||
|
||||
use PhpOffice\PhpSpreadsheet\Calculation\Exception;
|
||||
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
|
||||
|
||||
trait BaseValidations
|
||||
{
|
||||
protected static function validateFloat($value): float
|
||||
{
|
||||
if (!is_numeric($value)) {
|
||||
throw new Exception(Functions::VALUE());
|
||||
}
|
||||
|
||||
return (float) $value;
|
||||
}
|
||||
|
||||
protected static function validateInt($value): int
|
||||
{
|
||||
if (!is_numeric($value)) {
|
||||
throw new Exception(Functions::VALUE());
|
||||
}
|
||||
|
||||
return (int) floor($value);
|
||||
}
|
||||
|
||||
protected static function validateBool($value): bool
|
||||
{
|
||||
if (!is_bool($value) && !is_numeric($value)) {
|
||||
throw new Exception(Functions::VALUE());
|
||||
}
|
||||
|
||||
return (bool) $value;
|
||||
}
|
||||
|
||||
protected static function validateProbability($probability)
|
||||
{
|
||||
$probability = self::validateFloat($probability);
|
||||
|
||||
if ($probability < 0.0 || $probability > 1.0) {
|
||||
throw new Exception(Functions::NAN());
|
||||
}
|
||||
|
||||
return $probability;
|
||||
}
|
||||
}
|
||||
|
|
@ -7,8 +7,6 @@ use PhpOffice\PhpSpreadsheet\Calculation\Functions;
|
|||
|
||||
class Beta
|
||||
{
|
||||
use BaseValidations;
|
||||
|
||||
private const MAX_ITERATIONS = 256;
|
||||
|
||||
private const LOG_GAMMA_X_MAX_VALUE = 2.55e305;
|
||||
|
|
@ -28,20 +26,20 @@ class Beta
|
|||
*
|
||||
* @return float|string
|
||||
*/
|
||||
public static function distribution($value, $alpha, $beta, $rMin = 0, $rMax = 1)
|
||||
public static function distribution($value, $alpha, $beta, $rMin = 0.0, $rMax = 1.0)
|
||||
{
|
||||
$value = Functions::flattenSingleValue($value);
|
||||
$alpha = Functions::flattenSingleValue($alpha);
|
||||
$beta = Functions::flattenSingleValue($beta);
|
||||
$rMin = Functions::flattenSingleValue($rMin);
|
||||
$rMax = Functions::flattenSingleValue($rMax);
|
||||
$rMin = ($rMin === null) ? 0.0 : Functions::flattenSingleValue($rMin);
|
||||
$rMax = ($rMax === null) ? 1.0 : Functions::flattenSingleValue($rMax);
|
||||
|
||||
try {
|
||||
$value = self::validateFloat($value);
|
||||
$alpha = self::validateFloat($alpha);
|
||||
$beta = self::validateFloat($beta);
|
||||
$rMax = self::validateFloat($rMax);
|
||||
$rMin = self::validateFloat($rMin);
|
||||
$value = DistributionValidations::validateFloat($value);
|
||||
$alpha = DistributionValidations::validateFloat($alpha);
|
||||
$beta = DistributionValidations::validateFloat($beta);
|
||||
$rMax = DistributionValidations::validateFloat($rMax);
|
||||
$rMin = DistributionValidations::validateFloat($rMin);
|
||||
} catch (Exception $e) {
|
||||
return $e->getMessage();
|
||||
}
|
||||
|
|
@ -74,20 +72,20 @@ class Beta
|
|||
*
|
||||
* @return float|string
|
||||
*/
|
||||
public static function inverse($probability, $alpha, $beta, $rMin = 0, $rMax = 1)
|
||||
public static function inverse($probability, $alpha, $beta, $rMin = 0.0, $rMax = 1.0)
|
||||
{
|
||||
$probability = Functions::flattenSingleValue($probability);
|
||||
$alpha = Functions::flattenSingleValue($alpha);
|
||||
$beta = Functions::flattenSingleValue($beta);
|
||||
$rMin = Functions::flattenSingleValue($rMin);
|
||||
$rMax = Functions::flattenSingleValue($rMax);
|
||||
$rMin = ($rMin === null) ? 0.0 : Functions::flattenSingleValue($rMin);
|
||||
$rMax = ($rMax === null) ? 1.0 : Functions::flattenSingleValue($rMax);
|
||||
|
||||
try {
|
||||
$probability = self::validateProbability($probability);
|
||||
$alpha = self::validateFloat($alpha);
|
||||
$beta = self::validateFloat($beta);
|
||||
$rMax = self::validateFloat($rMax);
|
||||
$rMin = self::validateFloat($rMin);
|
||||
$probability = DistributionValidations::validateProbability($probability);
|
||||
$alpha = DistributionValidations::validateFloat($alpha);
|
||||
$beta = DistributionValidations::validateFloat($beta);
|
||||
$rMax = DistributionValidations::validateFloat($rMax);
|
||||
$rMin = DistributionValidations::validateFloat($rMin);
|
||||
} catch (Exception $e) {
|
||||
return $e->getMessage();
|
||||
}
|
||||
|
|
@ -104,6 +102,9 @@ class Beta
|
|||
return self::calculateInverse($probability, $alpha, $beta, $rMin, $rMax);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return float|string
|
||||
*/
|
||||
private static function calculateInverse(float $probability, float $alpha, float $beta, float $rMin, float $rMax)
|
||||
{
|
||||
$a = 0;
|
||||
|
|
|
|||
|
|
@ -8,8 +8,6 @@ use PhpOffice\PhpSpreadsheet\Calculation\MathTrig;
|
|||
|
||||
class Binomial
|
||||
{
|
||||
use BaseValidations;
|
||||
|
||||
/**
|
||||
* BINOMDIST.
|
||||
*
|
||||
|
|
@ -33,10 +31,10 @@ class Binomial
|
|||
$probability = Functions::flattenSingleValue($probability);
|
||||
|
||||
try {
|
||||
$value = self::validateInt($value);
|
||||
$trials = self::validateInt($trials);
|
||||
$probability = self::validateProbability($probability);
|
||||
$cumulative = self::validateBool($cumulative);
|
||||
$value = DistributionValidations::validateInt($value);
|
||||
$trials = DistributionValidations::validateInt($trials);
|
||||
$probability = DistributionValidations::validateProbability($probability);
|
||||
$cumulative = DistributionValidations::validateBool($cumulative);
|
||||
} catch (Exception $e) {
|
||||
return $e->getMessage();
|
||||
}
|
||||
|
|
@ -74,10 +72,10 @@ class Binomial
|
|||
$limit = ($limit === null) ? $successes : Functions::flattenSingleValue($limit);
|
||||
|
||||
try {
|
||||
$trials = self::validateInt($trials);
|
||||
$probability = self::validateProbability($probability);
|
||||
$successes = self::validateInt($successes);
|
||||
$limit = self::validateInt($limit);
|
||||
$trials = DistributionValidations::validateInt($trials);
|
||||
$probability = DistributionValidations::validateProbability($probability);
|
||||
$successes = DistributionValidations::validateInt($successes);
|
||||
$limit = DistributionValidations::validateInt($limit);
|
||||
} catch (Exception $e) {
|
||||
return $e->getMessage();
|
||||
}
|
||||
|
|
@ -122,9 +120,9 @@ class Binomial
|
|||
$probability = Functions::flattenSingleValue($probability);
|
||||
|
||||
try {
|
||||
$failures = self::validateInt($failures);
|
||||
$successes = self::validateInt($successes);
|
||||
$probability = self::validateProbability($probability);
|
||||
$failures = DistributionValidations::validateInt($failures);
|
||||
$successes = DistributionValidations::validateInt($successes);
|
||||
$probability = DistributionValidations::validateProbability($probability);
|
||||
} catch (Exception $e) {
|
||||
return $e->getMessage();
|
||||
}
|
||||
|
|
@ -161,9 +159,9 @@ class Binomial
|
|||
$alpha = Functions::flattenSingleValue($alpha);
|
||||
|
||||
try {
|
||||
$trials = self::validateInt($trials);
|
||||
$probability = self::validateProbability($probability);
|
||||
$alpha = self::validateFloat($alpha);
|
||||
$trials = DistributionValidations::validateInt($trials);
|
||||
$probability = DistributionValidations::validateProbability($probability);
|
||||
$alpha = DistributionValidations::validateFloat($alpha);
|
||||
} catch (Exception $e) {
|
||||
return $e->getMessage();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,8 +7,6 @@ use PhpOffice\PhpSpreadsheet\Calculation\Functions;
|
|||
|
||||
class ChiSquared
|
||||
{
|
||||
use BaseValidations;
|
||||
|
||||
private const MAX_ITERATIONS = 256;
|
||||
|
||||
private const EPS = 2.22e-16;
|
||||
|
|
@ -29,8 +27,8 @@ class ChiSquared
|
|||
$degrees = Functions::flattenSingleValue($degrees);
|
||||
|
||||
try {
|
||||
$value = self::validateFloat($value);
|
||||
$degrees = self::validateInt($degrees);
|
||||
$value = DistributionValidations::validateFloat($value);
|
||||
$degrees = DistributionValidations::validateInt($degrees);
|
||||
} catch (Exception $e) {
|
||||
return $e->getMessage();
|
||||
}
|
||||
|
|
@ -67,9 +65,9 @@ class ChiSquared
|
|||
$cumulative = Functions::flattenSingleValue($cumulative);
|
||||
|
||||
try {
|
||||
$value = self::validateFloat($value);
|
||||
$degrees = self::validateInt($degrees);
|
||||
$cumulative = self::validateBool($cumulative);
|
||||
$value = DistributionValidations::validateFloat($value);
|
||||
$degrees = DistributionValidations::validateInt($degrees);
|
||||
$cumulative = DistributionValidations::validateBool($cumulative);
|
||||
} catch (Exception $e) {
|
||||
return $e->getMessage();
|
||||
}
|
||||
|
|
@ -109,8 +107,8 @@ class ChiSquared
|
|||
$degrees = Functions::flattenSingleValue($degrees);
|
||||
|
||||
try {
|
||||
$probability = self::validateProbability($probability);
|
||||
$degrees = self::validateInt($degrees);
|
||||
$probability = DistributionValidations::validateProbability($probability);
|
||||
$degrees = DistributionValidations::validateInt($degrees);
|
||||
} catch (Exception $e) {
|
||||
return $e->getMessage();
|
||||
}
|
||||
|
|
@ -145,8 +143,8 @@ class ChiSquared
|
|||
$degrees = Functions::flattenSingleValue($degrees);
|
||||
|
||||
try {
|
||||
$probability = self::validateProbability($probability);
|
||||
$degrees = self::validateInt($degrees);
|
||||
$probability = DistributionValidations::validateProbability($probability);
|
||||
$degrees = DistributionValidations::validateInt($degrees);
|
||||
} catch (Exception $e) {
|
||||
return $e->getMessage();
|
||||
}
|
||||
|
|
@ -158,6 +156,18 @@ class ChiSquared
|
|||
return self::inverseLeftTailCalculation($probability, $degrees);
|
||||
}
|
||||
|
||||
/**
|
||||
* CHITEST.
|
||||
*
|
||||
* Uses the chi-square test to calculate the probability that the differences between two supplied data sets
|
||||
* (of observed and expected frequencies), are likely to be simply due to sampling error,
|
||||
* or if they are likely to be real.
|
||||
*
|
||||
* @param mixed $actual an array of observed frequencies
|
||||
* @param mixed $expected an array of expected frequencies
|
||||
*
|
||||
* @return float|string
|
||||
*/
|
||||
public static function test($actual, $expected)
|
||||
{
|
||||
$rows = count($actual);
|
||||
|
|
@ -199,7 +209,7 @@ class ChiSquared
|
|||
return ($columns - 1) * ($rows - 1);
|
||||
}
|
||||
|
||||
private static function inverseLeftTailCalculation($probability, $degrees)
|
||||
private static function inverseLeftTailCalculation(float $probability, int $degrees): float
|
||||
{
|
||||
// bracket the root
|
||||
$min = 0;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
|
||||
namespace PhpOffice\PhpSpreadsheet\Calculation\Statistical\Distributions;
|
||||
|
||||
use PhpOffice\PhpSpreadsheet\Calculation\Exception;
|
||||
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
|
||||
use PhpOffice\PhpSpreadsheet\Calculation\Statistical\StatisticalValidations;
|
||||
|
||||
class DistributionValidations extends StatisticalValidations
|
||||
{
|
||||
/**
|
||||
* @param mixed $probability
|
||||
*/
|
||||
public static function validateProbability($probability): float
|
||||
{
|
||||
$probability = self::validateFloat($probability);
|
||||
|
||||
if ($probability < 0.0 || $probability > 1.0) {
|
||||
throw new Exception(Functions::NAN());
|
||||
}
|
||||
|
||||
return $probability;
|
||||
}
|
||||
}
|
||||
|
|
@ -7,8 +7,6 @@ use PhpOffice\PhpSpreadsheet\Calculation\Functions;
|
|||
|
||||
class Exponential
|
||||
{
|
||||
use BaseValidations;
|
||||
|
||||
/**
|
||||
* EXPONDIST.
|
||||
*
|
||||
|
|
@ -29,9 +27,9 @@ class Exponential
|
|||
$cumulative = Functions::flattenSingleValue($cumulative);
|
||||
|
||||
try {
|
||||
$value = self::validateFloat($value);
|
||||
$lambda = self::validateFloat($lambda);
|
||||
$cumulative = self::validateBool($cumulative);
|
||||
$value = DistributionValidations::validateFloat($value);
|
||||
$lambda = DistributionValidations::validateFloat($lambda);
|
||||
$cumulative = DistributionValidations::validateBool($cumulative);
|
||||
} catch (Exception $e) {
|
||||
return $e->getMessage();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,8 +7,6 @@ use PhpOffice\PhpSpreadsheet\Calculation\Functions;
|
|||
|
||||
class F
|
||||
{
|
||||
use BaseValidations;
|
||||
|
||||
/**
|
||||
* F.DIST.
|
||||
*
|
||||
|
|
@ -32,10 +30,10 @@ class F
|
|||
$cumulative = Functions::flattenSingleValue($cumulative);
|
||||
|
||||
try {
|
||||
$value = self::validateFloat($value);
|
||||
$u = self::validateInt($u);
|
||||
$v = self::validateInt($v);
|
||||
$cumulative = self::validateBool($cumulative);
|
||||
$value = DistributionValidations::validateFloat($value);
|
||||
$u = DistributionValidations::validateInt($u);
|
||||
$v = DistributionValidations::validateInt($v);
|
||||
$cumulative = DistributionValidations::validateBool($cumulative);
|
||||
} catch (Exception $e) {
|
||||
return $e->getMessage();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,8 +7,6 @@ use PhpOffice\PhpSpreadsheet\Calculation\Functions;
|
|||
|
||||
class Fisher
|
||||
{
|
||||
use BaseValidations;
|
||||
|
||||
/**
|
||||
* FISHER.
|
||||
*
|
||||
|
|
@ -25,7 +23,7 @@ class Fisher
|
|||
$value = Functions::flattenSingleValue($value);
|
||||
|
||||
try {
|
||||
self::validateFloat($value);
|
||||
DistributionValidations::validateFloat($value);
|
||||
} catch (Exception $e) {
|
||||
return $e->getMessage();
|
||||
}
|
||||
|
|
@ -53,7 +51,7 @@ class Fisher
|
|||
$probability = Functions::flattenSingleValue($probability);
|
||||
|
||||
try {
|
||||
self::validateFloat($probability);
|
||||
DistributionValidations::validateFloat($probability);
|
||||
} catch (Exception $e) {
|
||||
return $e->getMessage();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,8 +7,6 @@ use PhpOffice\PhpSpreadsheet\Calculation\Functions;
|
|||
|
||||
class Gamma extends GammaBase
|
||||
{
|
||||
use BaseValidations;
|
||||
|
||||
/**
|
||||
* GAMMA.
|
||||
*
|
||||
|
|
@ -23,7 +21,7 @@ class Gamma extends GammaBase
|
|||
$value = Functions::flattenSingleValue($value);
|
||||
|
||||
try {
|
||||
$value = self::validateFloat($value);
|
||||
$value = DistributionValidations::validateFloat($value);
|
||||
} catch (Exception $e) {
|
||||
return $e->getMessage();
|
||||
}
|
||||
|
|
@ -54,10 +52,10 @@ class Gamma extends GammaBase
|
|||
$b = Functions::flattenSingleValue($b);
|
||||
|
||||
try {
|
||||
$value = self::validateFloat($value);
|
||||
$a = self::validateFloat($a);
|
||||
$b = self::validateFloat($b);
|
||||
$cumulative = self::validateBool($cumulative);
|
||||
$value = DistributionValidations::validateFloat($value);
|
||||
$a = DistributionValidations::validateFloat($a);
|
||||
$b = DistributionValidations::validateFloat($b);
|
||||
$cumulative = DistributionValidations::validateBool($cumulative);
|
||||
} catch (Exception $e) {
|
||||
return $e->getMessage();
|
||||
}
|
||||
|
|
@ -87,9 +85,9 @@ class Gamma extends GammaBase
|
|||
$beta = Functions::flattenSingleValue($beta);
|
||||
|
||||
try {
|
||||
$probability = self::validateProbability($probability);
|
||||
$alpha = self::validateFloat($alpha);
|
||||
$beta = self::validateFloat($beta);
|
||||
$probability = DistributionValidations::validateProbability($probability);
|
||||
$alpha = DistributionValidations::validateFloat($alpha);
|
||||
$beta = DistributionValidations::validateFloat($beta);
|
||||
} catch (Exception $e) {
|
||||
return $e->getMessage();
|
||||
}
|
||||
|
|
@ -115,7 +113,7 @@ class Gamma extends GammaBase
|
|||
$value = Functions::flattenSingleValue($value);
|
||||
|
||||
try {
|
||||
$value = self::validateFloat($value);
|
||||
$value = DistributionValidations::validateFloat($value);
|
||||
} catch (Exception $e) {
|
||||
return $e->getMessage();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,8 +8,6 @@ use PhpOffice\PhpSpreadsheet\Calculation\MathTrig;
|
|||
|
||||
class HyperGeometric
|
||||
{
|
||||
use BaseValidations;
|
||||
|
||||
/**
|
||||
* HYPGEOMDIST.
|
||||
*
|
||||
|
|
@ -31,10 +29,10 @@ class HyperGeometric
|
|||
$populationNumber = Functions::flattenSingleValue($populationNumber);
|
||||
|
||||
try {
|
||||
$sampleSuccesses = self::validateInt($sampleSuccesses);
|
||||
$sampleNumber = self::validateInt($sampleNumber);
|
||||
$populationSuccesses = self::validateInt($populationSuccesses);
|
||||
$populationNumber = self::validateInt($populationNumber);
|
||||
$sampleSuccesses = DistributionValidations::validateInt($sampleSuccesses);
|
||||
$sampleNumber = DistributionValidations::validateInt($sampleNumber);
|
||||
$populationSuccesses = DistributionValidations::validateInt($populationSuccesses);
|
||||
$populationNumber = DistributionValidations::validateInt($populationNumber);
|
||||
} catch (Exception $e) {
|
||||
return $e->getMessage();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,8 +7,6 @@ use PhpOffice\PhpSpreadsheet\Calculation\Functions;
|
|||
|
||||
class LogNormal
|
||||
{
|
||||
use BaseValidations;
|
||||
|
||||
/**
|
||||
* LOGNORMDIST.
|
||||
*
|
||||
|
|
@ -28,9 +26,9 @@ class LogNormal
|
|||
$stdDev = Functions::flattenSingleValue($stdDev);
|
||||
|
||||
try {
|
||||
$value = self::validateFloat($value);
|
||||
$mean = self::validateFloat($mean);
|
||||
$stdDev = self::validateFloat($stdDev);
|
||||
$value = DistributionValidations::validateFloat($value);
|
||||
$mean = DistributionValidations::validateFloat($mean);
|
||||
$stdDev = DistributionValidations::validateFloat($stdDev);
|
||||
} catch (Exception $e) {
|
||||
return $e->getMessage();
|
||||
}
|
||||
|
|
@ -63,10 +61,10 @@ class LogNormal
|
|||
$cumulative = Functions::flattenSingleValue($cumulative);
|
||||
|
||||
try {
|
||||
$value = self::validateFloat($value);
|
||||
$mean = self::validateFloat($mean);
|
||||
$stdDev = self::validateFloat($stdDev);
|
||||
$cumulative = self::validateBool($cumulative);
|
||||
$value = DistributionValidations::validateFloat($value);
|
||||
$mean = DistributionValidations::validateFloat($mean);
|
||||
$stdDev = DistributionValidations::validateFloat($stdDev);
|
||||
$cumulative = DistributionValidations::validateBool($cumulative);
|
||||
} catch (Exception $e) {
|
||||
return $e->getMessage();
|
||||
}
|
||||
|
|
@ -105,9 +103,9 @@ class LogNormal
|
|||
$stdDev = Functions::flattenSingleValue($stdDev);
|
||||
|
||||
try {
|
||||
$probability = self::validateProbability($probability);
|
||||
$mean = self::validateFloat($mean);
|
||||
$stdDev = self::validateFloat($stdDev);
|
||||
$probability = DistributionValidations::validateProbability($probability);
|
||||
$mean = DistributionValidations::validateFloat($mean);
|
||||
$stdDev = DistributionValidations::validateFloat($stdDev);
|
||||
} catch (Exception $e) {
|
||||
return $e->getMessage();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,8 +8,6 @@ use PhpOffice\PhpSpreadsheet\Calculation\Functions;
|
|||
|
||||
class Normal
|
||||
{
|
||||
use BaseValidations;
|
||||
|
||||
public const SQRT2PI = 2.5066282746310005024157652848110452530069867406099;
|
||||
|
||||
/**
|
||||
|
|
@ -33,10 +31,10 @@ class Normal
|
|||
$stdDev = Functions::flattenSingleValue($stdDev);
|
||||
|
||||
try {
|
||||
$value = self::validateFloat($value);
|
||||
$mean = self::validateFloat($mean);
|
||||
$stdDev = self::validateFloat($stdDev);
|
||||
$cumulative = self::validateBool($cumulative);
|
||||
$value = DistributionValidations::validateFloat($value);
|
||||
$mean = DistributionValidations::validateFloat($mean);
|
||||
$stdDev = DistributionValidations::validateFloat($stdDev);
|
||||
$cumulative = DistributionValidations::validateBool($cumulative);
|
||||
} catch (Exception $e) {
|
||||
return $e->getMessage();
|
||||
}
|
||||
|
|
@ -70,9 +68,9 @@ class Normal
|
|||
$stdDev = Functions::flattenSingleValue($stdDev);
|
||||
|
||||
try {
|
||||
$probability = self::validateProbability($probability);
|
||||
$mean = self::validateFloat($mean);
|
||||
$stdDev = self::validateFloat($stdDev);
|
||||
$probability = DistributionValidations::validateProbability($probability);
|
||||
$mean = DistributionValidations::validateFloat($mean);
|
||||
$stdDev = DistributionValidations::validateFloat($stdDev);
|
||||
} catch (Exception $e) {
|
||||
return $e->getMessage();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,8 +8,6 @@ use PhpOffice\PhpSpreadsheet\Calculation\MathTrig;
|
|||
|
||||
class Poisson
|
||||
{
|
||||
use BaseValidations;
|
||||
|
||||
/**
|
||||
* POISSON.
|
||||
*
|
||||
|
|
@ -29,9 +27,9 @@ class Poisson
|
|||
$mean = Functions::flattenSingleValue($mean);
|
||||
|
||||
try {
|
||||
$value = self::validateFloat($value);
|
||||
$mean = self::validateFloat($mean);
|
||||
$cumulative = self::validateBool($cumulative);
|
||||
$value = DistributionValidations::validateFloat($value);
|
||||
$mean = DistributionValidations::validateFloat($mean);
|
||||
$cumulative = DistributionValidations::validateBool($cumulative);
|
||||
} catch (Exception $e) {
|
||||
return $e->getMessage();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,8 +7,6 @@ use PhpOffice\PhpSpreadsheet\Calculation\Functions;
|
|||
|
||||
class StudentT
|
||||
{
|
||||
use BaseValidations;
|
||||
|
||||
private const MAX_ITERATIONS = 256;
|
||||
|
||||
/**
|
||||
|
|
@ -29,9 +27,9 @@ class StudentT
|
|||
$tails = Functions::flattenSingleValue($tails);
|
||||
|
||||
try {
|
||||
$value = self::validateFloat($value);
|
||||
$degrees = self::validateInt($degrees);
|
||||
$tails = self::validateInt($tails);
|
||||
$value = DistributionValidations::validateFloat($value);
|
||||
$degrees = DistributionValidations::validateInt($degrees);
|
||||
$tails = DistributionValidations::validateInt($tails);
|
||||
} catch (Exception $e) {
|
||||
return $e->getMessage();
|
||||
}
|
||||
|
|
@ -59,8 +57,8 @@ class StudentT
|
|||
$degrees = Functions::flattenSingleValue($degrees);
|
||||
|
||||
try {
|
||||
$probability = self::validateProbability($probability);
|
||||
$degrees = self::validateInt($degrees);
|
||||
$probability = DistributionValidations::validateProbability($probability);
|
||||
$degrees = DistributionValidations::validateInt($degrees);
|
||||
} catch (Exception $e) {
|
||||
return $e->getMessage();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,8 +7,6 @@ use PhpOffice\PhpSpreadsheet\Calculation\Functions;
|
|||
|
||||
class Weibull
|
||||
{
|
||||
use BaseValidations;
|
||||
|
||||
/**
|
||||
* WEIBULL.
|
||||
*
|
||||
|
|
@ -30,10 +28,10 @@ class Weibull
|
|||
$cumulative = Functions::flattenSingleValue($cumulative);
|
||||
|
||||
try {
|
||||
$value = self::validateFloat($value);
|
||||
$alpha = self::validateFloat($alpha);
|
||||
$beta = self::validateFloat($beta);
|
||||
$cumulative = self::validateBool($cumulative);
|
||||
$value = DistributionValidations::validateFloat($value);
|
||||
$alpha = DistributionValidations::validateFloat($alpha);
|
||||
$beta = DistributionValidations::validateFloat($beta);
|
||||
$cumulative = DistributionValidations::validateBool($cumulative);
|
||||
} catch (Exception $e) {
|
||||
return $e->getMessage();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,8 +7,6 @@ use PhpOffice\PhpSpreadsheet\Calculation\Functions;
|
|||
|
||||
class Percentiles
|
||||
{
|
||||
use BaseValidations;
|
||||
|
||||
public const RANK_SORT_DESCENDING = 0;
|
||||
|
||||
public const RANK_SORT_ASCENDING = 1;
|
||||
|
|
@ -33,7 +31,7 @@ class Percentiles
|
|||
$entry = array_pop($aArgs);
|
||||
|
||||
try {
|
||||
$entry = self::validateFloat($entry);
|
||||
$entry = StatisticalValidations::validateFloat($entry);
|
||||
} catch (Exception $e) {
|
||||
return $e->getMessage();
|
||||
}
|
||||
|
|
@ -82,8 +80,8 @@ class Percentiles
|
|||
$significance = ($significance === null) ? 3 : Functions::flattenSingleValue($significance);
|
||||
|
||||
try {
|
||||
$value = self::validateFloat($value);
|
||||
$significance = self::validateInt($significance);
|
||||
$value = StatisticalValidations::validateFloat($value);
|
||||
$significance = StatisticalValidations::validateInt($significance);
|
||||
} catch (Exception $e) {
|
||||
return $e->getMessage();
|
||||
}
|
||||
|
|
@ -132,7 +130,7 @@ class Percentiles
|
|||
$entry = array_pop($aArgs);
|
||||
|
||||
try {
|
||||
$entry = self::validateFloat($entry);
|
||||
$entry = StatisticalValidations::validateFloat($entry);
|
||||
} catch (Exception $e) {
|
||||
return $e->getMessage();
|
||||
}
|
||||
|
|
@ -164,8 +162,8 @@ class Percentiles
|
|||
$order = ($order === null) ? self::RANK_SORT_DESCENDING : Functions::flattenSingleValue($order);
|
||||
|
||||
try {
|
||||
$value = self::validateFloat($value);
|
||||
$order = self::validateInt($order);
|
||||
$value = StatisticalValidations::validateFloat($value);
|
||||
$order = StatisticalValidations::validateInt($order);
|
||||
} catch (Exception $e) {
|
||||
return $e->getMessage();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,8 +8,6 @@ use PhpOffice\PhpSpreadsheet\Calculation\MathTrig;
|
|||
|
||||
class Permutations
|
||||
{
|
||||
use BaseValidations;
|
||||
|
||||
/**
|
||||
* PERMUT.
|
||||
*
|
||||
|
|
@ -30,8 +28,8 @@ class Permutations
|
|||
$numInSet = Functions::flattenSingleValue($numInSet);
|
||||
|
||||
try {
|
||||
$numObjs = self::validateInt($numObjs);
|
||||
$numInSet = self::validateInt($numInSet);
|
||||
$numObjs = StatisticalValidations::validateInt($numObjs);
|
||||
$numInSet = StatisticalValidations::validateInt($numInSet);
|
||||
} catch (Exception $e) {
|
||||
return $e->getMessage();
|
||||
}
|
||||
|
|
@ -60,8 +58,8 @@ class Permutations
|
|||
$numInSet = Functions::flattenSingleValue($numInSet);
|
||||
|
||||
try {
|
||||
$numObjs = self::validateInt($numObjs);
|
||||
$numInSet = self::validateInt($numInSet);
|
||||
$numObjs = StatisticalValidations::validateInt($numObjs);
|
||||
$numInSet = StatisticalValidations::validateInt($numInSet);
|
||||
} catch (Exception $e) {
|
||||
return $e->getMessage();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,45 @@
|
|||
<?php
|
||||
|
||||
namespace PhpOffice\PhpSpreadsheet\Calculation\Statistical;
|
||||
|
||||
use PhpOffice\PhpSpreadsheet\Calculation\Exception;
|
||||
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
|
||||
|
||||
class StatisticalValidations
|
||||
{
|
||||
/**
|
||||
* @param mixed $value
|
||||
*/
|
||||
public static function validateFloat($value): float
|
||||
{
|
||||
if (!is_numeric($value)) {
|
||||
throw new Exception(Functions::VALUE());
|
||||
}
|
||||
|
||||
return (float) $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $value
|
||||
*/
|
||||
public static function validateInt($value): int
|
||||
{
|
||||
if (!is_numeric($value)) {
|
||||
throw new Exception(Functions::VALUE());
|
||||
}
|
||||
|
||||
return (int) floor((float) $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $value
|
||||
*/
|
||||
public static function validateBool($value): bool
|
||||
{
|
||||
if (!is_bool($value) && !is_numeric($value)) {
|
||||
throw new Exception(Functions::VALUE());
|
||||
}
|
||||
|
||||
return (bool) $value;
|
||||
}
|
||||
}
|
||||
|
|
@ -8,8 +8,6 @@ use PhpOffice\PhpSpreadsheet\Shared\Trend\Trend;
|
|||
|
||||
class Trends
|
||||
{
|
||||
use BaseValidations;
|
||||
|
||||
private static function filterTrendValues(array &$array1, array &$array2): void
|
||||
{
|
||||
foreach ($array1 as $key => $value) {
|
||||
|
|
@ -120,7 +118,7 @@ class Trends
|
|||
$xValue = Functions::flattenSingleValue($xValue);
|
||||
|
||||
try {
|
||||
$xValue = self::validateFloat($xValue);
|
||||
$xValue = StatisticalValidations::validateFloat($xValue);
|
||||
self::checkTrendArrays($yValues, $xValues);
|
||||
self::validateTrendArrays($yValues, $xValues);
|
||||
} catch (Exception $e) {
|
||||
|
|
|
|||
|
|
@ -29,6 +29,10 @@ return [
|
|||
0.4059136,
|
||||
0.4, 4, 5,
|
||||
],
|
||||
[
|
||||
0.4059136,
|
||||
0.4, 4, 5, null, null,
|
||||
],
|
||||
[
|
||||
'#VALUE!',
|
||||
'NAN', 8, 10, 1, 3,
|
||||
|
|
|
|||
|
|
@ -25,6 +25,10 @@ return [
|
|||
0.303225844664,
|
||||
0.2, 4, 5, 0, 1,
|
||||
],
|
||||
[
|
||||
0.303225844664,
|
||||
0.2, 4, 5, null, null,
|
||||
],
|
||||
[
|
||||
'#VALUE!',
|
||||
'NAN', 4, 5, 0, 1,
|
||||
|
|
|
|||
|
|
@ -25,6 +25,10 @@ return [
|
|||
0.079589237387,
|
||||
100, 0.5, 50,
|
||||
],
|
||||
[
|
||||
0.079589237387,
|
||||
100, 0.5, 50, null,
|
||||
],
|
||||
[
|
||||
'#VALUE!',
|
||||
'NaN', 0.5, 50, 100,
|
||||
|
|
|
|||
|
|
@ -37,6 +37,12 @@ return [
|
|||
[24, 22, 19, 21, 18, 19, 20, 23],
|
||||
22,
|
||||
],
|
||||
[
|
||||
0.952209647727,
|
||||
[24, 22, 19, 21, 18, 19, 20, 23],
|
||||
22,
|
||||
null,
|
||||
],
|
||||
[
|
||||
'#VALUE!',
|
||||
[1, 2, 3, 3, 4, 4, 8, 10, 12],
|
||||
|
|
|
|||
Loading…
Reference in New Issue