Source
622
622
623
623
/**
624
624
* Analyze an expression and returns expression html tree.
625
625
*
626
626
* @param string $expression Trigger expression or recovery expression string.
627
627
* @param int $type Type can be either TRIGGER_EXPRESSION or TRIGGER_RECOVERY_EXPRESSION.
628
628
* @param string $error [OUT] An error message.
629
629
*
630
630
* @return array|bool
631
631
*/
632
-
function analyzeExpression(string $expression, int $type, string &$error = null) {
632
+
function analyzeExpression(string $expression, int $type, ?string &$error = null) {
633
633
if ($expression === '') {
634
634
return ['', null];
635
635
}
636
636
637
637
$expression_parser = new CExpressionParser(['usermacros' => true, 'lldmacros' => true]);
638
638
639
639
if ($expression_parser->parse($expression) != CParser::PARSE_SUCCESS) {
640
640
$error = $expression_parser->getError();
641
641
642
642
return false;
986
986
* - R - remove.
987
987
*
988
988
* @param string $expression
989
989
* @param string $expression_id Element identifier like "0_55".
990
990
* @param string $action Action to perform.
991
991
* @param string $new_expression Expression for AND, OR or replace actions.
992
992
* @param string $error [OUT] An error message.
993
993
*
994
994
* @return bool|string Returns new expression or false if expression is incorrect.
995
995
*/
996
-
function remakeExpression($expression, $expression_id, $action, $new_expression, string &$error = null) {
996
+
function remakeExpression($expression, $expression_id, $action, $new_expression, ?string &$error = null) {
997
997
if ($expression === '') {
998
998
return false;
999
999
}
1000
1000
1001
1001
$expression_parser = new CExpressionParser(['usermacros' => true, 'lldmacros' => true]);
1002
1002
if ($action !== 'R' && $expression_parser->parse($new_expression) != CParser::PARSE_SUCCESS) {
1003
1003
$error = $expression_parser->getError();
1004
1004
return false;
1005
1005
}
1006
1006