1313use PhpOffice \PhpSpreadsheet \Calculation \MathTrig ;
1414use PhpOffice \PhpSpreadsheet \Calculation \Statistical ;
1515use PhpOffice \PhpSpreadsheet \Calculation \TextData ;
16+ use PhpOffice \PhpSpreadsheet \Calculation \Token \Stack ;
1617
1718/**
1819 * Copyright (c) 2006 - 2016 PhpSpreadsheet.
@@ -2059,8 +2060,6 @@ public static function getInstance(Spreadsheet $spreadsheet = null)
20592060
20602061 /**
20612062 * Unset an instance of this class.
2062- *
2063- * @param Spreadsheet $spreadsheet Injected spreadsheet identifying the instance to unset
20642063 */
20652064 public function __destruct ()
20662065 {
@@ -2314,6 +2313,14 @@ public function setLocale($locale)
23142313 return false ;
23152314 }
23162315
2316+ /**
2317+ * @param string $fromSeparator
2318+ * @param string $toSeparator
2319+ * @param string $formula
2320+ * @param bool $inBraces
2321+ *
2322+ * @return string
2323+ */
23172324 public static function translateSeparator ($ fromSeparator , $ toSeparator , $ formula , &$ inBraces )
23182325 {
23192326 $ strlen = mb_strlen ($ formula );
@@ -2657,6 +2664,12 @@ public function calculateFormula($formula, $cellID = null, Cell $pCell = null)
26572664 return $ result ;
26582665 }
26592666
2667+ /**
2668+ * @param string $cellReference
2669+ * @param mixed $cellValue
2670+ *
2671+ * @return bool
2672+ */
26602673 public function getValueFromCache ($ cellReference , &$ cellValue )
26612674 {
26622675 // Is calculation cacheing enabled?
@@ -2985,6 +2998,11 @@ private function showTypeDetails($value)
29852998 }
29862999 }
29873000
3001+ /**
3002+ * @param string $formula
3003+ *
3004+ * @return string
3005+ */
29883006 private function convertMatrixReferences ($ formula )
29893007 {
29903008 static $ matrixReplaceFrom = ['{ ' , '; ' , '} ' ];
@@ -3073,6 +3091,13 @@ private static function mkMatrix(...$args)
30733091 ];
30743092
30753093 // Convert infix to postfix notation
3094+
3095+ /**
3096+ * @param string $formula
3097+ * @param Cell|null $pCell
3098+ *
3099+ * @return bool
3100+ */
30763101 private function _parseFormula ($ formula , Cell $ pCell = null )
30773102 {
30783103 if (($ formula = $ this ->convertMatrixReferences (trim ($ formula ))) === false ) {
@@ -3094,7 +3119,7 @@ private function _parseFormula($formula, Cell $pCell = null)
30943119
30953120 // Start with initialisation
30963121 $ index = 0 ;
3097- $ stack = new Calculation \ Token \ Stack ();
3122+ $ stack = new Stack ();
30983123 $ output = [];
30993124 $ expectingOperator = false ; // We use this test in syntax-checking the expression to determine when a
31003125 // - is a negation or + is a positive operator rather than an operation
@@ -3401,8 +3426,11 @@ private static function dataTestReference(&$operandData)
34013426 // evaluate postfix notation
34023427
34033428 /**
3404- * @param string $cellID
34053429 * @param mixed $tokens
3430+ * @param string|null $cellID
3431+ * @param Cell|null $pCell
3432+ *
3433+ * @return bool
34063434 */
34073435 private function processTokenStack ($ tokens , $ cellID = null , Cell $ pCell = null )
34083436 {
@@ -3414,7 +3442,7 @@ private function processTokenStack($tokens, $cellID = null, Cell $pCell = null)
34143442 // so we store the parent cell collection so that we can re-attach it when necessary
34153443 $ pCellWorksheet = ($ pCell !== null ) ? $ pCell ->getWorksheet () : null ;
34163444 $ pCellParent = ($ pCell !== null ) ? $ pCell ->getParent () : null ;
3417- $ stack = new Calculation \ Token \ Stack ();
3445+ $ stack = new Stack ();
34183446
34193447 // Loop through each token in turn
34203448 foreach ($ tokens as $ tokenData ) {
@@ -3811,7 +3839,17 @@ private function validateBinaryOperand($cellID, &$operand, &$stack)
38113839 return true ;
38123840 }
38133841
3814- private function executeBinaryComparisonOperation ($ cellID , $ operand1 , $ operand2 , $ operation , &$ stack , $ recursingArrays = false )
3842+ /**
3843+ * @param string|null $cellID
3844+ * @param mixed $operand1
3845+ * @param mixed $operand2
3846+ * @param string $operation
3847+ * @param Stack $stack
3848+ * @param bool $recursingArrays
3849+ *
3850+ * @return bool
3851+ */
3852+ private function executeBinaryComparisonOperation ($ cellID , $ operand1 , $ operand2 , $ operation , Stack &$ stack , $ recursingArrays = false )
38153853 {
38163854 // If we're dealing with matrix operations, we want a matrix result
38173855 if ((is_array ($ operand1 )) || (is_array ($ operand2 ))) {
@@ -3951,7 +3989,7 @@ private function strcmpLowercaseFirst($str1, $str2)
39513989
39523990 /**
39533991 * @param string $matrixFunction
3954- * @param mixed $cellID
3992+ * @param string|null $cellID
39553993 * @param mixed $operand1
39563994 * @param mixed $operand2
39573995 * @param mixed $operation
0 commit comments