diff --git a/src/PhpSpreadsheet/Calculation.php b/src/PhpSpreadsheet/Calculation.php index d84932bc..062e2174 100644 --- a/src/PhpSpreadsheet/Calculation.php +++ b/src/PhpSpreadsheet/Calculation.php @@ -13,6 +13,7 @@ use PhpOffice\PhpSpreadsheet\Calculation\LookupRef; use PhpOffice\PhpSpreadsheet\Calculation\MathTrig; use PhpOffice\PhpSpreadsheet\Calculation\Statistical; use PhpOffice\PhpSpreadsheet\Calculation\TextData; +use PhpOffice\PhpSpreadsheet\Calculation\Token\Stack; /** * Copyright (c) 2006 - 2016 PhpSpreadsheet. @@ -2059,8 +2060,6 @@ class Calculation /** * Unset an instance of this class. - * - * @param Spreadsheet $spreadsheet Injected spreadsheet identifying the instance to unset */ public function __destruct() { @@ -2314,6 +2313,14 @@ class Calculation return false; } + /** + * @param string $fromSeparator + * @param string $toSeparator + * @param string $formula + * @param bool $inBraces + * + * @return string + */ public static function translateSeparator($fromSeparator, $toSeparator, $formula, &$inBraces) { $strlen = mb_strlen($formula); @@ -2657,6 +2664,12 @@ class Calculation return $result; } + /** + * @param string $cellReference + * @param mixed $cellValue + * + * @return bool + */ public function getValueFromCache($cellReference, &$cellValue) { // Is calculation cacheing enabled? @@ -2985,6 +2998,11 @@ class Calculation } } + /** + * @param string $formula + * + * @return string + */ private function convertMatrixReferences($formula) { static $matrixReplaceFrom = ['{', ';', '}']; @@ -3073,6 +3091,13 @@ class Calculation ]; // Convert infix to postfix notation + + /** + * @param string $formula + * @param Cell|null $pCell + * + * @return bool + */ private function _parseFormula($formula, Cell $pCell = null) { if (($formula = $this->convertMatrixReferences(trim($formula))) === false) { @@ -3094,7 +3119,7 @@ class Calculation // Start with initialisation $index = 0; - $stack = new Calculation\Token\Stack(); + $stack = new Stack(); $output = []; $expectingOperator = false; // We use this test in syntax-checking the expression to determine when a // - is a negation or + is a positive operator rather than an operation @@ -3401,8 +3426,11 @@ class Calculation // evaluate postfix notation /** - * @param string $cellID * @param mixed $tokens + * @param string|null $cellID + * @param Cell|null $pCell + * + * @return bool */ private function processTokenStack($tokens, $cellID = null, Cell $pCell = null) { @@ -3414,7 +3442,7 @@ class Calculation // so we store the parent cell collection so that we can re-attach it when necessary $pCellWorksheet = ($pCell !== null) ? $pCell->getWorksheet() : null; $pCellParent = ($pCell !== null) ? $pCell->getParent() : null; - $stack = new Calculation\Token\Stack(); + $stack = new Stack(); // Loop through each token in turn foreach ($tokens as $tokenData) { @@ -3811,7 +3839,17 @@ class Calculation return true; } - private function executeBinaryComparisonOperation($cellID, $operand1, $operand2, $operation, &$stack, $recursingArrays = false) + /** + * @param string|null $cellID + * @param mixed $operand1 + * @param mixed $operand2 + * @param string $operation + * @param Stack $stack + * @param bool $recursingArrays + * + * @return bool + */ + private function executeBinaryComparisonOperation($cellID, $operand1, $operand2, $operation, Stack &$stack, $recursingArrays = false) { // If we're dealing with matrix operations, we want a matrix result if ((is_array($operand1)) || (is_array($operand2))) { @@ -3951,7 +3989,7 @@ class Calculation /** * @param string $matrixFunction - * @param mixed $cellID + * @param string|null $cellID * @param mixed $operand1 * @param mixed $operand2 * @param mixed $operation diff --git a/src/PhpSpreadsheet/Calculation/Engineering.php b/src/PhpSpreadsheet/Calculation/Engineering.php index 582c6cbd..8136fe68 100644 --- a/src/PhpSpreadsheet/Calculation/Engineering.php +++ b/src/PhpSpreadsheet/Calculation/Engineering.php @@ -2293,7 +2293,7 @@ class Engineering * Excel Function: * IMSUM(complexNumber[,complexNumber[,...]]) * - * @param string $complexNumbers Series of complex numbers to add + * @param string ...$complexNumbers Series of complex numbers to add * * @return string */ @@ -2333,7 +2333,7 @@ class Engineering * Excel Function: * IMPRODUCT(complexNumber[,complexNumber[,...]]) * - * @param string $complexNumbers Series of complex numbers to multiply + * @param string ...$complexNumbers Series of complex numbers to multiply * * @return string */ diff --git a/src/PhpSpreadsheet/Calculation/Logical.php b/src/PhpSpreadsheet/Calculation/Logical.php index 5492cc6e..4db10945 100644 --- a/src/PhpSpreadsheet/Calculation/Logical.php +++ b/src/PhpSpreadsheet/Calculation/Logical.php @@ -80,7 +80,7 @@ class Logical * * @category Logical Functions * - * @param mixed $args Data values + * @param mixed ...$args Data values * * @return string|bool the logical AND of the arguments */ diff --git a/src/PhpSpreadsheet/Calculation/MathTrig.php b/src/PhpSpreadsheet/Calculation/MathTrig.php index 25200205..f3bcaedb 100644 --- a/src/PhpSpreadsheet/Calculation/MathTrig.php +++ b/src/PhpSpreadsheet/Calculation/MathTrig.php @@ -347,7 +347,7 @@ class MathTrig * * @category Mathematical and Trigonometric Functions * - * @param mixed $args Data values + * @param mixed ...$args Data values * * @return int Greatest Common Divisor */ @@ -456,7 +456,7 @@ class MathTrig * * @category Mathematical and Trigonometric Functions * - * @param mixed $args Data values + * @param mixed ...$args Data values * * @return int Lowest Common Multiplier */ @@ -859,7 +859,7 @@ class MathTrig * * @category Mathematical and Trigonometric Functions * - * @param mixed $args Data values + * @param mixed ...$args Data values * * @return float */ @@ -899,7 +899,7 @@ class MathTrig * * @category Mathematical and Trigonometric Functions * - * @param mixed $args Data values + * @param mixed ...$args Data values * * @return float */ @@ -1185,7 +1185,7 @@ class MathTrig * * @category Mathematical and Trigonometric Functions * - * @param mixed $args Data values + * @param mixed ...$args Data values * * @return float */ @@ -1306,7 +1306,7 @@ class MathTrig * * @category Mathematical and Trigonometric Functions * - * @param mixed $args Data values + * @param mixed ...$args Data values * * @return float */ @@ -1351,7 +1351,7 @@ class MathTrig * * @category Mathematical and Trigonometric Functions * - * @param mixed $args Data values + * @param mixed ...$args Data values * * @return float */ diff --git a/src/PhpSpreadsheet/Calculation/Statistical.php b/src/PhpSpreadsheet/Calculation/Statistical.php index fc5cdbb3..954dfe3c 100644 --- a/src/PhpSpreadsheet/Calculation/Statistical.php +++ b/src/PhpSpreadsheet/Calculation/Statistical.php @@ -720,7 +720,7 @@ class Statistical * * @category Statistical Functions * - * @param mixed $args Data values + * @param mixed ...$args Data values * * @return float */ @@ -771,7 +771,7 @@ class Statistical * * @category Statistical Functions * - * @param mixed $args Data values + * @param mixed ...$args Data values * * @return float */ @@ -814,7 +814,7 @@ class Statistical * * @category Statistical Functions * - * @param mixed $args Data values + * @param mixed ...$args Data values * * @return float */ @@ -1207,7 +1207,7 @@ class Statistical * * @category Statistical Functions * - * @param mixed $args Data values + * @param mixed ...$args Data values * * @return int */ @@ -1241,7 +1241,7 @@ class Statistical * * @category Statistical Functions * - * @param mixed $args Data values + * @param mixed ...$args Data values * * @return int */ @@ -1271,7 +1271,7 @@ class Statistical * * @category Statistical Functions * - * @param mixed $args Data values + * @param mixed ...$args Data values * * @return int */ @@ -1491,7 +1491,7 @@ class Statistical * * @category Statistical Functions * - * @param mixed $args Data values + * @param mixed ...$args Data values * * @return float */ @@ -1785,7 +1785,7 @@ class Statistical * * @category Statistical Functions * - * @param mixed $args Data values + * @param mixed ...$args Data values * * @return float */ @@ -1851,7 +1851,7 @@ class Statistical * * @category Statistical Functions * - * @param mixed $args Data values + * @param mixed ...$args Data values * * @return float */ @@ -1967,7 +1967,7 @@ class Statistical * kurtosis indicates a relatively peaked distribution. Negative kurtosis indicates a * relatively flat distribution. * - * @param array Data Series + * @param array ...$args Data Series * * @return float */ @@ -2249,7 +2249,7 @@ class Statistical * * @category Statistical Functions * - * @param mixed $args Data values + * @param mixed ...$args Data values * * @return float */ @@ -2285,7 +2285,7 @@ class Statistical * * @category Statistical Functions * - * @param mixed $args Data values + * @param mixed ...$args Data values * * @return float */ @@ -2368,7 +2368,7 @@ class Statistical * * @category Statistical Functions * - * @param mixed $args Data values + * @param mixed ...$args Data values * * @return float */ @@ -2412,7 +2412,7 @@ class Statistical * * @category Statistical Functions * - * @param mixed $args Data values + * @param mixed ...$args Data values * * @return float */ @@ -2448,7 +2448,7 @@ class Statistical * * @category Statistical Functions * - * @param mixed $args Data values + * @param mixed ...$args Data values * * @return float */ @@ -2568,7 +2568,7 @@ class Statistical * * @category Statistical Functions * - * @param mixed $args Data values + * @param mixed ...$args Data values * * @return float */ @@ -3016,7 +3016,7 @@ class Statistical * asymmetric tail extending toward more positive values. Negative skewness indicates a * distribution with an asymmetric tail extending toward more negative values. * - * @param array Data Series + * @param array ...$args Data Series * * @return float */ @@ -3161,7 +3161,7 @@ class Statistical * * @category Statistical Functions * - * @param mixed $args Data values + * @param mixed ...$args Data values * * @return float */ @@ -3210,7 +3210,7 @@ class Statistical * * @category Statistical Functions * - * @param mixed $args Data values + * @param mixed ...$args Data values * * @return float */ @@ -3262,7 +3262,7 @@ class Statistical * * @category Statistical Functions * - * @param mixed $args Data values + * @param mixed ...$args Data values * * @return float */ @@ -3309,7 +3309,7 @@ class Statistical * * @category Statistical Functions * - * @param mixed $args Data values + * @param mixed ...$args Data values * * @return float */ @@ -3599,7 +3599,7 @@ class Statistical * * @category Statistical Functions * - * @param mixed $args Data values + * @param mixed ...$args Data values * * @return float */ @@ -3643,7 +3643,7 @@ class Statistical * * @category Statistical Functions * - * @param mixed $args Data values + * @param mixed ...$args Data values * * @return float */ @@ -3696,7 +3696,7 @@ class Statistical * * @category Statistical Functions * - * @param mixed $args Data values + * @param mixed ...$args Data values * * @return float */ @@ -3741,7 +3741,7 @@ class Statistical * * @category Statistical Functions * - * @param mixed $args Data values + * @param mixed ...$args Data values * * @return float */