From 84100eb260fcc0705277438e7a603cf6c9f26d28 Mon Sep 17 00:00:00 2001 From: Lukas Eichenauer Date: Wed, 7 Jan 2026 09:09:04 +0100 Subject: [PATCH 1/2] fix: use news collection if no contexts provided to avoid "Argument #1 ($callback) must be of type Closure, null given" --- Services/News/src/Persistence/NewsRepository.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Services/News/src/Persistence/NewsRepository.php b/Services/News/src/Persistence/NewsRepository.php index 508b12274001..e168d924111a 100644 --- a/Services/News/src/Persistence/NewsRepository.php +++ b/Services/News/src/Persistence/NewsRepository.php @@ -154,10 +154,10 @@ public function findByContextsBatch(array $contexts, NewsCriteria $criteria): Ne /** * @param NewsContext[] $contexts */ - public function findByContextsBatchLazy(array $contexts, NewsCriteria $criteria): LazyNewsCollection + public function findByContextsBatchLazy(array $contexts, NewsCriteria $criteria): NewsCollection { if (empty($contexts)) { - return new LazyNewsCollection(); + return new NewsCollection(); } $obj_ids = array_map(fn($context) => $context->getObjId(), $contexts); From b97d8053da1b125f383c71d38ef146410d32edf8 Mon Sep 17 00:00:00 2001 From: Lukas Eichenauer Date: Wed, 7 Jan 2026 09:19:17 +0100 Subject: [PATCH 2/2] fix: allow null values in withFetchCallback as object property may be null --- Services/News/src/Data/LazyNewsCollection.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Services/News/src/Data/LazyNewsCollection.php b/Services/News/src/Data/LazyNewsCollection.php index 80f43c7a02be..a87b9ef2f795 100644 --- a/Services/News/src/Data/LazyNewsCollection.php +++ b/Services/News/src/Data/LazyNewsCollection.php @@ -46,9 +46,9 @@ public function __construct( } /** - * @param \Closure(int[], string[]): NewsItem[] $callback + * @param null|\Closure(int[], string[]): NewsItem[] $callback */ - public function withFetchCallback(\Closure $callback): static + public function withFetchCallback(?\Closure $callback): static { $clone = clone $this; $clone->fetch_callback = $callback;