Skip to content

Commit

Permalink
Fix aspect on SearchResultCollection
Browse files Browse the repository at this point in the history
Currently if there's no results of some type, and you try to get it, you'll get type error cause it returns null, but Collection is type-hinted.

I propose returning empty collection instead of null.
  • Loading branch information
satoved committed Jul 4, 2020
1 parent 95ce9dc commit 62ab8c4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/SearchResultCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ public function groupByType(): Collection

public function aspect(string $aspectName): Collection
{
return $this->groupByType()->get($aspectName);
return $this->groupByType()->get($aspectName, collect());
}
}

0 comments on commit 62ab8c4

Please sign in to comment.