Skip to content

Commit

Permalink
move filter to the handler
Browse files Browse the repository at this point in the history
  • Loading branch information
romalytvynenko committed Aug 22, 2022
1 parent 3f24a4f commit e4bacb1
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/Support/Generator/Combined/AllOf.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function toArray()

public function setItems($items)
{
$this->items = array_filter($items);
$this->items = $items;

return $this;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Support/Generator/Combined/OneOf.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function toArray()

public function setItems($items)
{
$this->items = array_filter($items);
$this->items = $items;

return $this;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Support/TypeHandlers/IntersectionTypeNodeHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ public static function shouldHandle($node)

public function handle(): ?Type
{
return (new AllOf)->setItems(array_map(
return (new AllOf)->setItems(array_filter(array_map(
fn ($t) => TypeHandlers::handle($t),
$this->node->types,
));
)));
}
}
4 changes: 2 additions & 2 deletions src/Support/TypeHandlers/UnionTypeNodeHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ public static function shouldHandle($node)

public function handle(): ?Type
{
return (new OneOf)->setItems(array_map(
return (new OneOf)->setItems(array_filter(array_map(
fn ($t) => TypeHandlers::handle($t),
$this->node->types,
));
)));
}
}

0 comments on commit e4bacb1

Please sign in to comment.