Skip to content

Commit 54efe88

Browse files
committed
Fix unit tests
1 parent 09eb05f commit 54efe88

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

src/PhpSpreadsheet/Calculation/Calculation.php

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3942,7 +3942,7 @@ private function processTokenStack($tokens, $cellID = null, Cell $pCell = null)
39423942
}
39433943

39443944
// Process the argument with the appropriate function call
3945-
$args = $this->addCellReference($args, $passCellReference, $pCell, $functionCall);
3945+
$args = $this->addCellReference($args, $passCellReference, $functionCall, $pCell);
39463946

39473947
if (!is_array($functionCall)) {
39483948
foreach ($args as &$arg) {
@@ -4440,21 +4440,23 @@ public function getImplementedFunctionNames()
44404440
*
44414441
* @param array $args
44424442
* @param bool $passCellReference
4443-
* @param Cell $pCell
4444-
* @param array $functionCall
4443+
* @param array|string $functionCall
4444+
* @param null|Cell $pCell
44454445
*
44464446
* @return array
44474447
*/
4448-
private function addCellReference(array $args, $passCellReference, Cell $pCell, array $functionCall)
4448+
private function addCellReference(array $args, $passCellReference, $functionCall, Cell $pCell = null)
44494449
{
44504450
if ($passCellReference) {
4451-
$className = $functionCall[0];
4452-
$methodName = $functionCall[1];
4453-
4454-
$reflectionMethod = new \ReflectionMethod($className, $methodName);
4455-
$argumentCount = count($reflectionMethod->getParameters());
4456-
while (count($args) < $argumentCount - 1) {
4457-
$args[] = null;
4451+
if (is_array($functionCall)) {
4452+
$className = $functionCall[0];
4453+
$methodName = $functionCall[1];
4454+
4455+
$reflectionMethod = new \ReflectionMethod($className, $methodName);
4456+
$argumentCount = count($reflectionMethod->getParameters());
4457+
while (count($args) < $argumentCount - 1) {
4458+
$args[] = null;
4459+
}
44584460
}
44594461

44604462
$args[] = $pCell;

0 commit comments

Comments
 (0)