Skip to content

Commit

Permalink
Fix: moved parameters after check null on string
Browse files Browse the repository at this point in the history
  • Loading branch information
f-lapinski committed Feb 17, 2025
1 parent e5ede91 commit d299844
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/core/etl/src/Flow/ETL/Function/StringBefore.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,14 @@ public function __construct(
public function eval(Row $row) : mixed
{
$string = (new Parameter($this->string))->asString($row);
$needle = (new Parameter($this->needle))->as($row, type_string(), type_list(type_string()));
$includeNeedle = (new Parameter($this->includeNeedle))->asBoolean($row);

if ($string === null) {
return null;

Check warning on line 27 in src/core/etl/src/Flow/ETL/Function/StringBefore.php

View check run for this annotation

Codecov / codecov/patch

src/core/etl/src/Flow/ETL/Function/StringBefore.php#L27

Added line #L27 was not covered by tests
}

$needle = (new Parameter($this->needle))->as($row, type_string(), type_list(type_string()));
$includeNeedle = (new Parameter($this->includeNeedle))->asBoolean($row);

return u($string)->before($needle, $includeNeedle)->toString();
}

Expand Down

0 comments on commit d299844

Please sign in to comment.