Fix variadic docblocks

This commit is contained in:
Adrien Crivelli 2017-08-03 12:59:52 +02:00
parent 4a47a32953
commit cf2c0e51f4
No known key found for this signature in database
GPG Key ID: B182FD79DC6DE92E
5 changed files with 80 additions and 42 deletions

View File

@ -13,6 +13,7 @@ use PhpOffice\PhpSpreadsheet\Calculation\LookupRef;
use PhpOffice\PhpSpreadsheet\Calculation\MathTrig; use PhpOffice\PhpSpreadsheet\Calculation\MathTrig;
use PhpOffice\PhpSpreadsheet\Calculation\Statistical; use PhpOffice\PhpSpreadsheet\Calculation\Statistical;
use PhpOffice\PhpSpreadsheet\Calculation\TextData; use PhpOffice\PhpSpreadsheet\Calculation\TextData;
use PhpOffice\PhpSpreadsheet\Calculation\Token\Stack;
/** /**
* Copyright (c) 2006 - 2016 PhpSpreadsheet. * Copyright (c) 2006 - 2016 PhpSpreadsheet.
@ -2059,8 +2060,6 @@ class Calculation
/** /**
* Unset an instance of this class. * Unset an instance of this class.
*
* @param Spreadsheet $spreadsheet Injected spreadsheet identifying the instance to unset
*/ */
public function __destruct() public function __destruct()
{ {
@ -2314,6 +2313,14 @@ class Calculation
return false; return false;
} }
/**
* @param string $fromSeparator
* @param string $toSeparator
* @param string $formula
* @param bool $inBraces
*
* @return string
*/
public static function translateSeparator($fromSeparator, $toSeparator, $formula, &$inBraces) public static function translateSeparator($fromSeparator, $toSeparator, $formula, &$inBraces)
{ {
$strlen = mb_strlen($formula); $strlen = mb_strlen($formula);
@ -2657,6 +2664,12 @@ class Calculation
return $result; return $result;
} }
/**
* @param string $cellReference
* @param mixed $cellValue
*
* @return bool
*/
public function getValueFromCache($cellReference, &$cellValue) public function getValueFromCache($cellReference, &$cellValue)
{ {
// Is calculation cacheing enabled? // Is calculation cacheing enabled?
@ -2985,6 +2998,11 @@ class Calculation
} }
} }
/**
* @param string $formula
*
* @return string
*/
private function convertMatrixReferences($formula) private function convertMatrixReferences($formula)
{ {
static $matrixReplaceFrom = ['{', ';', '}']; static $matrixReplaceFrom = ['{', ';', '}'];
@ -3073,6 +3091,13 @@ class Calculation
]; ];
// Convert infix to postfix notation // Convert infix to postfix notation
/**
* @param string $formula
* @param Cell|null $pCell
*
* @return bool
*/
private function _parseFormula($formula, Cell $pCell = null) private function _parseFormula($formula, Cell $pCell = null)
{ {
if (($formula = $this->convertMatrixReferences(trim($formula))) === false) { if (($formula = $this->convertMatrixReferences(trim($formula))) === false) {
@ -3094,7 +3119,7 @@ class Calculation
// Start with initialisation // Start with initialisation
$index = 0; $index = 0;
$stack = new Calculation\Token\Stack(); $stack = new Stack();
$output = []; $output = [];
$expectingOperator = false; // We use this test in syntax-checking the expression to determine when a $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 // - is a negation or + is a positive operator rather than an operation
@ -3401,8 +3426,11 @@ class Calculation
// evaluate postfix notation // evaluate postfix notation
/** /**
* @param string $cellID
* @param mixed $tokens * @param mixed $tokens
* @param string|null $cellID
* @param Cell|null $pCell
*
* @return bool
*/ */
private function processTokenStack($tokens, $cellID = null, Cell $pCell = null) 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 // so we store the parent cell collection so that we can re-attach it when necessary
$pCellWorksheet = ($pCell !== null) ? $pCell->getWorksheet() : null; $pCellWorksheet = ($pCell !== null) ? $pCell->getWorksheet() : null;
$pCellParent = ($pCell !== null) ? $pCell->getParent() : null; $pCellParent = ($pCell !== null) ? $pCell->getParent() : null;
$stack = new Calculation\Token\Stack(); $stack = new Stack();
// Loop through each token in turn // Loop through each token in turn
foreach ($tokens as $tokenData) { foreach ($tokens as $tokenData) {
@ -3811,7 +3839,17 @@ class Calculation
return true; 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 we're dealing with matrix operations, we want a matrix result
if ((is_array($operand1)) || (is_array($operand2))) { if ((is_array($operand1)) || (is_array($operand2))) {
@ -3951,7 +3989,7 @@ class Calculation
/** /**
* @param string $matrixFunction * @param string $matrixFunction
* @param mixed $cellID * @param string|null $cellID
* @param mixed $operand1 * @param mixed $operand1
* @param mixed $operand2 * @param mixed $operand2
* @param mixed $operation * @param mixed $operation

View File

@ -2293,7 +2293,7 @@ class Engineering
* Excel Function: * Excel Function:
* IMSUM(complexNumber[,complexNumber[,...]]) * IMSUM(complexNumber[,complexNumber[,...]])
* *
* @param string $complexNumbers Series of complex numbers to add * @param string ...$complexNumbers Series of complex numbers to add
* *
* @return string * @return string
*/ */
@ -2333,7 +2333,7 @@ class Engineering
* Excel Function: * Excel Function:
* IMPRODUCT(complexNumber[,complexNumber[,...]]) * IMPRODUCT(complexNumber[,complexNumber[,...]])
* *
* @param string $complexNumbers Series of complex numbers to multiply * @param string ...$complexNumbers Series of complex numbers to multiply
* *
* @return string * @return string
*/ */

View File

@ -80,7 +80,7 @@ class Logical
* *
* @category Logical Functions * @category Logical Functions
* *
* @param mixed $args Data values * @param mixed ...$args Data values
* *
* @return string|bool the logical AND of the arguments * @return string|bool the logical AND of the arguments
*/ */

View File

@ -347,7 +347,7 @@ class MathTrig
* *
* @category Mathematical and Trigonometric Functions * @category Mathematical and Trigonometric Functions
* *
* @param mixed $args Data values * @param mixed ...$args Data values
* *
* @return int Greatest Common Divisor * @return int Greatest Common Divisor
*/ */
@ -456,7 +456,7 @@ class MathTrig
* *
* @category Mathematical and Trigonometric Functions * @category Mathematical and Trigonometric Functions
* *
* @param mixed $args Data values * @param mixed ...$args Data values
* *
* @return int Lowest Common Multiplier * @return int Lowest Common Multiplier
*/ */
@ -859,7 +859,7 @@ class MathTrig
* *
* @category Mathematical and Trigonometric Functions * @category Mathematical and Trigonometric Functions
* *
* @param mixed $args Data values * @param mixed ...$args Data values
* *
* @return float * @return float
*/ */
@ -899,7 +899,7 @@ class MathTrig
* *
* @category Mathematical and Trigonometric Functions * @category Mathematical and Trigonometric Functions
* *
* @param mixed $args Data values * @param mixed ...$args Data values
* *
* @return float * @return float
*/ */
@ -1185,7 +1185,7 @@ class MathTrig
* *
* @category Mathematical and Trigonometric Functions * @category Mathematical and Trigonometric Functions
* *
* @param mixed $args Data values * @param mixed ...$args Data values
* *
* @return float * @return float
*/ */
@ -1306,7 +1306,7 @@ class MathTrig
* *
* @category Mathematical and Trigonometric Functions * @category Mathematical and Trigonometric Functions
* *
* @param mixed $args Data values * @param mixed ...$args Data values
* *
* @return float * @return float
*/ */
@ -1351,7 +1351,7 @@ class MathTrig
* *
* @category Mathematical and Trigonometric Functions * @category Mathematical and Trigonometric Functions
* *
* @param mixed $args Data values * @param mixed ...$args Data values
* *
* @return float * @return float
*/ */

View File

@ -720,7 +720,7 @@ class Statistical
* *
* @category Statistical Functions * @category Statistical Functions
* *
* @param mixed $args Data values * @param mixed ...$args Data values
* *
* @return float * @return float
*/ */
@ -771,7 +771,7 @@ class Statistical
* *
* @category Statistical Functions * @category Statistical Functions
* *
* @param mixed $args Data values * @param mixed ...$args Data values
* *
* @return float * @return float
*/ */
@ -814,7 +814,7 @@ class Statistical
* *
* @category Statistical Functions * @category Statistical Functions
* *
* @param mixed $args Data values * @param mixed ...$args Data values
* *
* @return float * @return float
*/ */
@ -1207,7 +1207,7 @@ class Statistical
* *
* @category Statistical Functions * @category Statistical Functions
* *
* @param mixed $args Data values * @param mixed ...$args Data values
* *
* @return int * @return int
*/ */
@ -1241,7 +1241,7 @@ class Statistical
* *
* @category Statistical Functions * @category Statistical Functions
* *
* @param mixed $args Data values * @param mixed ...$args Data values
* *
* @return int * @return int
*/ */
@ -1271,7 +1271,7 @@ class Statistical
* *
* @category Statistical Functions * @category Statistical Functions
* *
* @param mixed $args Data values * @param mixed ...$args Data values
* *
* @return int * @return int
*/ */
@ -1491,7 +1491,7 @@ class Statistical
* *
* @category Statistical Functions * @category Statistical Functions
* *
* @param mixed $args Data values * @param mixed ...$args Data values
* *
* @return float * @return float
*/ */
@ -1785,7 +1785,7 @@ class Statistical
* *
* @category Statistical Functions * @category Statistical Functions
* *
* @param mixed $args Data values * @param mixed ...$args Data values
* *
* @return float * @return float
*/ */
@ -1851,7 +1851,7 @@ class Statistical
* *
* @category Statistical Functions * @category Statistical Functions
* *
* @param mixed $args Data values * @param mixed ...$args Data values
* *
* @return float * @return float
*/ */
@ -1967,7 +1967,7 @@ class Statistical
* kurtosis indicates a relatively peaked distribution. Negative kurtosis indicates a * kurtosis indicates a relatively peaked distribution. Negative kurtosis indicates a
* relatively flat distribution. * relatively flat distribution.
* *
* @param array Data Series * @param array ...$args Data Series
* *
* @return float * @return float
*/ */
@ -2249,7 +2249,7 @@ class Statistical
* *
* @category Statistical Functions * @category Statistical Functions
* *
* @param mixed $args Data values * @param mixed ...$args Data values
* *
* @return float * @return float
*/ */
@ -2285,7 +2285,7 @@ class Statistical
* *
* @category Statistical Functions * @category Statistical Functions
* *
* @param mixed $args Data values * @param mixed ...$args Data values
* *
* @return float * @return float
*/ */
@ -2368,7 +2368,7 @@ class Statistical
* *
* @category Statistical Functions * @category Statistical Functions
* *
* @param mixed $args Data values * @param mixed ...$args Data values
* *
* @return float * @return float
*/ */
@ -2412,7 +2412,7 @@ class Statistical
* *
* @category Statistical Functions * @category Statistical Functions
* *
* @param mixed $args Data values * @param mixed ...$args Data values
* *
* @return float * @return float
*/ */
@ -2448,7 +2448,7 @@ class Statistical
* *
* @category Statistical Functions * @category Statistical Functions
* *
* @param mixed $args Data values * @param mixed ...$args Data values
* *
* @return float * @return float
*/ */
@ -2568,7 +2568,7 @@ class Statistical
* *
* @category Statistical Functions * @category Statistical Functions
* *
* @param mixed $args Data values * @param mixed ...$args Data values
* *
* @return float * @return float
*/ */
@ -3016,7 +3016,7 @@ class Statistical
* asymmetric tail extending toward more positive values. Negative skewness indicates a * asymmetric tail extending toward more positive values. Negative skewness indicates a
* distribution with an asymmetric tail extending toward more negative values. * distribution with an asymmetric tail extending toward more negative values.
* *
* @param array Data Series * @param array ...$args Data Series
* *
* @return float * @return float
*/ */
@ -3161,7 +3161,7 @@ class Statistical
* *
* @category Statistical Functions * @category Statistical Functions
* *
* @param mixed $args Data values * @param mixed ...$args Data values
* *
* @return float * @return float
*/ */
@ -3210,7 +3210,7 @@ class Statistical
* *
* @category Statistical Functions * @category Statistical Functions
* *
* @param mixed $args Data values * @param mixed ...$args Data values
* *
* @return float * @return float
*/ */
@ -3262,7 +3262,7 @@ class Statistical
* *
* @category Statistical Functions * @category Statistical Functions
* *
* @param mixed $args Data values * @param mixed ...$args Data values
* *
* @return float * @return float
*/ */
@ -3309,7 +3309,7 @@ class Statistical
* *
* @category Statistical Functions * @category Statistical Functions
* *
* @param mixed $args Data values * @param mixed ...$args Data values
* *
* @return float * @return float
*/ */
@ -3599,7 +3599,7 @@ class Statistical
* *
* @category Statistical Functions * @category Statistical Functions
* *
* @param mixed $args Data values * @param mixed ...$args Data values
* *
* @return float * @return float
*/ */
@ -3643,7 +3643,7 @@ class Statistical
* *
* @category Statistical Functions * @category Statistical Functions
* *
* @param mixed $args Data values * @param mixed ...$args Data values
* *
* @return float * @return float
*/ */
@ -3696,7 +3696,7 @@ class Statistical
* *
* @category Statistical Functions * @category Statistical Functions
* *
* @param mixed $args Data values * @param mixed ...$args Data values
* *
* @return float * @return float
*/ */
@ -3741,7 +3741,7 @@ class Statistical
* *
* @category Statistical Functions * @category Statistical Functions
* *
* @param mixed $args Data values * @param mixed ...$args Data values
* *
* @return float * @return float
*/ */