From 62ab8c4e835396e1dd64cb5862c8d03ab10d7a68 Mon Sep 17 00:00:00 2001 From: Oleg Makedonsky Date: Sat, 4 Jul 2020 23:11:24 +0300 Subject: [PATCH] Fix aspect on SearchResultCollection 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. --- src/SearchResultCollection.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SearchResultCollection.php b/src/SearchResultCollection.php index 500216d..881d577 100644 --- a/src/SearchResultCollection.php +++ b/src/SearchResultCollection.php @@ -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()); } }