Skip to content

Commit

Permalink
fix handle collection filtering with blank method
Browse files Browse the repository at this point in the history
  • Loading branch information
d8vjork committed Jun 12, 2024
1 parent 5f073a9 commit 41f1e63
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/PropertiesMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -339,9 +339,8 @@ protected function mapIntoCollection(array $propertyTypes, string $propertyKey,
$preferredCollectionTypeClass = $preferredCollectionType ? $preferredCollectionType->getClassName() : null;

$collection = $collection->map(fn ($value) => is_string($value) ? trim($value) : $value)
->filter();
// ->filter(fn($item) => !is_null($item))
// ->values();
->filter(fn($item) => !blank($item))
->values();

if ($preferredCollectionType && $preferredCollectionType->getBuiltinType() === Type::BUILTIN_TYPE_OBJECT) {
if (is_subclass_of($preferredCollectionTypeClass, Model::class)) {
Expand Down

0 comments on commit 41f1e63

Please sign in to comment.