Skip to content

Commit

Permalink
Add casting for Finder.
Browse files Browse the repository at this point in the history
  • Loading branch information
dereuromark committed Feb 24, 2024
1 parent 6669ae5 commit 48e5be9
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/Model/Filter/Finder.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,13 @@ public function process(): bool
$casts = $this->getConfig('cast');
foreach ($casts as $field => $toType) {
$value = $args[$field] ?? null;
// Sanity check
if (!is_scalar($value)) {
continue;
}

if (is_callable($toType)) {
$value = $toType($value);
} else {
settype($value, $toType);
}

$args[$field] = $value;
}

Expand Down

0 comments on commit 48e5be9

Please sign in to comment.