Formula function trailing comma

This commit is contained in:
Yurii
2026-04-15 12:46:40 +03:00
parent b00f4a0c56
commit 52345b4779
2 changed files with 25 additions and 0 deletions

View File

@@ -1282,6 +1282,10 @@ class Parser
)
);
if ($argument === '' && $i === count($commaIndexList) - 1) {
continue;
}
$argumentList[] = $argument;
}

View File

@@ -2117,4 +2117,25 @@ class EvaluatorTest extends TestCase
/** @noinspection PhpUnhandledExceptionInspection */
$this->evaluator->process($expression);
}
public function testFunctionArguments(): void
{
$expression = "
\$a = list(0, 1);
\$b = list(0, 1,);
\$c = list(
0,
1,
);
";
$vars = (object) [];
/** @noinspection PhpUnhandledExceptionInspection */
$this->evaluator->process($expression, null, $vars);
$this->assertEquals([0, 1], $vars->a);
$this->assertEquals([0, 1], $vars->b);
$this->assertEquals([0, 1], $vars->c);
}
}