Update more code.

This commit is contained in:
James Cole
2025-05-04 13:04:33 +02:00
parent abd9260193
commit e42107c03c
55 changed files with 106 additions and 278 deletions

View File

@@ -82,17 +82,15 @@ class ActionExpression
// 'destination_transaction_id',
'notes',
];
private string $expr;
private ExpressionLanguage $expressionLanguage;
private bool $isExpression;
private ?SyntaxError $validationError;
private readonly ExpressionLanguage $expressionLanguage;
private readonly bool $isExpression;
private readonly ?SyntaxError $validationError;
public function __construct(string $expr)
public function __construct(private readonly string $expr)
{
$this->expressionLanguage = app(ExpressionLanguage::class);
$this->expr = $expr;
$this->isExpression = self::isExpression($expr);
$this->isExpression = self::isExpression($this->expr);
$this->validationError = $this->validate();
}

View File

@@ -45,16 +45,12 @@ class ActionExpressionLanguageProvider implements ExpressionFunctionProviderInte
return [
new ExpressionFunction(
'constant2',
static function ($str): string {
return sprintf('(is_string(%1$s) ? strtolower(%1$s) : %1$s)', $str.'!');
},
static fn($str): string => sprintf('(is_string(%1$s) ? strtolower(%1$s) : %1$s)', $str.'!'),
$function
),
new ExpressionFunction(
'constant',
static function ($str): string {
return sprintf('(is_string(%1$s) ? strtolower(%1$s) : %1$s)', $str.'!');
},
static fn($str): string => sprintf('(is_string(%1$s) ? strtolower(%1$s) : %1$s)', $str.'!'),
$function
),