From 54efe8824e39410095257d10df2b2503f9fe5752 Mon Sep 17 00:00:00 2001 From: Adrien Crivelli Date: Sun, 21 Oct 2018 17:51:54 +1100 Subject: [PATCH] Fix unit tests --- .../Calculation/Calculation.php | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/PhpSpreadsheet/Calculation/Calculation.php b/src/PhpSpreadsheet/Calculation/Calculation.php index 2e5f967b..a1e1585d 100644 --- a/src/PhpSpreadsheet/Calculation/Calculation.php +++ b/src/PhpSpreadsheet/Calculation/Calculation.php @@ -3942,7 +3942,7 @@ class Calculation } // Process the argument with the appropriate function call - $args = $this->addCellReference($args, $passCellReference, $pCell, $functionCall); + $args = $this->addCellReference($args, $passCellReference, $functionCall, $pCell); if (!is_array($functionCall)) { foreach ($args as &$arg) { @@ -4440,21 +4440,23 @@ class Calculation * * @param array $args * @param bool $passCellReference - * @param Cell $pCell - * @param array $functionCall + * @param array|string $functionCall + * @param null|Cell $pCell * * @return array */ - private function addCellReference(array $args, $passCellReference, Cell $pCell, array $functionCall) + private function addCellReference(array $args, $passCellReference, $functionCall, Cell $pCell = null) { if ($passCellReference) { - $className = $functionCall[0]; - $methodName = $functionCall[1]; + if (is_array($functionCall)) { + $className = $functionCall[0]; + $methodName = $functionCall[1]; - $reflectionMethod = new \ReflectionMethod($className, $methodName); - $argumentCount = count($reflectionMethod->getParameters()); - while (count($args) < $argumentCount - 1) { - $args[] = null; + $reflectionMethod = new \ReflectionMethod($className, $methodName); + $argumentCount = count($reflectionMethod->getParameters()); + while (count($args) < $argumentCount - 1) { + $args[] = null; + } } $args[] = $pCell;