diff --git a/src/core/etl/src/Flow/ETL/Function/Concat.php b/src/core/etl/src/Flow/ETL/Function/Concat.php index 7849c77b5..b379dae16 100644 --- a/src/core/etl/src/Flow/ETL/Function/Concat.php +++ b/src/core/etl/src/Flow/ETL/Function/Concat.php @@ -23,21 +23,17 @@ public function __construct( public function eval(Row $row) : mixed { - $values = \array_map(fn (ScalarFunction|string $string) : mixed => \is_string($string) ? $string : Caster::default()->to(type_string(true))->value($string->eval($row)), $this->refs); - + /** @var array $concatValues */ $concatValues = []; - foreach ($values as $value) { + foreach ($this->refs as $value) { + $value = \is_string($value) ? $value : Caster::default()->to(type_string(true))->value($value->eval($row)); + if (\is_string($value)) { $concatValues[] = $value; } } - if (\count($concatValues) === 0) { - return ''; - } - - /** @var array $values */ return \implode('', $concatValues); } } diff --git a/src/core/etl/src/Flow/ETL/Function/ConcatWithSeparator.php b/src/core/etl/src/Flow/ETL/Function/ConcatWithSeparator.php index a19af2ce2..7f67283e5 100644 --- a/src/core/etl/src/Flow/ETL/Function/ConcatWithSeparator.php +++ b/src/core/etl/src/Flow/ETL/Function/ConcatWithSeparator.php @@ -30,21 +30,17 @@ public function eval(Row $row) : mixed return ''; } - $values = \array_map(fn (ScalarFunction|string $string) : mixed => \is_string($string) ? $string : Caster::default()->to(type_string(true))->value($string->eval($row)), $this->refs); - + /** @var array $concatValues */ $concatValues = []; - foreach ($values as $value) { + foreach ($this->refs as $value) { + $value = \is_string($value) ? $value : Caster::default()->to(type_string(true))->value($value->eval($row)); + if (\is_string($value)) { $concatValues[] = $value; } } - if (\count($concatValues) === 0) { - return ''; - } - - /** @var array $values */ return \implode($separator, $concatValues); } }