Fix unit tests

This commit is contained in:
Adrien Crivelli 2018-10-21 17:51:54 +11:00
parent 09eb05f367
commit 54efe8824e
No known key found for this signature in database
GPG Key ID: B182FD79DC6DE92E
1 changed files with 12 additions and 10 deletions

View File

@ -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;