diff --git a/src/ArrayCollection.php b/src/ArrayCollection.php index 86b07039..926356a2 100644 --- a/src/ArrayCollection.php +++ b/src/ArrayCollection.php @@ -384,7 +384,7 @@ public function slice(int $offset, int|null $length = null): array } /** @psalm-return Collection&Selectable */ - public function matching(Criteria $criteria): Collection + public function matching(Criteria $criteria): Collection&Selectable { $expr = $criteria->getWhereExpression(); $filtered = $this->elements; diff --git a/src/Selectable.php b/src/Selectable.php index 27683baf..63fa770e 100644 --- a/src/Selectable.php +++ b/src/Selectable.php @@ -28,5 +28,5 @@ interface Selectable * @return ReadableCollection&Selectable * @psalm-return ReadableCollection&Selectable */ - public function matching(Criteria $criteria): ReadableCollection; + public function matching(Criteria $criteria): ReadableCollection&Selectable; }